mediawiki-extensions-Revisi.../tests/selenium/specs/autoexpand.js
WMDE-Fisch 5a8f3bce94 Port history Ruby selenium tests to NodeJS
The numbering in the content of the test revisions was slightly changed
to fit the data-pos attribute numbering in the revision tags.

Note that this is not completely cleaning up the step_definitions
from the Ruby tests. This will be done in a follow up after all
tests are ported.

Bug: T267201
Change-Id: Ifa25b881c6aa1e94a934532606c944a33f5648dd
2020-11-09 10:06:33 +01:00

84 lines
1.9 KiB
JavaScript

'use strict';
const assert = require( 'assert' ),
DiffPage = require( '../pageobjects/diff.page' );
describe( 'RevisionSlider expand', function () {
before( function () {
DiffPage.prepareSimpleTests( 2 );
} );
beforeEach( function () {
DiffPage.ready();
} );
afterEach( function () {
DiffPage.resetAutoExpand();
browser.refresh();
} );
it( ' does not automatically expand by default', function () {
assert(
DiffPage.rsToggleButton.isDisplayed(),
'there should be a RevisionSlider expand button'
);
assert(
!DiffPage.rsMain.isDisplayed(),
'the RevisionSlider wrapper should be hidden'
);
} );
it( ' expands automatically when auto expand is on', function () {
DiffPage.openSlider();
DiffPage.rsAutoExpandButton.click();
browser.refresh();
DiffPage.ready();
DiffPage.rsMain.waitForDisplayed( { timeout: 10000 } );
assert(
DiffPage.rsAutoExpandButton.getAttribute( 'class' )
.indexOf( 'oo-ui-toggleWidget-on' ) !== -1,
'the auto expand button should be on'
);
assert(
DiffPage.rsMain.isDisplayed(),
'the RevisionSlider wrapper should be visible'
);
} );
it( ' does not expand automatically when auto expand is off', function () {
DiffPage.openSlider();
DiffPage.rsAutoExpandButton.click();
DiffPage.rsAutoExpandButton.click();
browser.refresh();
DiffPage.ready();
// this includes clicking the toggle button
// an auto-expanded slider would be closed then
DiffPage.openSlider();
assert(
DiffPage.rsMain.isDisplayed(),
'the RevisionSlider wrapper should be visible'
);
assert(
DiffPage.rsAutoExpandButton.getAttribute( 'class' )
.indexOf( 'oo-ui-toggleWidget-on' ) === -1,
'the auto expand button should be off'
);
} );
it( ' hides when collapsed manually', function () {
DiffPage.openSlider();
DiffPage.rsToggleButton.click();
assert(
!DiffPage.rsMain.isDisplayed(),
'the RevisionSlider wrapper should be hidden'
);
} );
} );