-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
gutenberg-editor-initial-html.test.js
39 lines (36 loc) · 1.24 KB
/
gutenberg-editor-initial-html.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
/**
* Internal dependencies
*/
import initialHtml from '../src/initial-html';
import { isAndroid } from './helpers/utils';
describe( 'Gutenberg Editor Blocks test', () => {
it( 'should be able to create a post with all blocks and scroll to the last one', async () => {
await editorPage.setHtmlContent( initialHtml );
const lastBlockAccessibilityLabel =
'This block is used in initial HTML e2e tests and should be kept as the last block.';
let lastBlockElement;
if ( isAndroid() ) {
lastBlockElement = await editorPage.androidScrollAndReturnElement(
lastBlockAccessibilityLabel
);
} else {
lastBlockElement = await editorPage.getLastElementByXPath(
lastBlockAccessibilityLabel
);
if ( ! lastBlockElement ) {
const retryDelay = 5000;
// eslint-disable-next-line no-console
console.log(
`Warning: "lastBlockElement" was not found in the first attempt. Could be that all the blocks were not loaded yet.
Will retry one more time after ${ retryDelay / 1000 } seconds.`,
lastBlockElement
);
await editorPage.driver.sleep( retryDelay );
lastBlockElement = await editorPage.getLastElementByXPath(
lastBlockAccessibilityLabel
);
}
}
expect( lastBlockElement ).toBeTruthy();
} );
} );