diff --git a/tests/e2e/specs/core-themes/twentyfifteen.js b/tests/e2e/specs/core-themes/twentyfifteen.js index bf82707587c..cd0dd6790bd 100644 --- a/tests/e2e/specs/core-themes/twentyfifteen.js +++ b/tests/e2e/specs/core-themes/twentyfifteen.js @@ -81,6 +81,10 @@ describe('Twenty Fifteen theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toClick('.site-header .secondary-toggle'); + await page.waitForSelector( + '#site-navigation .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '#site-navigation .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentynineteen.js b/tests/e2e/specs/core-themes/twentynineteen.js index cef405bd0d0..2052b002b6d 100644 --- a/tests/e2e/specs/core-themes/twentynineteen.js +++ b/tests/e2e/specs/core-themes/twentynineteen.js @@ -54,6 +54,10 @@ describe('Twenty Nineteen theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toMatchElement('.main-navigation'); + await page.waitForSelector( + '.main-navigation .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '.main-navigation .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentyseventeen.js b/tests/e2e/specs/core-themes/twentyseventeen.js index 738e02494ab..b29743fd8c6 100644 --- a/tests/e2e/specs/core-themes/twentyseventeen.js +++ b/tests/e2e/specs/core-themes/twentyseventeen.js @@ -75,6 +75,10 @@ describe('Twenty Seventeen theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toClick('.main-navigation .menu-toggle'); + await page.waitForSelector( + '.main-navigation .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '.main-navigation .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentysixteen.js b/tests/e2e/specs/core-themes/twentysixteen.js index 426f2ac3838..27b81981615 100644 --- a/tests/e2e/specs/core-themes/twentysixteen.js +++ b/tests/e2e/specs/core-themes/twentysixteen.js @@ -81,6 +81,10 @@ describe('Twenty Sixteen theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toClick('#menu-toggle'); + await page.waitForSelector( + '#site-navigation .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '#site-navigation .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentythirteen.js b/tests/e2e/specs/core-themes/twentythirteen.js index 6f22fde5217..5a9d0565a5f 100644 --- a/tests/e2e/specs/core-themes/twentythirteen.js +++ b/tests/e2e/specs/core-themes/twentythirteen.js @@ -81,6 +81,10 @@ describe('Twenty Thirteen theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toClick('#site-navigation .menu-toggle'); + await page.waitForSelector( + '#site-navigation .nav-menu .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '#site-navigation .nav-menu .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentytwenty.js b/tests/e2e/specs/core-themes/twentytwenty.js index be45a139add..4e51bad7480 100644 --- a/tests/e2e/specs/core-themes/twentytwenty.js +++ b/tests/e2e/specs/core-themes/twentytwenty.js @@ -76,6 +76,10 @@ describe('Twenty Twenty theme on AMP', () => { it('should have a togglable submenu', async () => { await expect(page).toClick('.mobile-nav-toggle'); + await page.waitForSelector( + '.menu-modal .menu-item-has-children' + ); + const menuItemWithSubmenu = await page.$( '.menu-modal .menu-item-has-children' ); diff --git a/tests/e2e/specs/core-themes/twentytwentytwo.js b/tests/e2e/specs/core-themes/twentytwentytwo.js index 1dbe101e156..26f2c4e1270 100644 --- a/tests/e2e/specs/core-themes/twentytwentytwo.js +++ b/tests/e2e/specs/core-themes/twentytwentytwo.js @@ -62,6 +62,8 @@ describe('Twenty Twenty-Two theme on AMP', () => { }); it('should be togglable', async () => { + await page.waitForSelector(pageHeaderSelector); + const pageHeaderElement = await page.$(pageHeaderSelector); expect(pageHeaderElement).not.toBeNull();