Skip to content

Commit 09d4d5c

Browse files
committed
migrate settings e2e tests to playwright
1 parent ed5a5ff commit 09d4d5c

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

playwright/e2e/button/button-filters.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ test.describe( 'Button Block', () => {
132132
name: 'Editor settings',
133133
} )
134134
.getByLabel( 'Open in new tab' )
135+
.isChecked()
135136
).toBeTruthy();
136137

137138
// Rel should be set
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
2+
3+
test.describe( 'Settings page', () => {
4+
test.beforeEach( async ( { admin } ) => {
5+
await admin.visitAdminPage(
6+
'options-general.php?page=wp-bootstrap-blocks_settings'
7+
);
8+
} );
9+
10+
test( 'Default values are selected', async ( { page } ) => {
11+
expect(
12+
await page
13+
.locator( '#wp-bootstrap-blocks_bootstrap_version' )
14+
.inputValue()
15+
).toBe( '5' );
16+
17+
const enableCssGridCheckbox = await page.getByLabel(
18+
'Enable CSS grid (Experimental)'
19+
);
20+
21+
expect( await enableCssGridCheckbox.isChecked() ).toBeFalsy();
22+
await expect( enableCssGridCheckbox ).not.toBeDisabled();
23+
} );
24+
25+
test( 'Respects constants', async ( { page, requestUtils } ) => {
26+
await requestUtils.activatePlugin(
27+
'wp-bootstrap-blocks-test-css-grid'
28+
);
29+
30+
await expect(
31+
await page.locator( '#wp-bootstrap-blocks_bootstrap_version' )
32+
).toBeDisabled();
33+
34+
expect(
35+
await page
36+
.locator( '#wp-bootstrap-blocks_bootstrap_version' )
37+
.inputValue()
38+
).toBe( '5' );
39+
40+
const enableCssGridCheckbox = await page.locator(
41+
'#wp-bootstrap-blocks_enable_css_grid'
42+
);
43+
44+
expect( await enableCssGridCheckbox.isChecked() ).toBeTruthy();
45+
await expect( enableCssGridCheckbox ).toBeDisabled();
46+
47+
await requestUtils.deactivatePlugin(
48+
'wp-bootstrap-blocks-test-css-grid'
49+
);
50+
} );
51+
} );

0 commit comments

Comments
 (0)