Skip to content

Commit cf875de

Browse files
committed
update global settings test
1 parent 4d63cbb commit cf875de

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

e2e/tests/global-settings.spec.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,23 @@ test.describe( 'Global Settings', () => {
159159
await updateRequest
160160

161161
// Insert a Stackable Text Block, and check if the color is the same as the one set in the default block
162-
// Wrap the expect in a function in case the default block is not yet updated
163-
await expect( async () => {
164-
await page.reload()
165-
await editor.insertBlock( {
166-
name: 'stackable/text',
167-
attributes: {
168-
text: 'test',
169-
},
170-
} )
171-
172-
await expect( editor.canvas.locator( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
173-
} ).toPass( { intervals: [ 1_000, 5_000, 30_000 ] } )
162+
const timeouts = [ 1_000, 5_000, 30_000 ]
163+
for ( const timeout of timeouts ) {
164+
try {
165+
await page.reload()
166+
await editor.insertBlock( {
167+
name: 'stackable/text',
168+
attributes: {
169+
text: 'test',
170+
},
171+
} )
172+
173+
await expect( editor.canvas.locator( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
174+
} catch ( e ) {
175+
// Ignore the error and try again because the default block might not be updated yet
176+
await page.waitForTimeout( timeout )
177+
}
178+
}
174179

175180
// Reset Default Block
176181
await page.getByLabel( 'Stackable Settings' ).click()

0 commit comments

Comments
 (0)