Skip to content

Commit 8a15284

Browse files
committed
migrate container block e2e tests to playwright
1 parent 5722585 commit 8a15284

11 files changed

Lines changed: 183 additions & 150 deletions

cypress/e2e/container/container-block.cy.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

cypress/e2e/container/container-bootstrap-v4.cy.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

cypress/e2e/container/container-filters.cy.js

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container /-->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container {"isFluid":true} /-->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container {"isFluid":true,"fluidBreakpoint":"lg"} /-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container /-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container {"marginAfter":"mb-8"} /-->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- wp:wp-bootstrap-blocks/container {"isFluid":true,"fluidBreakpoint":"xxl"} /-->
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { editorSettingsSelectOption } from '../../commands/editor-settings-select-option';
2+
import { openSidebarPanelWithTitle } from '../../commands/open-sidebar-panel-with-title';
3+
4+
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
5+
6+
test.describe( 'Container Block', () => {
7+
test.beforeEach( async ( { admin, editor } ) => {
8+
await admin.createNewPost();
9+
await editor.insertBlock( {
10+
name: 'wp-bootstrap-blocks/container',
11+
} );
12+
} );
13+
14+
test( 'Container block gets initialized with default attributes', async ( {
15+
editor,
16+
page,
17+
} ) => {
18+
// Fluid option should not be checked
19+
expect(
20+
await page
21+
.getByRole( 'region', {
22+
name: 'Editor settings',
23+
} )
24+
.getByLabel( 'Fluid', { exact: true } )
25+
.isChecked()
26+
).toBeFalsy();
27+
28+
// Fluid Breakpoint select field should be disabled
29+
await expect(
30+
await page
31+
.getByRole( 'region', {
32+
name: 'Editor settings',
33+
} )
34+
.getByLabel( 'Fluid Breakpoint', { exact: true } )
35+
).toBeDisabled();
36+
37+
// Margin After should be set
38+
expect(
39+
await page
40+
.getByRole( 'region', {
41+
name: 'Editor settings',
42+
} )
43+
.getByLabel( 'Margin After' )
44+
.inputValue()
45+
).toBe( 'mb-2' );
46+
47+
expect( await editor.getEditedPostContent() ).toMatchSnapshot(
48+
'container-block-gets-initialized-with-default-attributes.txt'
49+
);
50+
} );
51+
52+
test( 'Enable fluid option', async ( { editor, page } ) => {
53+
await page
54+
.getByRole( 'region', {
55+
name: 'Editor settings',
56+
} )
57+
.getByLabel( 'Fluid', { exact: true } )
58+
.check();
59+
60+
expect( await editor.getEditedPostContent() ).toMatchSnapshot(
61+
'enable-fluid-option-1.txt'
62+
);
63+
64+
await page
65+
.getByRole( 'region', {
66+
name: 'Editor settings',
67+
} )
68+
.getByLabel( 'Fluid breakpoint' )
69+
.selectOption( 'lg' );
70+
71+
expect( await editor.getEditedPostContent() ).toMatchSnapshot(
72+
'enable-fluid-option-2.txt'
73+
);
74+
} );
75+
76+
// Bootstrap 5 specific options
77+
test( 'Xxl breakpoint is available', async ( { editor, page } ) => {
78+
await page
79+
.getByRole( 'region', {
80+
name: 'Editor settings',
81+
} )
82+
.getByLabel( 'Fluid', { exact: true } )
83+
.check();
84+
85+
await page
86+
.getByRole( 'region', {
87+
name: 'Editor settings',
88+
} )
89+
.getByLabel( 'Fluid breakpoint' )
90+
.selectOption( 'xxl' );
91+
92+
expect( await editor.getEditedPostContent() ).toMatchSnapshot(
93+
'xxl-breakpoint-is-available.txt'
94+
);
95+
} );
96+
} );

0 commit comments

Comments
 (0)