-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathdemo.test.js
44 lines (39 loc) · 1.11 KB
/
demo.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* WordPress dependencies
*/
import {
createEmbeddingMatcher,
createJSONResponse,
createNewPost,
setUpResponseMocking,
visitAdminPage,
} from '@wordpress/e2e-test-utils';
const MOCK_VIMEO_RESPONSE = {
url: 'https://vimeo.com/22439234',
html: '<iframe width="16" height="9"></iframe>',
type: 'video',
provider_name: 'Vimeo',
provider_url: 'https://vimeo.com',
version: '1.0',
};
describe( 'new editor state', () => {
beforeAll( async () => {
// First, make sure that the block editor is properly configured.
await createNewPost();
await setUpResponseMocking( [
{
match: createEmbeddingMatcher( 'https://vimeo.com/22439234' ),
onRequestMatch: createJSONResponse( MOCK_VIMEO_RESPONSE ),
},
] );
await visitAdminPage( 'post-new.php', 'gutenberg-demo' );
} );
it( 'content should load, making the post dirty', async () => {
const isDirty = await page.evaluate( () => {
const { select } = window.wp.data;
return select( 'core/editor' ).isEditedPostDirty();
} );
expect( isDirty ).toBeTruthy();
expect( await page.$( 'button.editor-post-save-draft' ) ).toBeTruthy();
} );
} );