From def50f52c1905caa8fe575ec225b28f763eb88b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDeljko=20Filipin?= Date: Wed, 5 May 2021 16:20:14 +0200 Subject: [PATCH] selenium: Fix 'Page should be creatable' test The test was failing on The Beta Cluster because of two reasons: - Local development environment and CI need to switch to mobile view, The Beta Cluster doesn't. - Local development environment and CI allow anonymous edits, The Beta Cluster doesn't. Bug: T281733 Change-Id: Iedcd94dc5cf1ace14baadfe9d9bd5bed9788f775 --- tests/selenium/pageobjects/edit.page.js | 2 -- tests/selenium/specs/page.js | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/selenium/pageobjects/edit.page.js b/tests/selenium/pageobjects/edit.page.js index 4e0cb78b7..5451db144 100644 --- a/tests/selenium/pageobjects/edit.page.js +++ b/tests/selenium/pageobjects/edit.page.js @@ -5,7 +5,6 @@ const Page = require( 'wdio-mediawiki/Page' ); class EditPage extends Page { get content() { return $( '#wikitext-editor' ); } get displayedContent() { return $( '#mw-content-text .mw-parser-output' ); } - get editWithoutLoggingIn() { return $( '.anonymous' ); } get heading() { return $( '#section_0' ); } get next() { return $( '.mw-ui-icon-mf-next-invert' ); } get save() { return $( 'button.mw-ui-button' ); } @@ -16,7 +15,6 @@ class EditPage extends Page { edit( name, content ) { this.openForEditing( name ); - this.editWithoutLoggingIn.click(); this.content.setValue( content ); this.next.click(); this.save.click(); diff --git a/tests/selenium/specs/page.js b/tests/selenium/specs/page.js index 0aa320bc7..64bca0f62 100644 --- a/tests/selenium/specs/page.js +++ b/tests/selenium/specs/page.js @@ -3,6 +3,7 @@ const assert = require( 'assert' ); const BlankPage = require( '../pageobjects/blank.page' ); const EditPage = require( '../pageobjects/edit.page' ); +const UserLoginPage = require( 'wdio-mediawiki/LoginPage' ); const Util = require( 'wdio-mediawiki/Util' ); describe( 'Page', function () { @@ -15,8 +16,12 @@ describe( 'Page', function () { it( 'should be creatable', function () { BlankPage.open(); - BlankPage.mobileView.click(); + // FIXME: This check should be redundant when T282058 is resolved. + if ( BlankPage.mobileView.isDisplayed() ) { + BlankPage.mobileView.click(); + } + UserLoginPage.loginAdmin(); EditPage.edit( name, content ); browser.waitUntil(