2020-11-04 15:40:17 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require( 'assert' ),
|
|
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
|
|
|
|
describe( 'RevisionSlider expand', function () {
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
before( async function () {
|
|
|
|
await DiffPage.prepareSimpleTests( 2 );
|
2020-11-04 15:40:17 +00:00
|
|
|
} );
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
beforeEach( async function () {
|
2020-11-04 15:40:17 +00:00
|
|
|
DiffPage.ready();
|
|
|
|
} );
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
afterEach( async function () {
|
|
|
|
await DiffPage.resetAutoExpand();
|
|
|
|
await browser.refresh();
|
2020-11-04 15:40:17 +00:00
|
|
|
} );
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
it( ' does not automatically expand by default', async function () {
|
2020-11-04 15:40:17 +00:00
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.rsToggleButton.isDisplayed(),
|
2020-11-04 15:40:17 +00:00
|
|
|
'there should be a RevisionSlider expand button'
|
|
|
|
);
|
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
!await DiffPage.rsMain.isDisplayed(),
|
2020-11-04 15:40:17 +00:00
|
|
|
'the RevisionSlider wrapper should be hidden'
|
|
|
|
);
|
|
|
|
} );
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
it( ' expands automatically when auto expand is on', async function () {
|
|
|
|
await DiffPage.openSlider();
|
|
|
|
await DiffPage.rsAutoExpandButton.click();
|
2020-11-04 15:40:17 +00:00
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
await browser.refresh();
|
2020-11-04 15:40:17 +00:00
|
|
|
DiffPage.ready();
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.rsMain.waitForDisplayed( { timeout: 10000 } );
|
2020-11-04 15:40:17 +00:00
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
2020-11-04 15:40:17 +00:00
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
classAttr.includes( 'oo-ui-toggleWidget-on' ),
|
2020-11-04 15:40:17 +00:00
|
|
|
'the auto expand button should be on'
|
|
|
|
);
|
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.rsMain.isDisplayed(),
|
2020-11-04 15:40:17 +00:00
|
|
|
'the RevisionSlider wrapper should be visible'
|
|
|
|
);
|
|
|
|
} );
|
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
it( ' does not expand automatically when auto expand is off', async function () {
|
|
|
|
await DiffPage.openSlider();
|
|
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
|
|
await DiffPage.rsAutoExpandButton.click();
|
2020-11-04 15:40:17 +00:00
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
await browser.refresh();
|
2020-11-04 15:40:17 +00:00
|
|
|
DiffPage.ready();
|
|
|
|
|
|
|
|
// this includes clicking the toggle button
|
|
|
|
// an auto-expanded slider would be closed then
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.openSlider();
|
|
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
2020-11-04 15:40:17 +00:00
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.rsMain.isDisplayed(),
|
2020-11-04 15:40:17 +00:00
|
|
|
'the RevisionSlider wrapper should be visible'
|
|
|
|
);
|
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
!( await classAttr.includes( 'oo-ui-toggleWidget-on' ) ),
|
2020-11-04 15:40:17 +00:00
|
|
|
'the auto expand button should be off'
|
|
|
|
);
|
|
|
|
} );
|
2020-11-04 16:23:46 +00:00
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
it( ' hides when collapsed manually', async function () {
|
|
|
|
await DiffPage.openSlider();
|
|
|
|
await DiffPage.rsToggleButton.click();
|
2020-11-04 16:23:46 +00:00
|
|
|
|
|
|
|
assert(
|
2023-03-29 20:23:48 +00:00
|
|
|
!await DiffPage.rsMain.isDisplayed(),
|
2020-11-04 16:23:46 +00:00
|
|
|
'the RevisionSlider wrapper should be hidden'
|
|
|
|
);
|
|
|
|
} );
|
2020-11-04 15:40:17 +00:00
|
|
|
} );
|