mediawiki-extensions-Revisi.../tests/selenium/specs/history.js
libraryupgrader f5de8ee108 build: Updating npm dependencies
* eslint-config-wikimedia: 0.27.0 → 0.28.0
  The following rules are failing and were disabled:
  * modules:
    * no-mixed-spaces-and-tabs
    * no-jquery/no-extend
    * implicit-arrow-linebreak
  * tests/qunit:
    * no-jquery/no-extend

* grunt-stylelint: 0.19.0 → 0.20.0
* stylelint-config-wikimedia: 0.16.1 → 0.17.1

Change-Id: I3fd3c4a2cbb03d3aa4c8efb658e33d14d24cd518
2024-06-08 12:04:26 +00:00

64 lines
1.8 KiB
JavaScript

'use strict';
const assert = require( 'assert' ),
DiffPage = require( '../pageobjects/diff.page' );
describe( 'RevisionSlider history', () => {
before( async () => {
await DiffPage.prepareSimpleTests( 4 );
} );
beforeEach( async () => {
DiffPage.ready();
await DiffPage.openSlider();
} );
afterEach( async () => {
await browser.refresh();
} );
it( ' can be accessed using browser back and forward buttons after clicking', async () => {
// 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 () => {
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 ) );
} );
} );