Skip to content

Commit 0a09b08

Browse files
committed
update block editor test
1 parent 3585bdd commit 0a09b08

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

e2e/tests/block-editor.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ test.describe( 'Block Editor', () => {
2525

2626
await page.locator( '.editor-block-list-item-stackable-text' ).click()
2727

28-
const blocks = await editor.getBlocks()
29-
30-
expect( blocks[ 0 ].name ).toContain( 'stackable/text' )
28+
await expect( editor.canvas.getByLabel( 'Block: Text' ) ).toBeVisible()
3129
} )
3230

3331
test( 'Stackable Inspector Controls should show up upon clicking a Stackable block', async ( {
@@ -63,11 +61,13 @@ test.describe( 'Block Editor', () => {
6361

6462
await editor.saveDraft()
6563

66-
const blocks = await editor.getBlocks()
67-
const attributes = blocks[ 0 ].attributes
64+
await expect( async () => {
65+
const blocks = await editor.getBlocks()
66+
const attributes = blocks.find( block => block.name === 'stackable/text' ).attributes
6867

69-
expect( attributes.textColor1 ).toBe( '#ff0000' )
70-
expect( attributes.text ).toBe( 'test' )
68+
expect( attributes.textColor1 ).toBe( '#ff0000' )
69+
expect( attributes.text ).toBe( 'test' )
70+
} ).toPass( { intervals: [ 1_000, 2_000, 5_000 ] } )
7171
} )
7272

7373
test( 'The Stackable block added in the editor should be visible in the frontend', async ( {
@@ -82,7 +82,7 @@ test.describe( 'Block Editor', () => {
8282
} )
8383

8484
const blocks = await editor.getBlocks()
85-
const uniqueId = blocks[ 0 ].attributes.uniqueId
85+
const uniqueId = blocks.find( block => block.name === 'stackable/text' ).attributes.uniqueId
8686

8787
await editor.saveDraft()
8888

0 commit comments

Comments
 (0)