[Libreoffice-commits] online.git: 2 commits - cypress_test/integration_tests cypress_test/README
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Sun Feb 2 12:03:49 UTC 2020
cypress_test/README | 26 ++-
cypress_test/integration_tests/mobile/styles_spec.js | 146 +++++++++++++++++++
2 files changed, 169 insertions(+), 3 deletions(-)
New commits:
commit 8ce8a90a37d61d3d5df7bbd7e7e10ea620c8570f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jan 31 20:12:20 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sun Feb 2 12:23:18 2020 +0100
cypress: mobile: Add some test about styles.
Change-Id: Ie61f5bd2a5203d501db60fc6f75e878c728d3a96
diff --git a/cypress_test/integration_tests/mobile/styles_spec.js b/cypress_test/integration_tests/mobile/styles_spec.js
new file mode 100644
index 000000000..7a5016bde
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/styles_spec.js
@@ -0,0 +1,146 @@
+/* global describe it cy beforeEach require afterEach*/
+
+var helper = require('../common/helper');
+
+describe('Apply/modify styles.', function() {
+ beforeEach(function() {
+ helper.loadTestDoc('simple.odt', true);
+
+ // Click on edit button
+ cy.get('#mobile-edit-button').click();
+ });
+
+ afterEach(function() {
+ helper.afterAllMobile();
+ });
+
+ function applyStyle(styleName) {
+ // Do a new selection
+ helper.selectAllMobile();
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ // Change font name
+ cy.get('#applystyle')
+ .click();
+
+ cy.wait(200);
+
+ cy.get('#mobile-wizard-back')
+ .should('be.visible');
+
+ cy.get('.mobile-wizard.ui-combobox-text')
+ .contains(styleName)
+ .scrollIntoView()
+ .click();
+
+ // Combobox entry contains the selected font name
+ if (styleName === 'Clear formatting') {
+ cy.get('#applystyle .ui-header-right .entry-value')
+ .contains('Default Style');
+ } else {
+ cy.get('#applystyle .ui-header-right .entry-value')
+ .contains(styleName);
+ }
+
+ // Close mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+ }
+
+ it('Apply new style.', function() {
+ // Apply Title style
+ applyStyle('Title');
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p font')
+ .should('have.attr', 'face', 'Liberation Sans, sans-serif');
+ cy.get('#copy-paste-container p font font')
+ .should('have.attr', 'style', 'font-size: 28pt');
+ });
+
+ it('Clear style.', function() {
+ // Apply Title style
+ applyStyle('Title');
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p font')
+ .should('have.attr', 'face', 'Liberation Sans, sans-serif');
+ cy.get('#copy-paste-container p font font')
+ .should('have.attr', 'style', 'font-size: 28pt');
+
+ // Clear formatting
+ applyStyle('Clear formatting');
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p')
+ .should('have.attr', 'style', 'margin-bottom: 0in; line-height: 100%');
+ });
+
+ it('Modify existing style.', function() {
+ // Apply Title style
+ applyStyle('Title');
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p font')
+ .should('have.attr', 'face', 'Liberation Sans, sans-serif');
+ cy.get('#copy-paste-container p font font')
+ .should('have.attr', 'style', 'font-size: 28pt');
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ // Apply italic
+ cy.get('#Italic')
+ .click();
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p i')
+ .should('exist');
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ cy.get('#StyleUpdateByExample')
+ .click();
+
+ // Clear formatting
+ applyStyle('Clear formatting');
+
+ // Apply Title style with italic font
+ applyStyle('Title');
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p i')
+ .should('exist');
+ });
+
+ it('Add new style.', function() {
+ // Do a new selection
+ helper.selectAllMobile();
+
+ // Open mobile wizard
+ cy.get('#tb_actionbar_item_mobile_wizard')
+ .click();
+
+ cy.get('#StyleNewByExample')
+ .click();
+
+ // We have a dialog here?!
+ cy.get('.lokdialog_canvas')
+ .should('exist');
+ });
+});
commit 17803d5713313423b0ecaf7a2acfaf6c60829a3a
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jan 31 16:03:18 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sun Feb 2 12:23:18 2020 +0100
cypress: README: Add an example for it.only() usage.
Change-Id: I042b0f1bf05942b98bcd255f7bdf0241cfc3bfdd
diff --git a/cypress_test/README b/cypress_test/README
index 8bec5d253..79d236a47 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -1,6 +1,8 @@
Cypress based test framework for LibreOffice Online
====================================================
+
+
Installation
------------------
In a normal desktop environment you only need to install npm
@@ -11,6 +13,7 @@ https://docs.cypress.io/guides/getting-started/installing-cypress.html#npm-insta
For CI you might need to install some additional dependencies:
https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies
+
Running tests
------------------
@@ -40,12 +43,29 @@ To run one specific test suit of mobile tests:
make check-mobile spec=toolbar_spec.js
+
+Running one specific test
+------------------
+
To run one test case of a test suit you can use Mocha's
'only' feature. Just replace the it(...) function with
it.only(...) in the spec file for the selected test case
-and run the test suit using the spec parameter (see above).
-This 'only' feature affects both make check and make run
-commands.
+and run the test suit using the spec parameter.
+
+For example, to run the test with title 'Apply font name.'
+inside apply_font_spec.js file, you need to add it.only():
+
+- it('Apply font name.', function() {
++ it.only('Apply font name.', function() {
+
+Then run the test suit with:
+
+ make check-mobile spec=apply_font_spec.js
+
+Or open the file in the interactive test runner.
+
+ make run-mobile
+
Openning interactive test runner
----------------------------------
More information about the Libreoffice-commits
mailing list