mediawiki-extensions-Popups/tests/selenium/specs/reference_previews.js
WMDE-Fisch 0cd94df686 Fix and re-enable ReferencePreview browser tests
The tests were skipped for some time already because the beta
feature mode is taken into account on the test systems. The tests
need to login and enable the beta feature mode to be executed. This
is fixed with that patch.

The patch also fixes broken tests due to changes that made one test
obsolete and another that needed adjustments.

There are also comments added to places where code can be removed or
altered if the feature gets out of beta status.

Bug: T268134
Change-Id: Ib96d23f3cb6c6130fd5880a78fafd252bf706475
2020-11-18 14:33:45 +01:00

57 lines
1.8 KiB
JavaScript

'use strict';
const assert = require( 'assert' ),
page = require( '../pageobjects/popups.page' ),
UserLoginPage = require( 'wdio-mediawiki/LoginPage' );
describe( 'Dwelling on a valid reference link', function () {
before( function () {
page.setup();
// TODO Remove or adjust when not in Beta any more
UserLoginPage.loginAdmin();
page.shouldUseReferencePopupsBetaFeature( true );
} );
beforeEach( function () {
page.open();
page.ready();
} );
it( 'I should see a reference preview', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.dwellReferenceLink( 1 );
assert( page.seeReferencePreview(), 'Reference preview is shown.' );
assert( !page.seeScrollableReferencePreview(), 'Reference preview is not scrollable.' );
assert( !page.seeFadeoutOnReferenceText(), 'Reference preview has no fading effect' );
} );
it( 'Abandoning link hides reference preview', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.dwellReferenceLink( 1 );
page.abandonLink();
assert( page.doNotSeeReferencePreview(), 'Reference preview is kept hidden.' );
} );
it( 'References with lots of text are scrollable and fades', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.dwellReferenceLink( 2 );
assert( page.seeScrollableReferencePreview(), 'Reference preview is scrollable' );
assert( page.seeFadeoutOnReferenceText(), 'Reference preview has a fading effect' );
} );
it( 'Dwelling references links inside reference previews does not close the popup ', function () {
if ( !page.hasReferencePopupsEnabled() ) {
this.skip();
}
page.dwellReferenceLink( 3 );
page.dwellReferenceInceptionLink();
assert( page.seeReferenceInceptionPreview(), 'The reference preview is still showing.' );
} );
} );