cypress_test/integration_tests/common/mobile_helper.js                      |  
 36 +++++
 cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js         |  
  6 
 cypress_test/integration_tests/mobile/writer/focus_spec.js                  |  
 14 -
 cypress_test/integration_tests/mobile/writer/insert_field_spec.js           |  
  6 
 cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js |  
  6 
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js          |  
 72 +---------
 cypress_test/integration_tests/mobile/writer/shape_properties_spec.js       |  
  6 
 cypress_test/integration_tests/mobile/writer/toolbar_spec.js                |  
 31 ----
 8 files changed, 57 insertions(+), 120 deletions(-)

New commits:
commit e6c81ec33b6a530fa59af633b6a8922d64c69479
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Thu Apr 9 11:53:23 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Thu Apr 9 12:49:27 2020 +0200

    cypress: mobile: extract openInsertionWizard() and closeInsertionWizard().
    
    Change-Id: I3ace4714d6848dfa1132240debe95ab63ac3d26b
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91958
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/integration_tests/common/mobile_helper.js 
b/cypress_test/integration_tests/common/mobile_helper.js
index c63776596..1c67b85ef 100644
--- a/cypress_test/integration_tests/common/mobile_helper.js
+++ b/cypress_test/integration_tests/common/mobile_helper.js
@@ -186,6 +186,40 @@ function executeCopyFromContextMenu(XPos, YPos) {
        cy.log('Executing copy from context menu - end.');
 }
 
+function openInsertionWizard() {
+       cy.log('Opening insertion wizard - start.');
+
+       cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+               .should('not.have.class', 'disabled')
+               .click();
+
+       cy.get('#mobile-wizard-content')
+               .should('not.be.empty');
+
+       cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+               .should('have.class', 'checked');
+
+       cy.log('Opening insertion wizard - end.');
+}
+
+function closeInsertionWizard() {
+       cy.log('Closing insertion wizard - start.');
+
+       cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+               .should('have.class', 'checked');
+
+       cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+               .click();
+
+       cy.get('#mobile-wizard')
+               .should('not.be.visible');
+
+       cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+               .should('not.have.class', 'checked');
+
+       cy.log('Closing insertion wizard - end.');
+}
+
 module.exports.enableEditingMobile = enableEditingMobile;
 module.exports.beforeAllMobile = beforeAllMobile;
 module.exports.longPressOnDocument = longPressOnDocument;
@@ -194,3 +228,5 @@ module.exports.closeHamburgerMenu = closeHamburgerMenu;
 module.exports.openMobileWizard = openMobileWizard;
 module.exports.closeMobileWizard = closeMobileWizard;
 module.exports.executeCopyFromContextMenu = executeCopyFromContextMenu;
