Move browser tests loading steps to beforeEach

- test page loading and waiting for the scripts moved to beforeEach
- removed unnecessary abondonLink call
- removed unnecessary browser.pause()

Change-Id: I28eb7b9b48f105315bf41f7a41e5a1e6ec21cb2b
This commit is contained in:
WMDE-Fisch 2019-04-02 12:41:22 +02:00
parent c8a893fc42
commit b3a58a6dd3
3 changed files with 11 additions and 12 deletions

View file

@ -50,10 +50,10 @@ class PopupsPage extends Page {
ready() {
this.resourceLoaderModuleStatus( POPUPS_MODULE_NAME, 'ready', 'Popups did not load' );
browser.pause( 1000 );
}
hasReferencePopupsEnabled() {
this.open();
return browser.execute( function () {
return mediaWiki.config.get( 'wgPopupsReferencePreviews' );
} ).value;
@ -64,11 +64,6 @@ class PopupsPage extends Page {
}
dwellLink( selector ) {
const PAUSE = 1000;
this.ready();
browser.pause( PAUSE );
this.abandonLink();
browser.pause( PAUSE );
browser.moveToObject( selector );
browser.waitForExist( POPUPS_SELECTOR );
}

View file

@ -6,14 +6,17 @@ describe( 'Dwelling on a valid page link', function () {
page.setup();
} );
it( 'I should see a page preview', function () {
beforeEach( function () {
page.open();
page.ready();
} );
it( 'I should see a page preview', function () {
page.dwellPageLink();
assert( page.seePagePreview(), 'Page preview is shown.' );
} );
it( 'Abandoning link hides page preview', function () {
page.open();
page.dwellPageLink();
page.abandonLink();
assert( page.doNotSeePagePreview(), 'Page preview is kept hidden.' );

View file

@ -6,11 +6,15 @@ describe( 'Dwelling on a valid reference link', function () {
page.setup();
} );
beforeEach( function () {
page.open();
page.ready();
} );
it( 'I should see a reference preview', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.open();
page.dwellReferenceLink( 1 );
assert( page.seeReferencePreview(), 'Reference preview is shown.' );
assert( !page.seeScrollableReferencePreview(), 'Reference preview is not scrollable.' );
@ -21,7 +25,6 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.open();
page.dwellReferenceLink( 1 );
page.abandonLink();
assert( page.doNotSeeReferencePreview(), 'Reference preview is kept hidden.' );
@ -31,7 +34,6 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.open();
page.dwellReferenceLink( 2 );
assert( page.seeScrollableReferencePreview(), 'Reference preview has a fading effect' );
assert( page.seeFadeoutOnReferenceText(), 'Reference preview has a fading effect' );
@ -41,7 +43,6 @@ describe( 'Dwelling on a valid reference link', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.open();
page.dwellReferenceLink( 3 );
page.dwellReferenceInceptionLink();
assert( page.seeReferenceInceptionPreview(), 'The reference preview is still showing.' );