From 791cb1081a2283e695faf420a3c25e50323cce4b Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Thu, 3 Feb 2022 21:18:02 +0100 Subject: [PATCH] selenium: Ensure .waitForDisplayed() before .click() Avoid time outs Error in "Opening and closing the reference drawer.Opening a nested reference" Error: waitUntil condition timed out after 5000ms at Browser. (/workspace/src/skins/MinervaNeue/node_modules/@wdio/utils/build/shim.js:270:24) at iShouldSeeDrawerWithText (/workspace/src/skins/MinervaNeue/tests/selenium/features/step_definitions/reference_steps.js:25:10) at Context. (/workspace/src/skins/MinervaNeue/tests/selenium/specs/references.js:44:3) FAILED in chrome - /tests/selenium/specs/references.js Change-Id: Ia5d493fba4995c1122721b76ae98d6ba60399238 --- tests/selenium/features/step_definitions/common_steps.js | 1 + .../selenium/features/step_definitions/create_page_api_steps.js | 1 + tests/selenium/features/step_definitions/menu_steps.js | 1 + tests/selenium/features/step_definitions/notification_steps.js | 1 + tests/selenium/features/step_definitions/reference_steps.js | 1 + tests/selenium/features/step_definitions/search_steps.js | 1 + 6 files changed, 6 insertions(+) diff --git a/tests/selenium/features/step_definitions/common_steps.js b/tests/selenium/features/step_definitions/common_steps.js index 231472755..c70607179 100644 --- a/tests/selenium/features/step_definitions/common_steps.js +++ b/tests/selenium/features/step_definitions/common_steps.js @@ -103,6 +103,7 @@ const iClickTheBrowserBackButton = () => { const iClickTheOverlayCloseButton = () => { waitForPropagation( 2000 ); + ArticlePageWithOverlay.overlay_close_element.waitForDisplayed(); ArticlePageWithOverlay.overlay_close_element.click(); }; diff --git a/tests/selenium/features/step_definitions/create_page_api_steps.js b/tests/selenium/features/step_definitions/create_page_api_steps.js index 9e0e833ce..4ef744216 100644 --- a/tests/selenium/features/step_definitions/create_page_api_steps.js +++ b/tests/selenium/features/step_definitions/create_page_api_steps.js @@ -84,6 +84,7 @@ const watch = ( title ) => { // So we run the non-js workflow. const page = new Page(); page.openTitle( title, { action: 'watch' } ); + $( '#mw-content-text button[type="submit"]' ).waitForDisplayed(); $( '#mw-content-text button[type="submit"]' ).click(); waitForPropagation( 10000 ); page.openTitle( title ); diff --git a/tests/selenium/features/step_definitions/menu_steps.js b/tests/selenium/features/step_definitions/menu_steps.js index bf1278246..358e0562a 100644 --- a/tests/selenium/features/step_definitions/menu_steps.js +++ b/tests/selenium/features/step_definitions/menu_steps.js @@ -8,6 +8,7 @@ const iSeeALinkToAboutPage = () => { }; const iClickOnTheMainNavigationButton = () => { + ArticlePage.menu_button_element.waitForDisplayed(); ArticlePage.menu_button_element.click(); }; diff --git a/tests/selenium/features/step_definitions/notification_steps.js b/tests/selenium/features/step_definitions/notification_steps.js index 8e4e52c3a..4d8088bd2 100644 --- a/tests/selenium/features/step_definitions/notification_steps.js +++ b/tests/selenium/features/step_definitions/notification_steps.js @@ -12,6 +12,7 @@ const iHaveNoNotifications = () => { const iClickOnTheNotificationIcon = () => { ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.scripts' ); + ArticlePage.notifications_button_element.waitForDisplayed(); ArticlePage.notifications_button_element.click(); }; diff --git a/tests/selenium/features/step_definitions/reference_steps.js b/tests/selenium/features/step_definitions/reference_steps.js index 65b81abd5..1e9a9fe52 100644 --- a/tests/selenium/features/step_definitions/reference_steps.js +++ b/tests/selenium/features/step_definitions/reference_steps.js @@ -12,6 +12,7 @@ const iShouldSeeNotTheReferenceDrawer = () => { }; const iClickOnAReference = () => { + ArticlePage.reference_element.waitForDisplayed(); ArticlePage.reference_element.click(); }; diff --git a/tests/selenium/features/step_definitions/search_steps.js b/tests/selenium/features/step_definitions/search_steps.js index de2cde7cc..977186aa9 100644 --- a/tests/selenium/features/step_definitions/search_steps.js +++ b/tests/selenium/features/step_definitions/search_steps.js @@ -5,6 +5,7 @@ const { ArticlePage } = require( '../support/world.js' ); const ArticlePageWithOverlay = require( '../support/pages/article_page_with_overlay' ); const iClickTheSearchIcon = () => { + ArticlePage.search_icon_element.waitForDisplayed(); ArticlePage.search_icon_element.click(); };