Skip to content

Commit 49fe41f

Browse files
authored
e2e: Fix broken tests in trunk against WP versions under 6.9 (#267)
1 parent d7a87b1 commit 49fe41f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/e2e/field-type-repeater.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ test.describe( 'Field Type > Repeater', () => {
113113
// @see https://github.com/WordPress/gutenberg/issues/72185
114114
await page.waitForSelector( '.acf-postbox', { state: 'attached' } );
115115
const metaBoxPanel = page.getByRole( 'button', { name: 'Meta Boxes' } );
116-
if ( ( await metaBoxPanel.getAttribute( 'aria-expanded' ) ) === 'false' ) {
116+
if (
117+
( await metaBoxPanel.count() ) > 0 &&
118+
( await metaBoxPanel.getAttribute( 'aria-expanded' ) ) === 'false'
119+
) {
117120
await metaBoxPanel.focus();
118121
await metaBoxPanel.press( 'Enter' );
119122
}

tests/e2e/field-type-text.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ test.describe( 'Field Type > Text', () => {
8484
// @see https://github.com/WordPress/gutenberg/issues/72185
8585
await page.waitForSelector( '.acf-postbox', { state: 'attached' } );
8686
const metaBoxPanel = page.getByRole( 'button', { name: 'Meta Boxes' } );
87-
if ( ( await metaBoxPanel.getAttribute( 'aria-expanded' ) ) === 'false' ) {
87+
if (
88+
( await metaBoxPanel.count() ) > 0 &&
89+
( await metaBoxPanel.getAttribute( 'aria-expanded' ) ) === 'false'
90+
) {
8891
await metaBoxPanel.focus();
8992
await metaBoxPanel.press( 'Enter' );
9093
}

0 commit comments

Comments
 (0)