diff options
author | Rash419 <rashesh.padia@collabora.com> | 2021-11-25 13:30:08 +0530 |
---|---|---|
committer | pedropintosilva <65948705+pedropintosilva@users.noreply.github.com> | 2022-01-05 08:32:42 +0100 |
commit | fdd2973aa46a6699c1cf7bf06e3b142949399f22 (patch) | |
tree | cb46d70ff5d3b11154e997ec55225d791fb73c12 /cypress_test/integration_tests | |
parent | Classic: shortened size of menus (diff) | |
download | online-fdd2973aa46a6699c1cf7bf06e3b142949399f22.tar.gz online-fdd2973aa46a6699c1cf7bf06e3b142949399f22.zip |
cypress: fix: updated all scrolling_spec.js to use range for assertion
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I9de24d4e0477ed6263370c331c42e791ea347045
Diffstat (limited to 'cypress_test/integration_tests')
4 files changed, 16 insertions, 19 deletions
diff --git a/cypress_test/integration_tests/common/desktop_helper.js b/cypress_test/integration_tests/common/desktop_helper.js index 3d846c8122..4b96877565 100644 --- a/cypress_test/integration_tests/common/desktop_helper.js +++ b/cypress_test/integration_tests/common/desktop_helper.js @@ -333,13 +333,13 @@ function actionOnSelector(name,func) { //type represent horizontal/vertical scrollbar //arr : In both cypress GUI and CLI the scrollposition are slightly different //so we are passing both in array and assert using oneOf -function assertScrollbarPosition(type, arr) { +function assertScrollbarPosition(type, lowerBound, upperBound) { cy.wait(500); cy.get('#test-div-' + type + '-scrollbar') .then(function($item) { const x = parseInt($item.text()); - expect(x).to.be.oneOf(arr); + expect(x).to.be.within(lowerBound, upperBound); }); } diff --git a/cypress_test/integration_tests/desktop/calc/scrolling_spec.js b/cypress_test/integration_tests/desktop/calc/scrolling_spec.js index 4b0b5b382a..c82fd37308 100644 --- a/cypress_test/integration_tests/desktop/calc/scrolling_spec.js +++ b/cypress_test/integration_tests/desktop/calc/scrolling_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach expect require afterEach */ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var desktopHelper = require('../../common/desktop_helper'); @@ -21,15 +21,15 @@ describe('Scroll through document', function() { }); it('Scrolling to bottom/top', function() { - desktopHelper.assertScrollbarPosition('vertical', [29, 26]); + desktopHelper.assertScrollbarPosition('vertical', 26, 29); desktopHelper.pressKey(3,'pagedown'); - desktopHelper.assertScrollbarPosition('vertical', [224, 201, 191]); + desktopHelper.assertScrollbarPosition('vertical', 191, 224); desktopHelper.pressKey(3,'pageup'); - desktopHelper.assertScrollbarPosition('vertical', [29, 26]); + desktopHelper.assertScrollbarPosition('vertical', 26, 29); }); it('Scrolling to left/right', function() { @@ -37,16 +37,12 @@ describe('Scroll through document', function() { helper.typeIntoDocument('{home}'); - desktopHelper.assertScrollbarPosition('horizontal', [62, 55, 68]); + desktopHelper.assertScrollbarPosition('horizontal', 55, 68); helper.typeIntoDocument('{end}'); cy.wait(500); - cy.get('#test-div-horizontal-scrollbar') - .then(function($item) { - const x = parseInt($item.text()); - expect(x).to.be.within(129, 155); - }); + desktopHelper.assertScrollbarPosition('horizontal', 129, 155); }); }); diff --git a/cypress_test/integration_tests/desktop/impress/scrolling_spec.js b/cypress_test/integration_tests/desktop/impress/scrolling_spec.js index 81e434c3bc..9902c419ee 100644 --- a/cypress_test/integration_tests/desktop/impress/scrolling_spec.js +++ b/cypress_test/integration_tests/desktop/impress/scrolling_spec.js @@ -29,11 +29,10 @@ describe('Scroll through document', function() { var XPos = (items[0].getBoundingClientRect().left + items[0].getBoundingClientRect().right) / 2; var YPos = (items[0].getBoundingClientRect().top + items[0].getBoundingClientRect().bottom) / 2; cy.get('body') - .click(XPos, YPos) + .dblclick(XPos, YPos) .wait(500); }); } - it('Scrolling to bottom/top', function() { //show vertical scrollbar cy.get('.leaflet-layer') @@ -50,7 +49,7 @@ describe('Scroll through document', function() { desktopHelper.pressKey(18,'downarrow'); - desktopHelper.assertScrollbarPosition('vertical', [384, 337]); + desktopHelper.assertScrollbarPosition('vertical', 335, 384); }); it('Scrolling to left/right', function() { @@ -62,13 +61,15 @@ describe('Scroll through document', function() { clickOnTheCenter(); - helper.typeIntoDocument('{home}{end}{home}'); + cy.wait(500); + + helper.typeIntoDocument('{home}'); cy.get('#test-div-horizontal-scrollbar') .should('have.text', '6').wait(500); - helper.typeIntoDocument('{end}{home}{end}'); + helper.typeIntoDocument('{end}'); - desktopHelper.assertScrollbarPosition('horizontal', [660, 581]); + desktopHelper.assertScrollbarPosition('horizontal', 581, 660); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/scrolling_spec.js b/cypress_test/integration_tests/desktop/writer/scrolling_spec.js index 4ba60b771d..1d50f92978 100644 --- a/cypress_test/integration_tests/desktop/writer/scrolling_spec.js +++ b/cypress_test/integration_tests/desktop/writer/scrolling_spec.js @@ -71,6 +71,6 @@ describe('Scroll through document', function() { helper.typeIntoDocument('{end}{home}{end}'); - desktopHelper.assertScrollbarPosition('horizontal', [660, 577]); + desktopHelper.assertScrollbarPosition('horizontal', 577, 660); }); }); |