2020-11-05 17:07:21 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require( 'assert' ),
|
|
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
describe( 'RevisionSlider history', () => {
|
2020-11-05 17:07:21 +00:00
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
before( async () => {
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.prepareSimpleTests( 4 );
|
2020-11-05 17:07:21 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
beforeEach( async () => {
|
2020-11-05 17:07:21 +00:00
|
|
|
DiffPage.ready();
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.openSlider();
|
2020-11-05 17:07:21 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
afterEach( async () => {
|
2023-03-29 20:23:48 +00:00
|
|
|
await browser.refresh();
|
2020-11-05 17:07:21 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
it( ' can be accessed using browser back and forward buttons after clicking', async () => {
|
2020-11-05 17:07:21 +00:00
|
|
|
// On a page with 4 revisions, the default positions are 3 → 4.
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.getRevisionDown( 1 ).click();
|
2020-11-05 17:07:21 +00:00
|
|
|
// Positions are 1 → 4 now.
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
await DiffPage.getRevisionUp( 2 ).click();
|
2020-11-05 17:07:21 +00:00
|
|
|
// Positions are 1 → 2 now.
|
2023-03-29 20:23:48 +00:00
|
|
|
await DiffPage.waitUntilLoaded();
|
2020-11-05 17:07:21 +00:00
|
|
|
|
2023-03-29 20:23:48 +00:00
|
|
|
await browser.back();
|
|
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
await browser.back();
|
|
|
|
await DiffPage.waitUntilLoaded();
|
|
|
|
await browser.forward();
|
|
|
|
await DiffPage.waitUntilLoaded();
|
2020-11-05 17:07:21 +00:00
|
|
|
|
|
|
|
// 2 steps back and 1 forward is the same as 1 back, i.e. positions should be 1 → 4 now.
|
2023-03-29 20:23:48 +00:00
|
|
|
assert( await DiffPage.isOlderPointerOn( 1 ) );
|
|
|
|
assert( await DiffPage.isNewerPointerOn( 4 ) );
|
|
|
|
assert( await DiffPage.showsOlderSummary( 1 ) );
|
|
|
|
assert( await DiffPage.showsNewerSummary( 4 ) );
|
2020-11-05 17:07:21 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-08 04:13:35 +00:00
|
|
|
it( ' can be accessed using browser back and forward buttons after dragging', async () => {
|
2023-03-29 20:23:48 +00:00
|
|
|
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 ) );
|
2020-11-05 17:07:21 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|