Skip to content

Commit 0c36e7f

Browse files
authored
Add e2e test for publishing a page (#9090)
1 parent 38a6eff commit 0c36e7f

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

test/e2e/specs/publishing.test.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,45 @@ import {
77
} from '../support/utils';
88

99
describe( 'Publishing', () => {
10-
beforeEach( async () => {
11-
await newPost();
10+
describe( 'a post', () => {
11+
beforeEach( async () => {
12+
await newPost();
13+
} );
14+
15+
it( 'should publish a post and close the panel once we start editing again', async () => {
16+
await page.type( '.editor-post-title__input', 'E2E Test Post' );
17+
18+
await publishPost();
19+
20+
// The post-publishing panel is visible.
21+
expect( await page.$( '.editor-post-publish-panel' ) ).not.toBeNull();
22+
23+
// Start editing again.
24+
await page.type( '.editor-post-title__input', ' (Updated)' );
25+
26+
// The post-publishing panel is not visible anymore.
27+
expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
28+
} );
1229
} );
1330

14-
it( 'Should publish a post and close the panel once we start editing again', async () => {
15-
await page.type( '.editor-post-title__input', 'E2E Test Post' );
31+
describe( 'a page', () => {
32+
beforeEach( async () => {
33+
await newPost( 'page' );
34+
} );
35+
36+
it( 'should publish a page and close the panel once we start editing again', async () => {
37+
await page.type( '.editor-post-title__input', 'E2E Test Page' );
1638

17-
await publishPost();
39+
await publishPost();
1840

19-
// The post publish panel is visible
20-
expect( await page.$( '.editor-post-publish-panel' ) ).not.toBeNull();
41+
// The post-publishing panel is visible.
42+
expect( await page.$( '.editor-post-publish-panel' ) ).not.toBeNull();
2143

22-
// Start editing again
23-
await page.type( '.editor-post-title__input', ' (Updated)' );
44+
// Start editing the page again.
45+
await page.type( '.editor-post-title__input', ' (Updated)' );
2446

25-
// The post publish panel is not visible anymore
26-
expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
47+
// The post-publishing panel is not visible anymore.
48+
expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
49+
} );
2750
} );
2851
} );

0 commit comments

Comments
 (0)