diff options
author | Rash419 <rashesh.padia@collabora.com> | 2022-03-15 14:54:18 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-15 14:05:12 +0100 |
commit | 23f079041319473a00ca3f67b306a092da8f3ba3 (patch) | |
tree | dae090cb75cd74c59e96751375261b9de3b942f6 /cypress_test/integration_tests | |
parent | Editing of document templates does not work well currently (diff) | |
download | online-23f079041319473a00ca3f67b306a092da8f3ba3.tar.gz online-23f079041319473a00ca3f67b306a092da8f3ba3.zip |
cypress: change template files tests to assert readOnly
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib557424de7407346ca947bfe06289b772ec46d10
Diffstat (limited to 'cypress_test/integration_tests')
3 files changed, 30 insertions, 34 deletions
diff --git a/cypress_test/integration_tests/common/desktop_helper.js b/cypress_test/integration_tests/common/desktop_helper.js index b54f4a4996..f1fd546f9d 100644 --- a/cypress_test/integration_tests/common/desktop_helper.js +++ b/cypress_test/integration_tests/common/desktop_helper.js @@ -1,6 +1,6 @@ /* global cy require Cypress expect */ -const { clickOnIdle, typeIntoDocument, waitUntilIdle } = require('./helper'); +var helper = require('./helper'); // Make the sidebar visible by clicking on the corresponding toolbar item. // We assume that the sidebar is hidden, when this method is called. @@ -213,7 +213,7 @@ function zoomOut() { function selectZoomLevel(zoomLevel) { makeZoomItemsVisible(); - clickOnIdle('#tb_actionbar_item_zoom'); + helper.clickOnIdle('#tb_actionbar_item_zoom'); cy.contains('.w2ui-drop-menu .menu-text', zoomLevel) .click(); @@ -256,9 +256,9 @@ function insertImage(docType) { } function deleteImage() { - typeIntoDocument('{del}'); + helper.typeIntoDocument('{del}'); - waitUntilIdle('.leaflet-pane.leaflet-overlay-pane'); + helper.waitUntilIdle('.leaflet-pane.leaflet-overlay-pane'); cy.get('.leaflet-pane.leaflet-overlay-pane svg g') .should('not.exist'); @@ -358,11 +358,26 @@ function assertScrollbarPosition(type, lowerBound, upperBound) { function pressKey(n, key) { for (let i=0; i<n; i++) { - typeIntoDocument('{' + key + '}'); + helper.typeIntoDocument('{' + key + '}'); cy.wait(500); } } + +function openReadOnlyFile(type, filename) { + var testFileName = helper.loadTestDocNoIntegration(filename, type, false, false, false); + + //check doc is loaded + cy.get('.leaflet-canvas-container canvas', {timeout : Cypress.config('defaultCommandTimeout') * 2.0}); + + helper.canvasShouldNotBeFullWhite('.leaflet-canvas-container canvas'); + + cy.get('#PermissionMode').should('be.visible') + .should('have.text', ' Read-only '); + + return testFileName; +} + module.exports.showSidebar = showSidebar; module.exports.hideSidebar = hideSidebar; module.exports.showStatusBarIfHidden = showStatusBarIfHidden; @@ -383,3 +398,4 @@ module.exports.actionOnSelector = actionOnSelector; module.exports.assertScrollbarPosition = assertScrollbarPosition; module.exports.pressKey = pressKey; module.exports.assertImageSize = assertImageSize; +module.exports.openReadOnlyFile = openReadOnlyFile; diff --git a/cypress_test/integration_tests/desktop/impress/open_different_file_types_spec.js b/cypress_test/integration_tests/desktop/impress/open_different_file_types_spec.js index bf7a63c94f..c2ab51fc1f 100644 --- a/cypress_test/integration_tests/desktop/impress/open_different_file_types_spec.js +++ b/cypress_test/integration_tests/desktop/impress/open_different_file_types_spec.js @@ -1,6 +1,6 @@ /* global describe it cy require expect afterEach */ var helper = require('../../common/helper'); -const { selectZoomLevel } = require('../../common/desktop_helper'); +const { selectZoomLevel, openReadOnlyFile } = require('../../common/desktop_helper'); // const { selectTextShapeInTheCenter } = require('../../common/impress_helper'); describe('Open different file types', function() { @@ -80,21 +80,15 @@ describe('Open different file types', function() { }); it('Open pot file', function() { - before('testfile.pot'); - - assertData(); + testFileName = openReadOnlyFile('impress', 'testfile.pot'); }); it('Open potx file', function() { - before('testfile.potx'); - - assertData(); + testFileName = openReadOnlyFile('impress', 'testfile.potx'); }); it('Open potm file', function() { - before('testfile.potm'); - - assertData(); + testFileName = openReadOnlyFile('impress', 'testfile.potm'); }); it('Open fodp file', function() { diff --git a/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js b/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js index 7ef738a834..f3478d42d4 100644 --- a/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js +++ b/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js @@ -1,5 +1,5 @@ -/* global describe it cy require Cypress afterEach */ -const { assertImageSize } = require('../../common/desktop_helper'); +/* global describe it cy require afterEach */ +const { assertImageSize, openReadOnlyFile } = require('../../common/desktop_helper'); var helper = require('../../common/helper'); describe('Open different file types', function() { @@ -16,18 +16,6 @@ describe('Open different file types', function() { helper.afterAll(testFileName, this.currentTest.state); }); - function openReadOnlyFile(filename) { - testFileName = helper.loadTestDocNoIntegration(filename, 'writer', false, false, false); - - //check doc is loaded - cy.get('.leaflet-canvas-container canvas', {timeout : Cypress.config('defaultCommandTimeout') * 2.0}); - - helper.canvasShouldNotBeFullWhite('.leaflet-canvas-container canvas'); - - cy.get('#PermissionMode').should('be.visible') - .should('have.text', ' Read-only '); - } - function assertData() { //select all the content of doc helper.typeIntoDocument('{shift}{end}'); @@ -102,16 +90,14 @@ describe('Open different file types', function() { }); it('Open dot file', function() { - before('testfile.dot'); - - assertData(); + testFileName = openReadOnlyFile('writer', 'testfile.dot'); }); it('Open dotm file', function() { - openReadOnlyFile('testfile.dotm'); + testFileName = openReadOnlyFile('writer', 'testfile.dotm'); }); it('Open dotx file', function() { - openReadOnlyFile('testfile.dotx'); + testFileName = openReadOnlyFile('writer','testfile.dotx'); }); }); |