From 94c0926614af6f7bca045b53c561cb9f7b824f3e Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Sat, 18 May 2019 09:49:41 +0200 Subject: [PATCH] QA: Don't chain things that cannot be chained Causing builds to fail on https://integration.wikimedia.org/ci/view/Reading-Web/job/selenium-daily-beta-Minerva/58/console Bug: T223676 Change-Id: Ia285f8bd2f61e6e59aa38cd1909b450328eb053c --- .../features/step_definitions/common_steps.js | 14 ++++++++++---- .../step_definitions/create_page_api_steps.js | 18 +++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/selenium/features/step_definitions/common_steps.js b/tests/selenium/features/step_definitions/common_steps.js index 35d1686..9165027 100644 --- a/tests/selenium/features/step_definitions/common_steps.js +++ b/tests/selenium/features/step_definitions/common_steps.js @@ -20,11 +20,17 @@ const login = () => { const createPages = ( pages ) => { const summary = 'edit by selenium test'; browser.call( () => login() ); - browser.call( () => - api.batch( + browser.call( () => { + return api.batch( pages.map( ( page ) => [ 'create' ].concat( page ).concat( [ summary ] ) ) - ) - ); + ).catch( ( err ) => { + if ( err.code === 'articleexists' ) { + return; + } + throw err; + } ); + + } ); }; const createPage = ( title, wikitext ) => { 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 2202863..59a0164 100644 --- a/tests/selenium/features/step_definitions/create_page_api_steps.js +++ b/tests/selenium/features/step_definitions/create_page_api_steps.js @@ -23,13 +23,7 @@ const iAmInAWikiThatHasCategories = ( title ) => { [ 'create', 'Category:Selenium artifacts', msg ], [ 'create', 'Category:Test category', msg ], [ 'create', 'Category:Selenium hidden category', '__HIDDENCAT__' ] - ] ) - .catch( ( err ) => { - if ( err.code === 'articleexists' ) { - return; - } - throw err; - } ); + ] ); // A pause is necessary to let the categories register with database before trying to use // them in an article @@ -68,7 +62,10 @@ const iGoToAPageThatHasLanguages = () => { [[es:Selenium language test page]] `; - return createPage( 'Selenium language test page', wikitext ).then( () => { + browser.call( () => { + createPage( 'Selenium language test page', wikitext ); + } ); + browser.call( () => { iAmOnPage( 'Selenium language test page' ); } ); }; @@ -85,7 +82,10 @@ const watch = ( title ) => { const iAmViewingAWatchedPage = () => { const title = `I am on the "Selenium mobile watched page test ${new Date().getTime()}`; - createPage( title, 'watch test' ).then( () => { + browser.call( () => { + createPage( title, 'watch test' ); + } ); + browser.call( () => { watch( title ); // navigate away from page iAmOnPage( 'Main Page' );