mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-25 05:03:22 +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
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require( 'assert' ),
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
describe( 'RevisionSlider history', function () {
|
|
|
|
before( async function () {
|
|
await DiffPage.prepareSimpleTests( 4 );
|
|
} );
|
|
|
|
beforeEach( async function () {
|
|
DiffPage.ready();
|
|
await DiffPage.openSlider();
|
|
} );
|
|
|
|
afterEach( async function () {
|
|
await browser.refresh();
|
|
} );
|
|
|
|
it( ' can be accessed using browser back and forward buttons after clicking', async function () {
|
|
// On a page with 4 revisions, the default positions are 3 → 4.
|
|
await DiffPage.getRevisionDown( 1 ).click();
|
|
// Positions are 1 → 4 now.
|
|
await DiffPage.waitUntilLoaded();
|
|
await DiffPage.getRevisionUp( 2 ).click();
|
|
// Positions are 1 → 2 now.
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
await browser.back();
|
|
await DiffPage.waitUntilLoaded();
|
|
await browser.back();
|
|
await DiffPage.waitUntilLoaded();
|
|
await browser.forward();
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
// 2 steps back and 1 forward is the same as 1 back, i.e. positions should be 1 → 4 now.
|
|
assert( await DiffPage.isOlderPointerOn( 1 ) );
|
|
assert( await DiffPage.isNewerPointerOn( 4 ) );
|
|
assert( await DiffPage.showsOlderSummary( 1 ) );
|
|
assert( await DiffPage.showsNewerSummary( 4 ) );
|
|
} );
|
|
|
|
it( ' can be accessed using browser back and forward buttons after dragging', async function () {
|
|
await DiffPage.dragOlderPointerTo( 1 );
|
|
await DiffPage.waitUntilLoaded();
|
|
await DiffPage.dragNewerPointerTo( 2 );
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
await browser.back();
|
|
await DiffPage.waitUntilLoaded();
|
|
await browser.back();
|
|
await DiffPage.waitUntilLoaded();
|
|
await browser.forward();
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
assert( await DiffPage.isOlderPointerOn( 1 ) );
|
|
assert( await DiffPage.isNewerPointerOn( 4 ) );
|
|
assert( await DiffPage.showsOlderSummary( 1 ) );
|
|
assert( await DiffPage.showsNewerSummary( 4 ) );
|
|
} );
|
|
|
|
} );
|