-
Notifications
You must be signed in to change notification settings - Fork 58
/
gutenberg-editor-horizontal-layouts-@ipad.test.js
89 lines (69 loc) · 2.52 KB
/
gutenberg-editor-horizontal-layouts-@ipad.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Internal dependencies
*/
const { toggleOrientation, swipeUp } = e2eUtils;
import { takeScreenshot } from './utils';
import {
NESTED_COLUMNS_CASE_1,
NESTED_COLUMNS_CASE_2,
} from './test-editor-data';
describe( 'Gutenberg Editor iPad Visual test for Horizontal layouts', () => {
it( 'should show the right columns placeholders and alignments case 1', async () => {
await editorPage.initializeEditor( {
initialData: NESTED_COLUMNS_CASE_1,
} );
// Wait for images to load
await editorPage.driver.pause( 4000 );
// Select title to unfocus the block
const titleElement = await editorPage.getTitleElement();
await titleElement.click();
await editorPage.dismissKeyboard();
// Visual test check
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();
// Switch to landscape
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.pause( 3000 );
// Scroll to an arbitary position partially through the content
await swipeUp( editorPage.driver );
// Wait for the scrollbar to hide
await editorPage.driver.pause( 3000 );
// Visual test check
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();
// Switch to portrait
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.pause( 3000 );
} );
it( 'should show the right columns placeholders and alignments case 2', async () => {
await editorPage.initializeEditor( {
initialData: NESTED_COLUMNS_CASE_2,
} );
// Wait for images to load
await editorPage.driver.pause( 4000 );
// Select title to unfocus the block
const titleElement = await editorPage.getTitleElement();
await titleElement.click();
await editorPage.dismissKeyboard();
// Visual test check
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();
// Switch to landscape
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.pause( 3000 );
// Scroll to an arbitary position partially through the content
await swipeUp( editorPage.driver );
// Wait for the scrollbar to hide
await editorPage.driver.pause( 3000 );
// Visual test check
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();
// Switch to portrait
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.pause( 3000 );
} );
} );