2020-06-22 21:49:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-01-21 17:11:13 +00:00
|
|
|
const assert = require( 'assert' ),
|
2020-11-18 13:09:36 +00:00
|
|
|
page = require( '../pageobjects/popups.page' ),
|
|
|
|
UserLoginPage = require( 'wdio-mediawiki/LoginPage' );
|
2019-01-21 17:11:13 +00:00
|
|
|
|
2019-01-29 16:23:51 +00:00
|
|
|
describe( 'Dwelling on a valid reference link', function () {
|
|
|
|
before( function () {
|
2019-01-21 17:11:13 +00:00
|
|
|
page.setup();
|
2020-11-18 13:09:36 +00:00
|
|
|
// TODO Remove or adjust when not in Beta any more
|
|
|
|
UserLoginPage.loginAdmin();
|
|
|
|
page.shouldUseReferencePopupsBetaFeature( true );
|
2019-01-21 17:11:13 +00:00
|
|
|
} );
|
|
|
|
|
2019-04-02 10:41:22 +00:00
|
|
|
beforeEach( function () {
|
|
|
|
page.open();
|
|
|
|
page.ready();
|
|
|
|
} );
|
|
|
|
|
2019-01-21 17:11:13 +00:00
|
|
|
it( 'I should see a reference preview', function () {
|
|
|
|
if ( !page.hasReferencePopupsEnabled() ) {
|
|
|
|
this.skip();
|
|
|
|
}
|
2019-03-21 10:59:22 +00:00
|
|
|
page.dwellReferenceLink( 1 );
|
2019-01-21 17:11:13 +00:00
|
|
|
assert( page.seeReferencePreview(), 'Reference preview is shown.' );
|
2019-03-21 10:59:22 +00:00
|
|
|
assert( !page.seeScrollableReferencePreview(), 'Reference preview is not scrollable.' );
|
|
|
|
assert( !page.seeFadeoutOnReferenceText(), 'Reference preview has no fading effect' );
|
2019-01-21 17:11:13 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
it( 'Abandoning link hides reference preview', function () {
|
|
|
|
if ( !page.hasReferencePopupsEnabled() ) {
|
|
|
|
this.skip();
|
|
|
|
}
|
2019-03-21 10:59:22 +00:00
|
|
|
page.dwellReferenceLink( 1 );
|
2019-01-21 17:11:13 +00:00
|
|
|
page.abandonLink();
|
|
|
|
assert( page.doNotSeeReferencePreview(), 'Reference preview is kept hidden.' );
|
|
|
|
} );
|
2019-03-21 10:59:22 +00:00
|
|
|
|
|
|
|
it( 'References with lots of text are scrollable and fades', function () {
|
|
|
|
if ( !page.hasReferencePopupsEnabled() ) {
|
|
|
|
this.skip();
|
|
|
|
}
|
|
|
|
page.dwellReferenceLink( 2 );
|
2020-11-18 13:09:36 +00:00
|
|
|
assert( page.seeScrollableReferencePreview(), 'Reference preview is scrollable' );
|
2019-03-21 10:59:22 +00:00
|
|
|
assert( page.seeFadeoutOnReferenceText(), 'Reference preview has a fading effect' );
|
|
|
|
} );
|
2019-03-22 17:36:34 +00:00
|
|
|
|
|
|
|
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.' );
|
|
|
|
} );
|
2019-01-21 17:11:13 +00:00
|
|
|
} );
|