Skip to content

Commit 4bd8941

Browse files
committed
update tests
1 parent 112f772 commit 4bd8941

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

e2e/tests/block-editor.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ test.describe( 'Block Editor', () => {
6868

6969
// Verify block attributes
7070
const clientId = await editor.canvas.getByLabel( 'Block: Text' ).getAttribute( 'data-block' )
71-
const attributes = await editor.getBlockAttributes( clientId )
7271

73-
expect( attributes ).toHaveProperty( 'textColor1', '#ff0000' )
74-
expect( attributes ).toHaveProperty( 'text', 'test' )
72+
// Block attributes may not update immediately
73+
await expect( async () => {
74+
const attributes = await editor.getBlockAttributes( clientId )
75+
76+
expect( attributes ).toHaveProperty( 'textColor1', '#ff0000' )
77+
expect( attributes ).toHaveProperty( 'text', 'test' )
78+
} ).toPass( { intervals: [ 1_000, 2_000, 5_000 ] } )
7579
} )
7680

7781
test( 'The Stackable block added in the editor should be visible in the frontend', async ( {

e2e/tests/global-settings.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ test.describe( 'Global Settigs', () => {
117117
await defaultBlockPage.locator( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ).first().click()
118118
await defaultBlockPage.getByLabel( 'Hex color' ).fill( color )
119119
await defaultBlockPage.locator( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ).first().click()
120-
await defaultBlockPage.getByRole( 'button', { name: 'Save', exact: true } ).click()
120+
121+
// In older WP versions, the button text is 'Update' instead of 'Save'
122+
if ( await defaultBlockPage.getByRole( 'button', { name: 'Save', exact: true } ).isVisible() ) {
123+
await defaultBlockPage.getByRole( 'button', { name: 'Save', exact: true } ).click()
124+
} else {
125+
await defaultBlockPage.getByRole( 'button', { name: 'Update' } ).click()
126+
}
127+
121128
await defaultBlockPage.close()
122129

123130
// Insert a Stackable Text Block, and check if the color is the same as the one set in the default block

0 commit comments

Comments
 (0)