+module.exports.openInsertionWizard = openInsertionWizard;
+module.exports.closeInsertionWizard = closeInsertionWizard;
diff --git 
a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js 
b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
index 4dd1c3e60..847184584 100644
--- a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
@@ -16,11 +16,7 @@ describe('Calc insertion wizard.', function() {
                cy.get('.leaflet-marker-icon')
                        .should('be.visible');
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard-content')
-                       .should('not.be.empty');
+               mobileHelper.openInsertionWizard();
        });
 
        afterEach(function() {
diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js 
b/cypress_test/integration_tests/mobile/writer/focus_spec.js
index 3a90e0f7d..d20f4f87b 100644
--- a/cypress_test/integration_tests/mobile/writer/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -108,12 +108,7 @@ describe('Focus tests', function() {
                // Click on edit button
                mobileHelper.enableEditingMobile();
 
-               // Open insertion mobile wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-
-               cy.get('#mobile-wizard-content')
-                       .should('not.be.empty');
+               mobileHelper.openInsertionWizard();
 
                // Select More Fields
                
helper.selectItemByContent('.ui-header.level-0.mobile-wizard.ui-widget', 'More 
Fields...')
@@ -135,12 +130,7 @@ describe('Focus tests', function() {
                // Click on edit button
                mobileHelper.enableEditingMobile();
 
-               // Open insertion mobile wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-
-               cy.get('#mobile-wizard-content')
-                       .should('not.be.empty');
+               mobileHelper.openInsertionWizard();
 
                // Do insertion
                helper.selectItemByContent('.menu-entry-with-icon', 'Shape')
diff --git a/cypress_test/integration_tests/mobile/writer/insert_field_spec.js 
b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js
index 8bfba8fc8..1f588ab68 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_field_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js
@@ -11,11 +11,7 @@ describe('Insert fields via insertion wizard.', function() {
                // Click on edit button
                mobileHelper.enableEditingMobile();
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open fields submenu
                
helper.selectItemByContent('.menu-entry-with-icon.flex-fullwidth', 'More 
Fields...')
diff --git 
a/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js 
b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
index dc55069ce..1ea93713b 100644
--- 
a/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
+++ 
b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
@@ -11,11 +11,7 @@ describe('Insert formatting mark via insertion wizard.', 
function() {
                // Click on edit button
                mobileHelper.enableEditingMobile();
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open formatting marks
                
helper.selectItemByContent('.menu-entry-with-icon.flex-fullwidth', 'Formatting 
Mark')
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 b7d103e8e..ba3e047a8 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -19,11 +19,7 @@ describe('Insert objects via insertion wizard.', function() {
        });
 
        it('Insert local image.', function() {
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // We check whether the entry is there
                helper.selectItemByContent('.menu-entry-with-icon', 'Local 
Image...')
@@ -32,11 +28,7 @@ describe('Insert objects via insertion wizard.', function() {
        });
 
        it('Insert comment.', function() {
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                helper.selectItemByContent('.menu-entry-with-icon', 'Comment')
                        .click();
@@ -64,11 +56,7 @@ describe('Insert objects via insertion wizard.', function() {
                if (Cypress.env('LO_CORE_VERSION') === 'master')
                        return;
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open Table submenu
                
helper.selectItemByContent('.ui-header.level-0.mobile-wizard.ui-widget', 
'Table')
@@ -101,11 +89,7 @@ describe('Insert objects via insertion wizard.', function() 
{
                if (Cypress.env('LO_CORE_VERSION') === 'master')
                        return;
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open Table submenu
                
helper.selectItemByContent('.ui-header.level-0.mobile-wizard.ui-widget', 
'Table')
@@ -149,11 +133,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigLeft = 
cursor[0].getBoundingClientRect().left;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open header/footer submenu
                helper.selectItemByContent('.menu-entry-with-icon', 'Header and 
Footer')
@@ -189,11 +169,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigTop = 
cursor[0].getBoundingClientRect().top;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open header/footer submenu
                helper.selectItemByContent('.menu-entry-with-icon', 'Header and 
Footer')
@@ -229,11 +205,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigTop = 
cursor[0].getBoundingClientRect().top;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Insert footnote
                helper.selectItemByContent('.menu-entry-with-icon', 'Footnote')
@@ -259,11 +231,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigTop = 
cursor[0].getBoundingClientRect().top;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Insert endnote
                helper.selectItemByContent('.menu-entry-with-icon', 'Endnote')
@@ -289,11 +257,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigTop = 
cursor[0].getBoundingClientRect().top;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Insert page break
                helper.selectItemByContent('.menu-entry-with-icon', 'Page 
Break')
@@ -319,11 +283,7 @@ describe('Insert objects via insertion wizard.', 
function() {
                                cursorOrigTop = 
cursor[0].getBoundingClientRect().top;
                        });
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Do insertion
                helper.selectItemByContent('.menu-entry-with-icon', 'Column 
Break')
@@ -340,11 +300,7 @@ describe('Insert objects via insertion wizard.', 
function() {
        });
 
        it('Insert hyperlink.', function() {
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Open hyperlink dialog
                helper.selectItemByContent('.menu-entry-with-icon', 
'Hyperlink...')
@@ -374,11 +330,7 @@ describe('Insert objects via insertion wizard.', 
function() {
        });
 
        it('Insert shape.', function() {
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Do insertion
                helper.selectItemByContent('.menu-entry-with-icon', 'Shape')
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 5695d293e..87aa69435 100644
--- a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js
@@ -21,11 +21,7 @@ describe('Change shape properties via mobile wizard.', 
function() {
                cy.get('.blinking-cursor')
                        .should('be.visible');
 
-               // Open insertion wizard
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-               cy.get('#mobile-wizard')
-                       .should('be.visible');
+               mobileHelper.openInsertionWizard();
 
                // Do insertion
                helper.selectItemByContent('.menu-entry-with-icon', 'Shape')
diff --git a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js 
b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js
index a71f84c17..aca83d73d 100644
--- a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js
@@ -131,36 +131,11 @@ describe('Toolbar tests', function() {
                // Click on edit button
                mobileHelper.enableEditingMobile();
 
-               // Click on toolbar item
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .should('not.have.class', 'disabled')
-                       .click();
-
-               // Mobile wizard is opened and it has any content
-               cy.get('#mobile-wizard-content')
-                       .should('not.be.empty');
-
-               // Toolbar button is checked
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
-                       .should('have.class', 'checked');
-
-               // Click on toolbar item again
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
-
-               // Mobile wizard is closed
-               cy.get('#mobile-wizard').should('not.be.visible');
-
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
-                       .should('not.have.class', 'checked');
+               mobileHelper.openInsertionWizard();
 
-               // Open mobile wizard again
-               cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-                       .click();
+               mobileHelper.closeInsertionWizard();
 
-               // Mobile wizard is opened and it has any content
-               cy.get('#mobile-wizard-content')
-                       .should('not.be.empty');
+               mobileHelper.openInsertionWizard();
        });
 
        it('Open insert comment dialog by toolbar item.', function() {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to