[Libreoffice-commits] online.git: cypress_test/integration_tests

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 7 14:25:11 UTC 2020


 cypress_test/integration_tests/common/mobile_helper.js                   |   38 +++++++++-
 cypress_test/integration_tests/mobile/writer/focus_spec.js               |    4 -
 cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js |    9 +-
 cypress_test/integration_tests/mobile/writer/writer_helper.js            |    2 
 4 files changed, 42 insertions(+), 11 deletions(-)

New commits:
commit 7826d75b45cda2835634a7524d3afdd214c06c18
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Apr 7 15:44:57 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Apr 7 16:24:53 2020 +0200

    cypress: mobile: extract openHamburgerMenu() and closeHamburgerMenu() method.
    
    Change-Id: Ib288ccabee7aa06c5e9b8b0c54ac88055c1ae820
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91827
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js
index c3a077bca..787d7e428 100644
--- a/cypress_test/integration_tests/common/mobile_helper.js
+++ b/cypress_test/integration_tests/common/mobile_helper.js
@@ -25,7 +25,7 @@ function beforeAllMobile(fileName, subFolder) {
 function detectLOCoreVersion() {
 	if (Cypress.env('LO_CORE_VERSION') === undefined) {
 		// Open hamburger menu
-		pushHamburgerMenuIconMobile();
+		openHamburgerMenu();
 
 		// Open about dialog
 		cy.get('.ui-header.level-0 .menu-entry-with-icon')
@@ -81,9 +81,40 @@ function longPressOnDocument(posX, posY) {
 		});
 }
 
-function pushHamburgerMenuIconMobile() {
+function openHamburgerMenu() {
+	cy.log('Opening hamburger menu - start.');
+
+	cy.get('#toolbar-hamburger')
+		.should('not.have.class', 'menuwizard-opened');
+
 	cy.get('#toolbar-hamburger .main-menu-btn-icon')
 		.click({force: true});
+
+	cy.get('#toolbar-hamburger')
+		.should('have.class', 'menuwizard-opened');
+
+	cy.get('#mobile-wizard-content')
+		.should('not.be.empty');
+
+	cy.log('Opening hamburger menu - end.');
+}
+
+function closeHamburgerMenu() {
+	cy.log('Closing hamburger menu - start.');
+
+	cy.get('#toolbar-hamburger')
+		.should('have.class', 'menuwizard-opened');
+
+	cy.get('#toolbar-hamburger .main-menu-btn-icon')
+		.click({force: true});
+
+	cy.get('#toolbar-hamburger')
+		.should('not.have.class', 'menuwizard-opened');
+
+	cy.get('#mobile-wizard-content')
+		.should('be.empty');
+
+	cy.log('Closing hamburger menu - end.');
 }
 
 function openMobileWizard() {
@@ -123,6 +154,7 @@ function closeMobileWizard() {
 module.exports.enableEditingMobile = enableEditingMobile;
 module.exports.beforeAllMobile = beforeAllMobile;
 module.exports.longPressOnDocument = longPressOnDocument;
-module.exports.pushHamburgerMenuIconMobile = pushHamburgerMenuIconMobile;
+module.exports.openHamburgerMenu = openHamburgerMenu;
+module.exports.closeHamburgerMenu = closeHamburgerMenu;
 module.exports.openMobileWizard = openMobileWizard;
 module.exports.closeMobileWizard = closeMobileWizard;
diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js
index 5991f9b90..a8558763e 100644
--- a/cypress_test/integration_tests/mobile/writer/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -204,14 +204,14 @@ describe('Focus tests', function() {
 			.should('be.eq', 'clipboard');
 
 		// Open hamburger menu
-		mobileHelper.pushHamburgerMenuIconMobile();
+		mobileHelper.openHamburgerMenu();
 
 		// No focus
 		cy.document().its('activeElement.tagName')
 			.should('be.eq', 'BODY');
 
 		// Close hamburger menu
-		mobileHelper.pushHamburgerMenuIconMobile();
+		mobileHelper.closeHamburgerMenu();
 
 		// No focus
 		cy.document().its('activeElement.tagName')
diff --git a/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
index 18b260f39..741ce3e47 100644
--- a/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
@@ -32,15 +32,13 @@ describe('Mobile wizard state tests', function() {
 		mobileHelper.openMobileWizard();
 
 		// Open hamburger menu
-		mobileHelper.pushHamburgerMenuIconMobile();
+		mobileHelper.openHamburgerMenu();
+
 		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon')
 			.contains('About');
 
 		// Close hamburger menu
-		mobileHelper.pushHamburgerMenuIconMobile();
-		// Mobile wizard is closed
-		cy.get('#mobile-wizard')
-			.should('not.be.visible');
+		mobileHelper.closeHamburgerMenu();
 
 		// Open mobile wizard again
 		mobileHelper.openMobileWizard();
@@ -54,6 +52,7 @@ describe('Mobile wizard state tests', function() {
 
 		// Open context wizard by right click on document
 		mobileHelper.longPressOnDocument(40, 40);
+
 		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon')
 			.contains('Paste');
 
diff --git a/cypress_test/integration_tests/mobile/writer/writer_helper.js b/cypress_test/integration_tests/mobile/writer/writer_helper.js
index 43665d30d..15a0cc7be 100644
--- a/cypress_test/integration_tests/mobile/writer/writer_helper.js
+++ b/cypress_test/integration_tests/mobile/writer/writer_helper.js
@@ -80,7 +80,7 @@ function selectAllMobile() {
 		.should('not.exist');
 
 	// Open hamburger menu
-	mobileHelper.pushHamburgerMenuIconMobile();
+	mobileHelper.openHamburgerMenu();
 	cy.get('#mobile-wizard')
 		.should('be.visible', {timeout : 10000});
 


More information about the Libreoffice-commits mailing list