summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-07-03 17:41:32 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-07-03 20:28:30 +0200
commitcb1b1f6b9a87726c9ed5b100fcd6f524746a170d (patch)
tree4f753db8e10e92a756c60f247a0324f79f749106
parentleaflet: allow download as odg in readonly mode(view mdoe) (diff)
downloadonline-cb1b1f6b9a87726c9ed5b100fcd6f524746a170d.tar.gz
online-cb1b1f6b9a87726c9ed5b100fcd6f524746a170d.zip
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--cypress_test/data/mobile/calc/hamburger_menu_sort.odsbin0 -> 7755 bytes
-rw-r--r--cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js20
-rw-r--r--cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js60
3 files changed, 79 insertions, 1 deletions
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 0000000000..581194eb48
--- /dev/null
+++ b/cypress_test/data/mobile/calc/hamburger_menu_sort.ods
Binary files 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 8e3298901c..85d888e11c 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 81b2396823..f3a75861f3 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');