[Libreoffice-commits] online.git: cypress_test/data cypress_test/integration_tests cypress_test/Makefile.am
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 31 11:30:23 UTC 2020
cypress_test/Makefile.am | 1
cypress_test/data/mobile/calc/number_format.ods |binary
cypress_test/integration_tests/mobile/calc/calc_helper.js | 6
cypress_test/integration_tests/mobile/calc/number_format_spec.js | 385 ++++++++++
4 files changed, 389 insertions(+), 3 deletions(-)
New commits:
commit ab10cc1c833746af3af8280121e8b51722bc525f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Mar 31 12:25:17 2020 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Mar 31 13:30:04 2020 +0200
cypress: mobile: number formatting tests in Calc.
Change-Id: I07b919f4bc06f5f368c23b5fed014cb5011c8e68
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91411
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 3752180fd..a5a2f30ef 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -36,6 +36,7 @@ MOBILE_TEST_FILES= \
calc/apply_font_spec.js \
calc/focus_spec.js \
calc/insertion_wizard_spec.js \
+ calc/number_format_spec.js \
calc/spellchecking_spec.js \
impress/impress_focus_spec.js \
impress/spellchecking_spec.js \
diff --git a/cypress_test/data/mobile/calc/number_format.ods b/cypress_test/data/mobile/calc/number_format.ods
new file mode 100644
index 000000000..bf5e6ca69
Binary files /dev/null and b/cypress_test/data/mobile/calc/number_format.ods differ
diff --git a/cypress_test/integration_tests/mobile/calc/calc_helper.js b/cypress_test/integration_tests/mobile/calc/calc_helper.js
index 5a796cc4d..1ba4da22d 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_helper.js
@@ -46,10 +46,10 @@ function copyContentToClipboard() {
}
function selectAllMobile() {
- cy.get('body')
- .type('{enter}');
+ cy.get('.spreadsheet-header-columns')
+ .click();
- cy.get('.leaflet-marker-icon')
+ cy.get('.spreadsheet-cell-resize-marker')
.should('exist');
cy.get('#spreadsheet-header-corner')
diff --git a/cypress_test/integration_tests/mobile/calc/number_format_spec.js b/cypress_test/integration_tests/mobile/calc/number_format_spec.js
new file mode 100644
index 000000000..2522942ec
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/calc/number_format_spec.js
@@ -0,0 +1,385 @@
+/* global describe it cy beforeEach require afterEach*/
+
+var helper = require('../../common/helper');
+var calcHelper = require('./calc_helper');
+
+describe('Apply number formatting.', function() {
+ beforeEach(function() {
+ helper.beforeAllMobile('number_format.ods', 'calc');
+
+ // Click on edit button
+ helper.enableEditingMobile();
+
+ calcHelper.clickOnFirstCell();
+
+ cy.get('.leaflet-marker-icon')
+ .should('be.visible');
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+ cy.get('#mobile-wizard-content')
+ .should('not.be.empty');
+
+ // Open character properties
+ cy.get('#ScNumberFormatPropertyPanel')
+ .click();
+
+ cy.get('#NumberFormatCurrency')
+ .should('be.visible')
+ .wait(100);
+ });
+
+ afterEach(function() {
+ helper.afterAll('number_format.ods');
+ });
+
+ function selectFormatting(formattingString) {
+ // Select formatting list
+ cy.get('#category')
+ .click();
+
+ cy.get('.mobile-wizard.ui-combobox-text')
+ .contains(formattingString)
+ .click();
+
+ // Combobox entry contains the selected format
+ cy.get('#category .ui-header-left')
+ .should('have.text', formattingString);
+ }
+
+ it('Select percent format from list.', function() {
+ selectFormatting('Percent');
+
+ cy.get('#NumberFormatPercentimg')
+ .should('have.class', 'selected');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;0.00%');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '100000.00%');
+ });
+
+ it('Select percent icon.', function() {
+ // Change to percent
+ cy.get('#NumberFormatPercent')
+ .click();
+
+ cy.get('#NumberFormatPercentimg')
+ .should('have.class', 'selected');
+
+ // TODO: combobox entry is not updated
+ //cy.get('#category .ui-header-left')
+ // .should('have.text', 'Percent');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;0.00%');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '100000.00%');
+ });
+
+ it('Select currency format from list.', function() {
+ selectFormatting('Currency');
+
+ cy.get('#NumberFormatCurrencyimg')
+ .should('have.class', 'selected');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '$1,000.00');
+ });
+
+ it('Select currency icon.', function() {
+ // Change to currency
+ cy.get('#NumberFormatCurrency')
+ .click();
+
+ cy.get('#NumberFormatCurrencyimg')
+ .should('have.class', 'selected');
+
+ // TODO: combobox entry is not updated
+ //cy.get('#category .ui-header-left')
+ // .should('have.text', 'Currency');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '$1,000.00');
+ });
+
+ it('Select number icon.', function() {
+ // Change to currency first
+ cy.get('#NumberFormatCurrency')
+ .click();
+
+ cy.get('#NumberFormatCurrencyimg')
+ .should('have.class', 'selected');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '$1,000.00');
+
+ calcHelper.clickOnFirstCell();
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+ cy.get('#mobile-wizard-content')
+ .should('not.be.empty');
+
+ // Open character properties
+ cy.get('#ScNumberFormatPropertyPanel')
+ .click();
+
+ cy.get('#NumberFormatDecimal')
+ .should('be.visible')
+ .wait(100);
+
+ // Change to number formatting
+ cy.get('#NumberFormatDecimal')
+ .click();
+
+ // TODO: this state is missing here
+ //cy.get('#NumberFormatDecimalimg')
+ // .should('have.class', 'selected');
+
+ // TODO: combobox entry is not updated
+ //cy.get('#category .ui-header-left')
+ // .should('have.text', 'Number');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '1,000.00');
+ });
+
+ it('Select date format from list.', function() {
+ // Change to date
+ cy.get('#category')
+ .click();
+
+ cy.get('.mobile-wizard.ui-combobox-text')
+ .contains('Date')
+ .click();
+
+ // Combobox entry contains the selected format
+ cy.get('#category .ui-header-left')
+ .should('have.text', 'Date ');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '0');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '0');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;MM/DD/YY');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdval', '1000');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '09/26/02');
+ });
+
+ it('Select time format from list.', function() {
+ selectFormatting('Time');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '0');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '0');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;HH:MM:SS AM/PM');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdval', '1000');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '12:00:00 AM');
+ });
+
+ it('Select scientific format from list.', function() {
+ selectFormatting('Scientific');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '2');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '1');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;0.00E+00');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '1.00E+03');
+ });
+
+ it('Select fraction format from list.', function() {
+ selectFormatting('Fraction');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '1');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '0');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;# ?/?');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '1000 ');
+ });
+
+ it('Select boolean format from list.', function() {
+ selectFormatting('Boolean Value');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '0');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '0');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;BOOLEAN');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', 'TRUE');
+ });
+
+ it('Select text format from list.', function() {
+ selectFormatting('Text');
+
+ // Decimal and leading zeros are changed.
+ cy.get('#decimalplaces input')
+ .should('have.attr', 'value', '0');
+
+ cy.get('#leadingzeroes input')
+ .should('have.attr', 'value', '0');
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ calcHelper.copyContentToClipboard();
+
+ cy.get('#copy-paste-container table td')
+ .should('have.attr', 'sdnum', '1033;0;@');
+
+ cy.get('#copy-paste-container table td')
+ .should('have.text', '1000');
+ });
+});
\ No newline at end of file
More information about the Libreoffice-commits
mailing list