cypress_test/data/mobile/calc/hamburger_menu_sort.ods             |binary
 cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js  |   20 +++
 cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js |   60 
+++++++++-
 3 files changed, 79 insertions(+), 1 deletion(-)

New commits:
commit cb1b1f6b9a87726c9ed5b100fcd6f524746a170d
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Jul 3 17:41:32 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Fri Jul 3 20:28:30 2020 +0200

    cypress: test for Data / Sorting in calc (mobile).
    
    Change-Id: I3139e5153e209504f19877cf24a9f11bf25bedf8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97886
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/data/mobile/calc/hamburger_menu_sort.ods 
b/cypress_test/data/mobile/calc/hamburger_menu_sort.ods
new file mode 100644
index 000000000..581194eb4
Binary files /dev/null and 
b/cypress_test/data/mobile/calc/hamburger_menu_sort.ods differ
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 8e3298901..85d888e11 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js
@@ -67,6 +67,26 @@ function selectFirstRow() {
                .should('have.prop', 'value', 'A1:AMJ1');
 }
 
+function selectFirstColumn() {
+       cy.get('.spreadsheet-header-columns')
+               .then(function(items) {
+                       expect(items).to.have.lengthOf(1);
+
+                       var XPos = items[0].getBoundingClientRect().left + 10;
+                       var YPos = (items[0].getBoundingClientRect().top + 
items[0].getBoundingClientRect().bottom) / 2;
+                       cy.get('body')
+                               .click(XPos, YPos);
+               });
+
+       cy.get('.spreadsheet-cell-resize-marker')
+               .invoke('attr', 'style')
+               .should('contain', '-8px,');
+
+       cy.get('input#addressInput')
+               .should('have.prop', 'value', 'A1:A1048576');
+}
+
 module.exports.removeTextSelection = removeTextSelection;
 module.exports.selectAllMobile = selectAllMobile;
 module.exports.selectFirstRow = selectFirstRow;
+module.exports.selectFirstColumn = selectFirstColumn;
diff --git a/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js 
b/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
index 81b239682..f3a75861f 100644
--- a/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
@@ -1,4 +1,4 @@
-/* global describe it cy require afterEach */
+/* global describe it cy require afterEach expect */
 
 var helper = require('../../common/helper');
 var calcHelper = require('../../common/calc_helper');
@@ -374,6 +374,64 @@ describe('Trigger hamburger menu options.', function() {
                        .should('not.be.visible');
        });
 
+       it('Data: sort ascending.', function() {
+               before('hamburger_menu_sort.ods');
+
+               // Sort the first column's data
+               calcMobileHelper.selectFirstColumn();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Data')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Sort Ascending')
+                       .click();
+
+               calcMobileHelper.selectAllMobile(false);
+
+               cy.get('#copy-paste-container table tr')
+                       .should('have.length', 4);
+
+               cy.get('#copy-paste-container table td')
+                       .should(function(cells) {
+                               expect(cells).to.have.lengthOf(4);
+                               expect(cells[0]).to.have.text('1');
+                               expect(cells[1]).to.have.text('2');
+                               expect(cells[2]).to.have.text('3');
+                               expect(cells[3]).to.have.text('4');
+                       });
+       });
+
+       it('Data: sort descending.', function() {
+               before('hamburger_menu_sort.ods');
+
+               // Sort the first column's data
+               calcMobileHelper.selectFirstColumn();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Data')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Sort Descending')
+                       .click();
+
+               calcMobileHelper.selectAllMobile(false);
+
+               cy.get('#copy-paste-container table tr')
+                       .should('have.length', 4);
+
+               cy.get('#copy-paste-container table td')
+                       .should(function(cells) {
+                               expect(cells).to.have.lengthOf(4);
+                               expect(cells[0]).to.have.text('4');
+                               expect(cells[1]).to.have.text('3');
+                               expect(cells[2]).to.have.text('2');
+                               expect(cells[3]).to.have.text('1');
+                       });
+       });
+
        it('Check version information.', function() {
                before('hamburger_menu.ods');
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to