Skip to content

Commit 06b5c9f

Browse files
committed
add break, await response to finish
1 parent cf875de commit 06b5c9f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

e2e/tests/global-settings.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ test.describe( 'Global Settings', () => {
144144
await defaultBlockPage.locator( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ).first().click()
145145

146146
// The default timeout is 30s, extend it to 90s
147-
const updateRequest = defaultBlockPage.waitForRequest( request => request.url().includes( 'update_block_style' ) && request.method() === 'POST', { timeout: 90_000 } )
147+
const updateRequest = defaultBlockPage.waitForResponse( response => response.url().includes( 'update_block_style' ) && response.request().method() === 'POST', { timeout: 90_000 } )
148148

149149
// In older WP versions, the button text is 'Update' instead of 'Save'
150150
if ( await defaultBlockPage.getByRole( 'button', {
@@ -156,7 +156,7 @@ test.describe( 'Global Settings', () => {
156156
}
157157

158158
// Make sure default block has been updated
159-
await updateRequest
159+
await ( await updateRequest ).finished()
160160

161161
// Insert a Stackable Text Block, and check if the color is the same as the one set in the default block
162162
const timeouts = [ 1_000, 5_000, 30_000 ]
@@ -171,6 +171,7 @@ test.describe( 'Global Settings', () => {
171171
} )
172172

173173
await expect( editor.canvas.locator( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ).toHaveCSS( 'color', 'rgb(255, 0, 0)' )
174+
break
174175
} catch ( e ) {
175176
// Ignore the error and try again because the default block might not be updated yet
176177
await page.waitForTimeout( timeout )

0 commit comments

Comments
 (0)