From d455b880803c51d21227cd7f8859f0ea723d8a31 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 7 May 2019 09:14:52 -0700 Subject: [PATCH] Skip the flaking watchstar test Additional changes to tests: * pageExists uses brower.call to avoid token error in talk * use a before rather than beforeEach for creating articles to avoid an unnecessary API action Bug: T222517 Change-Id: I44cda7d62e5e4e58ed38b15ae13fdb0c8dc2e900 --- .../features/step_definitions/common_steps.js | 16 +++++++++------- tests/selenium/specs/search_loggedin.js | 2 +- tests/selenium/specs/talk.js | 7 +++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/selenium/features/step_definitions/common_steps.js b/tests/selenium/features/step_definitions/common_steps.js index d967b2e5a..35d16861a 100644 --- a/tests/selenium/features/step_definitions/common_steps.js +++ b/tests/selenium/features/step_definitions/common_steps.js @@ -19,7 +19,8 @@ const login = () => { const createPages = ( pages ) => { const summary = 'edit by selenium test'; - return login().then( () => + browser.call( () => login() ); + browser.call( () => api.batch( pages.map( ( page ) => [ 'create' ].concat( page ).concat( [ summary ] ) ) ) @@ -27,7 +28,8 @@ const createPages = ( pages ) => { }; const createPage = ( title, wikitext ) => { - return login().then( () => Api.edit( title, wikitext ) ); + browser.call( () => login() ); + browser.call( () => Api.edit( title, wikitext ) ); }; const iAmUsingTheMobileSite = () => { @@ -56,11 +58,11 @@ const iAmLoggedIntoTheMobileWebsite = () => { }; const pageExists = ( title ) => { - return createPage( title, 'Page created by Selenium browser test.' ).then( () => { - const d = new Date(); - // wait 2 seconds so the change can propogate. - browser.waitUntil( () => new Date() - d > 2000 ); - } ); + browser.call( () => + createPage( title, 'Page created by Selenium browser test.' ) + ); + // wait 2 seconds so the change can propogate. + waitForPropagation( 2000 ); }; const iAmOnAPageThatDoesNotExist = () => { diff --git a/tests/selenium/specs/search_loggedin.js b/tests/selenium/specs/search_loggedin.js index 1e998d725..2d437cfa2 100644 --- a/tests/selenium/specs/search_loggedin.js +++ b/tests/selenium/specs/search_loggedin.js @@ -13,7 +13,7 @@ const { } = require( '../features/step_definitions/search_steps' ); // @test2.m.wikipedia.org @vagrant @login -describe( 'Search', () => { +describe.skip( 'Search', () => { it( 'Clicking on a watchstar toggles the watchstar', () => { iAmUsingTheMobileSite(); diff --git a/tests/selenium/specs/talk.js b/tests/selenium/specs/talk.js index ef0b5b776..98e88d92b 100644 --- a/tests/selenium/specs/talk.js +++ b/tests/selenium/specs/talk.js @@ -19,12 +19,15 @@ const { iAmOnAPageWithNoTalkTopics } = require( '../features/step_definitions/cr // @chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org @vagrant describe( 'Talk', () => { - beforeEach( () => { - iAmUsingTheMobileSite(); + before( () => { pageExists( 'Talk:Selenium talk test' ); pageExists( 'Selenium talk test' ); } ); + beforeEach( () => { + iAmUsingTheMobileSite(); + } ); + it( 'Add discussion on talk page not possible as logged out user', () => { iAmOnPage( 'Selenium talk test' ); thereShouldBeNoTalkButton();