Skip to content

Commit

Permalink
Merge pull request #7488 from ampproject/fix/flaky-e2e-tests
Browse files Browse the repository at this point in the history
Fix flaky e2e tests
  • Loading branch information
westonruter authored Mar 16, 2023
2 parents 0f81395 + 0dedc64 commit 96cdfb9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentyfifteen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentynineteen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentyseventeen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentysixteen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentythirteen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/specs/core-themes/twentytwenty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/specs/core-themes/twentytwentytwo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 96cdfb9

Please sign in to comment.