mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-22 19:52:43 +00:00
8a53d056be
WebdriverIO has dropped support of sync mode, hence changed to async. Update npm packages: @wdio/*, wdio-mediawiki because async mode needs at least @wdio v7.9. Remove npm packages: @wdio/dot-reporter and @wdio/sync. Bug: T300798 Change-Id: I053ea6b5fbfdcff279f4eb10cf2429155690bd72
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require( 'assert' ),
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
describe( 'RevisionSlider expand', function () {
|
|
|
|
before( async function () {
|
|
await DiffPage.prepareSimpleTests( 2 );
|
|
} );
|
|
|
|
beforeEach( async function () {
|
|
DiffPage.ready();
|
|
} );
|
|
|
|
afterEach( async function () {
|
|
await DiffPage.resetAutoExpand();
|
|
await browser.refresh();
|
|
} );
|
|
|
|
it( ' does not automatically expand by default', async function () {
|
|
assert(
|
|
await DiffPage.rsToggleButton.isDisplayed(),
|
|
'there should be a RevisionSlider expand button'
|
|
);
|
|
assert(
|
|
!await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
|
|
it( ' expands automatically when auto expand is on', async function () {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
|
|
await browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
await DiffPage.rsMain.waitForDisplayed( { timeout: 10000 } );
|
|
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
|
assert(
|
|
classAttr.includes( 'oo-ui-toggleWidget-on' ),
|
|
'the auto expand button should be on'
|
|
);
|
|
assert(
|
|
await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
} );
|
|
|
|
it( ' does not expand automatically when auto expand is off', async function () {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
|
|
await browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
// this includes clicking the toggle button
|
|
// an auto-expanded slider would be closed then
|
|
await DiffPage.openSlider();
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
|
assert(
|
|
await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
assert(
|
|
!( await classAttr.includes( 'oo-ui-toggleWidget-on' ) ),
|
|
'the auto expand button should be off'
|
|
);
|
|
} );
|
|
|
|
it( ' hides when collapsed manually', async function () {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsToggleButton.click();
|
|
|
|
assert(
|
|
!await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
} );
|