cypress_test/Makefile.am | 6 - cypress_test/integration_tests/common/helper.js | 15 +++ cypress_test/integration_tests/common/mobile_helper.js | 41 ---------- cypress_test/integration_tests/mobile/calc/apply_font_spec.js | 4 cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js | 6 - cypress_test/integration_tests/mobile/calc/number_format_spec.js | 12 +- cypress_test/integration_tests/mobile/writer/apply_font_spec.js | 4 cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js | 8 - cypress_test/integration_tests/mobile/writer/insert_object_spec.js | 6 - cypress_test/integration_tests/mobile/writer/shape_properties_spec.js | 14 +-- cypress_test/integration_tests/mobile/writer/table_properties_spec.js | 34 ++++---- 11 files changed, 63 insertions(+), 87 deletions(-)
New commits: commit 3543df543041f19d5a8d6cac5254aa9b37ebe3cc Author: Tamás Zolnai <[email protected]> AuthorDate: Fri Jun 5 05:09:21 2020 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Fri Jun 5 16:33:26 2020 +0200 cypress: better way of detecting core version. We need this information earlier before we load the test document. We can use call LO binary to get the version string. Change-Id: I72927df1fd79ff12906b55376c3474aa973dce07 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95584 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am index ba75d9a15..77b270325 100644 --- a/cypress_test/Makefile.am +++ b/cypress_test/Makefile.am @@ -33,6 +33,8 @@ DISPLAY_NUMBER = 100 HEADLESS_BUILD := $(findstring Command failed,$(shell xhost > /dev/null 2>&1 || echo "Command failed, so we are in a headless environment.")) export DISPLAY=$(if $(HEADLESS_BUILD),:$(DISPLAY_NUMBER),$(shell echo $$DISPLAY)) +CORE_VERSION := $(shell "@LO_PATH@"/program/soffice.bin --version 2> /dev/null) + if ENABLE_DEBUG FILTER_DEBUG=cypress:electron,cypress:launcher export DEBUG=$(if $(ENABLE_LOGGING),$(FILTER_DEBUG),) @@ -157,11 +159,11 @@ endef DESKTOP_CONFIG = \ --config integrationFolder=$(DESKTOP_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT) \ - --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) + --env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)" MOBILE_CONFIG = \ --config integrationFolder=$(MOBILE_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT) \ - --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT) + --env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR),WSD_VERSION_HASH=$(WSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)" define run_interactive_test $(if $(2),\ diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index fc20af278..f8bdd7209 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -148,8 +148,6 @@ function matchClipboardText(regexp) { function beforeAllDesktop(fileName, subFolder) { var mobile = false; loadTestDoc(fileName, subFolder, mobile); - - // detectLOCoreVersion(); //TODO: implement Core version check. } function afterAll(fileName) { @@ -232,6 +230,18 @@ function typeText(selector, text, delayMs=0) { } } +function getLOVersion() { + var versionString = Cypress.env('LO_CORE_VERSION'); + if (versionString.includes('Collabora')) { + if (versionString.includes(' 6.2.')) { + return 'cp-6-2'; + } else if (versionString.includes(' 6.4.')) { + return 'cp-6-4'; + } + } + return 'master'; +} + module.exports.loadTestDoc = loadTestDoc; module.exports.assertCursorAndFocus = assertCursorAndFocus; module.exports.assertNoKeyboardInput = assertNoKeyboardInput; @@ -248,3 +258,4 @@ module.exports.isImpress = isImpress; module.exports.isWriter = isWriter; module.exports.beforeAllDesktop = beforeAllDesktop; module.exports.typeText = typeText; +module.exports.getLOVersion = getLOVersion; diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js index 779c7fb29..8627cbd55 100644 --- a/cypress_test/integration_tests/common/mobile_helper.js +++ b/cypress_test/integration_tests/common/mobile_helper.js @@ -1,4 +1,4 @@ -/* global cy Cypress expect require*/ +/* global cy expect require*/ var helper = require('./helper'); @@ -22,45 +22,6 @@ function enableEditingMobile() { function beforeAllMobile(fileName, subFolder) { helper.loadTestDoc(fileName, subFolder, true); - - detectLOCoreVersion(); -} - -function detectLOCoreVersion() { - cy.log('Detecting core version - start.'); - - if (Cypress.env('LO_CORE_VERSION') === undefined) { - // Open hamburger menu - openHamburgerMenu(); - - // Open about dialog - cy.contains('.ui-header.level-0 .menu-entry-with-icon', 'About') - .click(); - - cy.get('.vex-content') - .should('exist'); - - // Get the version - cy.get('#lokit-version') - .then(function(items) { - expect(items).have.lengthOf(1); - if (items[0].textContent.includes('Collabora') && - items[0].textContent.includes('6.2')) { - Cypress.env('LO_CORE_VERSION', 'cp-6-2');} - else { - Cypress.env('LO_CORE_VERSION', 'master'); - } - }); - - // Close about dialog - cy.get('.vex-close') - .click({force : true}); - - cy.get('.vex-content') - .should('not.exist'); - } - - cy.log('Detecting core version - end.'); } function longPressOnDocument(posX, posY) { diff --git a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js index c55802c81..dbe8766bf 100644 --- a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js +++ b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var calcHelper = require('../../common/calc_helper'); @@ -115,7 +115,7 @@ describe('Apply font changes.', function() { cy.contains('.mobile-wizard.ui-combobox-text', '14') .click(); - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') cy.get('.level-1[title="Font Size"] .mobile-wizard.ui-combobox-text.selected') .should('have.text', '14 pt'); else diff --git a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js index cd24896ce..e0f95f287 100644 --- a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js +++ b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js @@ -1,11 +1,13 @@ -/* global cy Cypress expect*/ +/* global cy expect require */ + +var helper = require('../../common/helper'); function removeTextSelection() { cy.log('Removing text selection - start.'); // TODO: select all does not work with core/master // if we have a column selected - if (Cypress.env('LO_CORE_VERSION') === 'master') { + if (helper.getLOVersion() === 'master') { cy.get('body') .type('{enter}'); diff --git a/cypress_test/integration_tests/mobile/calc/number_format_spec.js b/cypress_test/integration_tests/mobile/calc/number_format_spec.js index 86d76cb6c..bda3bd847 100644 --- a/cypress_test/integration_tests/mobile/calc/number_format_spec.js +++ b/cypress_test/integration_tests/mobile/calc/number_format_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var calcHelper = require('../../common/calc_helper'); @@ -51,7 +51,7 @@ describe('Apply number formatting.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') !== 'master') + if (helper.getLOVersion() !== 'master') cy.get('#NumberFormatPercentimg') .should('have.class', 'selected'); @@ -74,7 +74,7 @@ describe('Apply number formatting.', function() { it('Push percent button.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; // Change to percent @@ -108,7 +108,7 @@ describe('Apply number formatting.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') !== 'master') + if (helper.getLOVersion() !== 'master') cy.get('#NumberFormatCurrencyimg') .should('have.class', 'selected'); @@ -131,7 +131,7 @@ describe('Apply number formatting.', function() { it('Push currency button.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; // Change to currency @@ -163,7 +163,7 @@ describe('Apply number formatting.', function() { it('Push number button.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; // Change to currency first diff --git a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js index 588e36eeb..1d1b800d9 100644 --- a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js +++ b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -80,7 +80,7 @@ describe('Apply font changes.', function() { cy.contains('.mobile-wizard.ui-combobox-text', '36') .click(); - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') cy.get('.level-1[title="Font Size"] .mobile-wizard.ui-combobox-text.selected') .should('have.text', '36 pt'); else diff --git a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js index 8aa33e67f..c6d1be104 100644 --- a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -115,7 +115,7 @@ describe('Apply paragraph properties.', function() { it('Apply default bulleting.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; cy.get('#DefaultBullet') @@ -130,7 +130,7 @@ describe('Apply paragraph properties.', function() { it('Apply default numbering.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; cy.get('#DefaultNumbering') @@ -145,7 +145,7 @@ describe('Apply paragraph properties.', function() { it('Apply background color.', function() { // TODO: Why this item is missing with core/master // In desktop LO, sidebar contains this item. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; // Change background color diff --git a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js index 7410c237a..bf60bcb7d 100644 --- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require expect afterEach Cypress*/ +/* global describe it cy beforeEach require expect afterEach */ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -65,7 +65,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert default table.', function() { // TODO: Select all does not work with core/master - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; mobileHelper.openInsertionWizard(); @@ -98,7 +98,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert custom table.', function() { // TODO: Select all does not work with core/master - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; mobileHelper.openInsertionWizard(); diff --git a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js index 278c41c54..deeaa76a7 100644 --- a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach */ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -116,7 +116,7 @@ describe('Change shape properties via mobile wizard.', function() { it.skip('Change size with keep ratio enabled.', function() { // TODO: Entering a value inside the spinbutton has no effect on the shape. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openPosSizePanel(); @@ -195,7 +195,7 @@ describe('Change shape properties via mobile wizard.', function() { it('Change line color', function() { // TODO: Layout of the line properties panel is completely broken. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openLinePropertyPanel(); @@ -214,7 +214,7 @@ describe('Change shape properties via mobile wizard.', function() { it.skip('Change line style', function() { // TODO: Layout of the line properties panel is completely broken. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openLinePropertyPanel(); @@ -233,7 +233,7 @@ describe('Change shape properties via mobile wizard.', function() { it('Change line width', function() { // TODO: Layout of the line properties panel is completely broken. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openLinePropertyPanel(); @@ -262,7 +262,7 @@ describe('Change shape properties via mobile wizard.', function() { it('Change line transparency', function() { // TODO: Layout of the line properties panel is completely broken. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openLinePropertyPanel(); @@ -283,7 +283,7 @@ describe('Change shape properties via mobile wizard.', function() { it('Arrow style items are hidden.', function() { // TODO: Layout of the line properties panel is completely broken. - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; openLinePropertyPanel(); diff --git a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js index 664840f52..14b2bd73d 100644 --- a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy require expect Cypress afterEach */ +/* global describe it cy require expect afterEach */ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -46,7 +46,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Insert row before.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -75,7 +75,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Insert row after.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -104,7 +104,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Insert column before.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -133,7 +133,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Insert column after.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -162,7 +162,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Delete row.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -191,7 +191,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Delete column.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -221,7 +221,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Delete table.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -250,7 +250,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Merge cells.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -278,7 +278,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Change row height.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -306,7 +306,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Change column width.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_properties.odt'); @@ -334,7 +334,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set minimal row height.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); @@ -359,7 +359,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set optimal row height.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); @@ -393,7 +393,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Distribute rows.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); @@ -427,7 +427,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set minimal column width.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); @@ -450,7 +450,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set optimal column width.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); @@ -475,7 +475,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Distribute columns.', function() { // TODO: Select all does not work with core/master // Table panel layout is also broken - if (Cypress.env('LO_CORE_VERSION') === 'master') + if (helper.getLOVersion() === 'master') return; before('table_with_text.odt'); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
