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
This commit is contained in:
Željko Filipin 2021-05-05 16:20:14 +02:00 committed by Jdlrobson
parent 092fc51d14
commit def50f52c1
2 changed files with 6 additions and 3 deletions

View file

@ -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();

View file

@ -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(