cypress_test/data/mobile/writer/hamburger_menu.odt                     |binary
 cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js |    2 
 cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js    |  387 
++++++++++
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js     |    2 
 4 files changed, 389 insertions(+), 2 deletions(-)

New commits:
commit 789083b521aa9677b054fb3cfa9048fd87b56c77
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Sat Jun 13 17:18:58 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sat Jun 13 17:49:27 2020 +0200

    cypress: add change tracking related tests (writer, mobile)
    
    Change-Id: I0c1426ce784153b102049f9770b8fd99eeaf784c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96260
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git 
a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js 
b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
index e6523476c..1dae35427 100644
--- a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
@@ -1,4 +1,4 @@
-/* global describe it cy beforeEach require afterEach */
+/* global describe it cy beforeEach require afterEach expect */
 
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
@@ -12,15 +12,255 @@ describe('Trigger hamburger menu options.', function() {
 
                // Click on edit button
                mobileHelper.enableEditingMobile();
-
-               mobileHelper.openHamburgerMenu();
        });
 
        afterEach(function() {
                helper.afterAll(testFileName);
        });
 
+       it('Enable track changes recording.', function() {
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               // Insert some text and check whether it's tracked.
+               cy.get('textarea.clipboard')
+                       .type('{q}');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Previous')
+                       .click();
+
+               cy.get('.leaflet-marker-icon')
+                       .should('exist');
+
+               // We should have 'q' selected.
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\nq');
+
+               // Then disable recording.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               cy.get('textarea.clipboard')
+                       .type('{rightArrow}w');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Previous')
+                       .click();
+
+               cy.get('.leaflet-marker-icon')
+                       .should('exist');
+
+               // We should have 'q' selected.
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\nq');
+       });
+
+       it('Show track changes.', function() {
+               mobileHelper.openHamburgerMenu();
+
+               // First start recording.
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               // Remove text content.
+               cy.get('#document-container')
+                       .click();
+
+               helper.clearAllText();
+
+               // By default track changed are shown.
+               writerMobileHelper.selectAllMobile();
+
+               // We have selection markers.
+               cy.get('.leaflet-marker-icon')
+                       .should('exist');
+
+               // No actual text sent from core because of the removal.
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\n\n\n');
+
+               // Remove text selection.
+               cy.get('textarea.clipboard')
+                       .type('{leftArrow}');
+
+               // Hide track changes.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Show')
+                       .click();
+
+               // Trigger select all
+               cy.get('textarea.clipboard')
+                       .type('{ctrl}a');
+
+               // Both selection markers should be in the same line
+               cy.get('.leaflet-marker-icon:nth-of-type(1)')
+                       .then(function(firstMarker) {
+                               cy.get('.leaflet-marker-icon:nth-of-type(2)')
+                                       .then(function(secondMarker) {
+                                               
expect(firstMarker.offset().top).to.be.equal(secondMarker.offset().top);
+                                               
expect(firstMarker.offset().bottom).to.be.equal(secondMarker.offset().bottom);
+                                       });
+                       });
+       });
+
+       it('Accept all changes.', function() {
+               mobileHelper.openHamburgerMenu();
+
+               // First start recording.
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               // Remove text content.
+               cy.get('#document-container')
+                       .click();
+
+               helper.clearAllText();
+
+               // Accept removal.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Accept All')
+                       .click();
+
+               // Check that we dont have the removed content
+               cy.get('textarea.clipboard')
+                       .type('{ctrl}a');
+
+               cy.wait(1000);
+
+               // No selection
+               cy.get('.leaflet-marker-icon')
+                       .should('not.exist');
+       });
+
+       it('Reject all changes.', function() {
+               mobileHelper.openHamburgerMenu();
+
+               // First start recording.
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               // Remove text content.
+               cy.get('#document-container')
+                       .click();
+
+               helper.clearAllText();
+
+               writerMobileHelper.selectAllMobile();
+
+               // We dont have actual text content.
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\n\n\n');
+
+               // Reject removal.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Reject All')
+                       .click();
+
+               writerMobileHelper.selectAllMobile();
+
+               // We get back the content.
+               cy.contains('#copy-paste-container p', 'xxxxxxx')
+                       .should('exist');
+       });
+
+       it('Go to next/prev change.', function() {
+               mobileHelper.openHamburgerMenu();
+
+               // First start recording.
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Record')
+                       .click();
+
+               // First change
+               cy.get('textarea.clipboard')
+                       .type('q');
+
+               // Second change
+               cy.get('textarea.clipboard')
+                       .type('{rightArrow}w');
+
+               // Find second change using prev.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Previous')
+                       .click();
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\nw');
+
+               // Find first change using prev.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Previous')
+                       .click();
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\nq');
+
+               // Find second change using next.
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Track Changes')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Next')
+                       .click();
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\nw');
+       });
+
        it('Search some word.', function() {
+               mobileHelper.openHamburgerMenu();
+
                cy.contains('.menu-entry-with-icon', 'Search')
                        .click();
 
@@ -81,8 +321,6 @@ describe('Trigger hamburger menu options.', function() {
        });
 
        it('Check word counts.', function() {
-               mobileHelper.closeHamburgerMenu();
-
                writerMobileHelper.selectAllMobile();
 
                mobileHelper.openHamburgerMenu();
@@ -118,6 +356,8 @@ describe('Trigger hamburger menu options.', function() {
        });
 
        it('Check version information.', function() {
+               mobileHelper.openHamburgerMenu();
+
                // Open about dialog
                cy.contains('.menu-entry-with-icon', 'About')
                        .click();
commit 08cb112687a833bef32cdd1f3dfa0b47909b873a
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Sat Jun 13 05:41:46 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sat Jun 13 17:49:20 2020 +0200

    cypress: tests for some options in hamburger menu (writer, mobile)
    
    Change-Id: I73e7e6732f51298fa12e194da1f337e99e874d80
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96259
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/data/mobile/writer/hamburger_menu.odt 
b/cypress_test/data/mobile/writer/hamburger_menu.odt
new file mode 100644
index 000000000..bc1afc2f0
Binary files /dev/null and b/cypress_test/data/mobile/writer/hamburger_menu.odt 
differ
diff --git 
a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js 
b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
new file mode 100644
index 000000000..e6523476c
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
@@ -0,0 +1,147 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../../common/helper');
+var mobileHelper = require('../../common/mobile_helper');
+var writerMobileHelper = require('./writer_mobile_helper');
+
+describe('Trigger hamburger menu options.', function() {
+       var testFileName = 'hamburger_menu.odt';
+
+       beforeEach(function() {
+               mobileHelper.beforeAllMobile(testFileName, 'writer');
+
+               // Click on edit button
+               mobileHelper.enableEditingMobile();
+
+               mobileHelper.openHamburgerMenu();
+       });
+
+       afterEach(function() {
+               helper.afterAll(testFileName);
+       });
+
+       it('Search some word.', function() {
+               cy.contains('.menu-entry-with-icon', 'Search')
+                       .click();
+
+               // Search bar become visible
+               cy.get('#toolbar-search')
+                       .should('be.visible');
+
+               // Search for some word
+               cy.get('#search-input')
+                       .type('a');
+
+               // Part of the text should be selected
+               cy.get('.leaflet-marker-icon')
+                       .should('exist');
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\na');
+
+               cy.get('#copy-paste-container p b')
+                       .should('not.exist');
+
+               // Go for the second match
+               cy.get('.w2ui-tb-image.w2ui-icon.next')
+                       .click();
+
+               cy.get('#copy-paste-container p b')
+                       .should('exist');
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\na');
+
+               // Go back to the first match
+               cy.get('.w2ui-tb-image.w2ui-icon.prev')
+                       .click();
+
+               cy.get('#copy-paste-container p b')
+                       .should('not.exist');
+
+               cy.get('#copy-paste-container p')
+                       .should('have.text', '\na');
+
+               // Remove search word
+               cy.get('#search-input')
+                       .should('have.prop', 'value', 'a');
+
+               cy.get('.w2ui-tb-image.w2ui-icon.cancel')
+                       .click();
+
+               cy.get('#search-input')
+                       .should('have.prop', 'value', '');
+
+               // Close search toolbar
+               cy.get('.w2ui-tb-image.w2ui-icon.unfold')
+                       .click();
+
+               cy.get('#toolbar-search')
+                       .should('not.be.visible');
+       });
+
+       it('Check word counts.', function() {
+               mobileHelper.closeHamburgerMenu();
+
+               writerMobileHelper.selectAllMobile();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Word Count...')
+                       .click();
+
+               // Selected counts
+               cy.get('#selectwords')
+                       .should('have.text', '61');
+
+               cy.get('#selectchars')
+                       .should('have.text', '689');
+
+               cy.get('#selectcharsnospaces')
+                       .should('have.text', '629');
+
+               cy.get('#selectcjkchars')
+                       .should('have.text', '0');
+
+               // General counts
+               cy.get('#docwords')
+                       .should('have.text', '61');
+
+               cy.get('#docchars')
+                       .should('have.text', '689');
+
+               cy.get('#doccharsnospaces')
+                       .should('have.text', '629');
+
+               cy.get('#doccjkchars')
+                       .should('have.text', '0');
+       });
+
+       it('Check version information.', function() {
+               // Open about dialog
+               cy.contains('.menu-entry-with-icon', 'About')
+                       .click();
+
+               cy.get('.vex-content')
+                       .should('exist');
+
+               // Check the version
+               if (helper.getLOVersion() === 'master') {
+                       cy.contains('#lokit-version', 'LibreOffice')
+                               .should('exist');
+               } else if (helper.getLOVersion() === 'cp-6-2' ||
+                                  helper.getLOVersion() === 'cp-6-4')
+               {
+                       cy.contains('#lokit-version', 'Collabora Office')
+                               .should('exist');
+               }
+
+               // Close about dialog
+               cy.get('.vex-close')
+                       .click({force : true});
+
+               cy.get('.vex-content')
+                       .should('not.exist');
+       });
+});
+
commit 14c889cbd17a647475834f2be8c864592d6bbb89
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Sat Jun 13 04:31:11 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sat Jun 13 17:49:12 2020 +0200

    cypress: fix wrong image file path.
    
    Change-Id: Ifaaf8eda8f2a05740ef77a4713cfa6b1bbb37614
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96258
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git 
a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js 
b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
index b61d0c0e0..2b3ae2e85 100644
--- a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
@@ -60,7 +60,7 @@ describe('Impress insertion wizard.', function() {
                        .should('be.visible');
 
                cy.get('#insertgraphic[type=file]')
-                       .attachFile('/mobile/writer/image_to_insert.png');
+                       .attachFile('/mobile/impress/image_to_insert.png');
 
                cy.get('.leaflet-pane.leaflet-overlay-pane svg g')
                        .should('exist');
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 f649db16d..df72aef3f 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -38,7 +38,7 @@ describe('Insert objects via insertion wizard.', function() {
                        .should('be.visible');
 
                cy.get('#insertgraphic[type=file]')
-                       .attachFile('/mobile/impress/image_to_insert.png');
+                       .attachFile('/mobile/writer/image_to_insert.png');
 
                cy.get('.leaflet-pane.leaflet-overlay-pane svg g.Graphic')
                        .should('exist');
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to