libreoffice-online/cypress_test/integration_tests/desktop/writer/scrolling_spec.js
Rash419 fdd2973aa4 cypress: fix: updated all scrolling_spec.js to use range for assertion
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I9de24d4e0477ed6263370c331c42e791ea347045
2022-01-05 08:32:42 +01:00

76 lines
1.8 KiB
JavaScript

/* global describe it cy beforeEach require afterEach */
var helper = require('../../common/helper');
var desktopHelper = require('../../common/desktop_helper');
describe('Scroll through document', function() {
var testFileName = 'scrolling.odt';
beforeEach(function() {
helper.beforeAll(testFileName, 'writer');
cy.get('#toolbar-up .w2ui-scroll-right')
.click();
cy.get('#tb_editbar_item_sidebar')
.click();
});
afterEach(function() {
helper.afterAll(testFileName, this.currentTest.state);
});
it('Scrolling to bottom/top', function() {
//scroll to bottom
cy.get('#StatePageNumber').should('have.text', 'Page 1 of 4');
desktopHelper.pressKey(3, 'pagedown');
cy.get('#StatePageNumber').should('have.text', 'Page 2 of 4');
desktopHelper.pressKey(3, 'pagedown');
cy.get('#StatePageNumber').should('have.text', 'Page 3 of 4');
desktopHelper.pressKey(3, 'pagedown');
desktopHelper.pressKey(2, 'pagedown');
cy.get('#StatePageNumber').should('have.text', 'Page 4 of 4');
//scroll to top
desktopHelper.pressKey(3, 'pageup');
cy.get('#StatePageNumber').should('have.text', 'Page 3 of 4');
desktopHelper.pressKey(3, 'pageup');
cy.get('#StatePageNumber').should('have.text', 'Page 2 of 4');
desktopHelper.pressKey(3, 'pageup');
cy.get('#StatePageNumber').should('have.text', 'Page 1 of 4');
});
it('Scrolling to left/right', function() {
cy.get('#toolbar-down').click();
desktopHelper.selectZoomLevel('200');
//show horizontal scrollbar
cy.get('.leaflet-layer')
.click('bottom');
cy.wait(500);
helper.typeIntoDocument('{home}{end}{home}');
cy.get('#test-div-horizontal-scrollbar')
.should('have.text', '6');
helper.typeIntoDocument('{end}{home}{end}');
desktopHelper.assertScrollbarPosition('horizontal', 577, 660);
});
});