cypress_test/integration_tests/common/helper.js | 13 cypress_test/integration_tests/desktop/copy_paste_spec.js | 6 cypress_test/integration_tests/desktop/example_desktop_test_spec.js | 9 cypress_test/integration_tests/desktop/shape_operations_spec.js | 7 cypress_test/integration_tests/mobile/apply_font_spec.js | 2 cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js | 2 cypress_test/integration_tests/mobile/bottom_toolbar_spec.js | 239 ++++++++++ cypress_test/integration_tests/mobile/focus_spec.js | 2 cypress_test/integration_tests/mobile/insert_field_spec.js | 2 cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js | 2 cypress_test/integration_tests/mobile/insert_object_spec.js | 2 cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js | 2 cypress_test/integration_tests/mobile/styles_spec.js | 9 cypress_test/integration_tests/mobile/toolbar_spec.js | 2 14 files changed, 280 insertions(+), 19 deletions(-)
New commits: commit 7a140da9c9f554ff073ba59656d15d5ccacc2ea2 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Feb 3 05:37:26 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Feb 3 05:53:22 2020 +0100 cypress: Make this desktop test case more stable. Change-Id: I9aeb6a4c87a2a5a8a0ade320e993ad85ca4c9e82 diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js index 7d1691414..824656bd2 100644 --- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js +++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js @@ -19,7 +19,7 @@ describe('Example test suit 1', function() { cy.get('#tb_editbar_item_bold').click(); // Remove selection and do a reselection - cy.get('#document-container').click(); + cy.get('#document-container').type('{leftarrow}'); cy.get('.leaflet-marker-icon').should('not.be.visible'); cy.get('#document-container').dblclick(); commit 1cfc1c59e9b29ebcd42b4ef8d276a055ca3dcf81 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Feb 3 05:34:25 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Feb 3 05:53:22 2020 +0100 cypress: Check the admin console to make sure the test document is closed. Change-Id: I485e8596a30c7bb1efae140143627078cde66bca diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 631df38b9..6c8163119 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -83,13 +83,16 @@ function copyTextToClipboard() { .should('not.exist'); } -function afterAllMobile() { - cy.visit('http://localhost:9980/loleaflet/' + - Cypress.env('WSD_VERSION_HASH') + - '/loleaflet.html?file_path=file://'); +function afterAll() { + // Make sure that the document is closed + cy.visit('http://admin:admin@localhost:9980/loleaflet/dist/admin/admin.html'); + cy.get('#doclist') + .should('exist'); + cy.get('#doclist tr') + .should('not.exist', {timeout : 10000}); } module.exports.loadTestDoc = loadTestDoc; module.exports.selectAllMobile = selectAllMobile; module.exports.copyTextToClipboard = copyTextToClipboard; -module.exports.afterAllMobile = afterAllMobile; +module.exports.afterAll = afterAll; diff --git a/cypress_test/integration_tests/desktop/copy_paste_spec.js b/cypress_test/integration_tests/desktop/copy_paste_spec.js index 015905d31..4f7ae7461 100644 --- a/cypress_test/integration_tests/desktop/copy_paste_spec.js +++ b/cypress_test/integration_tests/desktop/copy_paste_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require expect*/ +/* global describe it cy beforeEach require expect afterEach*/ var helper = require('../common/helper'); @@ -7,6 +7,10 @@ describe('Clipboard operations.', function() { helper.loadTestDoc('simple.odt'); }); + afterEach(function() { + helper.afterAll(); + }); + it('Copy and Paste text.', function() { // Select some text cy.get('#document-container').dblclick(); diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js index dafad9dad..7d1691414 100644 --- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js +++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js @@ -1,8 +1,13 @@ -/* global describe it cy require*/ +/* global describe it cy require afterEach*/ var helper = require('../common/helper'); describe('Example test suit 1', function() { + + afterEach(function() { + helper.afterAll(); + }); + it('Example test case 1', function() { helper.loadTestDoc('simple.odt'); diff --git a/cypress_test/integration_tests/desktop/shape_operations_spec.js b/cypress_test/integration_tests/desktop/shape_operations_spec.js index afeaf79b3..2abd9fbd6 100644 --- a/cypress_test/integration_tests/desktop/shape_operations_spec.js +++ b/cypress_test/integration_tests/desktop/shape_operations_spec.js @@ -1,8 +1,13 @@ -/* global describe it cy require expect*/ +/* global describe it cy require expect afterEach*/ var helper = require('../common/helper'); describe('Shape operations', function() { + + afterEach(function() { + helper.afterAll(); + }); + it('Insert a simple shape.', function() { helper.loadTestDoc('empty.odt'); diff --git a/cypress_test/integration_tests/mobile/apply_font_spec.js b/cypress_test/integration_tests/mobile/apply_font_spec.js index bbff393f2..13079b835 100644 --- a/cypress_test/integration_tests/mobile/apply_font_spec.js +++ b/cypress_test/integration_tests/mobile/apply_font_spec.js @@ -19,7 +19,7 @@ describe('Apply font changes.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Apply font name.', function() { diff --git a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js index d41964293..3ebcfa3f9 100644 --- a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js +++ b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js @@ -23,7 +23,7 @@ describe('Apply paragraph properties.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Apply left alignment.', function() { diff --git a/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js index 40d089df4..bba37c182 100644 --- a/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js @@ -14,7 +14,7 @@ describe('Pushing bottom toolbar items.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Apply bold.', function() { diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/focus_spec.js index 115632146..dcc713021 100644 --- a/cypress_test/integration_tests/mobile/focus_spec.js +++ b/cypress_test/integration_tests/mobile/focus_spec.js @@ -8,7 +8,7 @@ describe('Focus tests', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Focus after document fully loaded.', function() { diff --git a/cypress_test/integration_tests/mobile/insert_field_spec.js b/cypress_test/integration_tests/mobile/insert_field_spec.js index d1a8cf92a..7d107ed1c 100644 --- a/cypress_test/integration_tests/mobile/insert_field_spec.js +++ b/cypress_test/integration_tests/mobile/insert_field_spec.js @@ -16,7 +16,7 @@ describe('Insert fields via insertion wizard.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Insert page number field.', function() { diff --git a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js index e29756a56..c71b4982e 100644 --- a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js +++ b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js @@ -16,7 +16,7 @@ describe('Insert formatting mark via insertion wizard.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Insert non-breaking space.', function() { diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js index 67b53e3ac..a0a2cafb1 100644 --- a/cypress_test/integration_tests/mobile/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/insert_object_spec.js @@ -16,7 +16,7 @@ describe('Insert objects via insertion wizard.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Insert local image.', function() { diff --git a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js index d1a1bed04..d81f945dc 100644 --- a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js +++ b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js @@ -8,7 +8,7 @@ describe('Mobile wizard state tests', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('Open and close mobile wizard by toolbar item.', function() { diff --git a/cypress_test/integration_tests/mobile/styles_spec.js b/cypress_test/integration_tests/mobile/styles_spec.js index e641d9e82..483ba33cb 100644 --- a/cypress_test/integration_tests/mobile/styles_spec.js +++ b/cypress_test/integration_tests/mobile/styles_spec.js @@ -11,7 +11,7 @@ describe('Apply/modify styles.', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); function applyStyle(styleName) { diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js index 94708277d..3139c66be 100644 --- a/cypress_test/integration_tests/mobile/toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/toolbar_spec.js @@ -8,7 +8,7 @@ describe('Toolbar tests', function() { }); afterEach(function() { - helper.afterAllMobile(); + helper.afterAll(); }); it('State of mobile wizard toolbar item.', function() { commit 40cd54320d952fb01d8ac375da02400df0f28846 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Feb 3 04:36:41 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Feb 3 05:53:13 2020 +0100 cypress: mobile: Add tests for bottom toolbar items. Change-Id: I35aa6231b3a0a16456ce08f1586687b9e73ef50f diff --git a/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js new file mode 100644 index 000000000..40d089df4 --- /dev/null +++ b/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js @@ -0,0 +1,239 @@ +/* global describe it cy beforeEach require afterEach expect*/ + +var helper = require('../common/helper'); + +describe('Pushing bottom toolbar items.', function() { + beforeEach(function() { + helper.loadTestDoc('simple.odt', true); + + // Click on edit button + cy.get('#mobile-edit-button').click(); + + // Do a new selection + helper.selectAllMobile(); + }); + + afterEach(function() { + helper.afterAllMobile(); + }); + + it('Apply bold.', function() { + cy.get('#tb_editbar_item_bold div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_bold') + .click(); + + cy.get('#tb_editbar_item_bold div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p b') + .should('exist'); + }); + + it('Apply italic.', function() { + cy.get('#tb_editbar_item_italic div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_italic') + .click(); + + cy.get('#tb_editbar_item_italic div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p i') + .should('exist'); + }); + + it('Apply underline.', function() { + cy.get('#tb_editbar_item_underline div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_underline') + .click(); + + cy.get('#tb_editbar_item_underline div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p u') + .should('exist'); + }); + + it('Apply strikeout.', function() { + cy.get('#tb_editbar_item_strikeout div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_strikeout') + .click(); + + cy.get('#tb_editbar_item_strikeout div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p strike') + .should('exist'); + }); + + it('Apply text color.', function() { + cy.get('#tb_editbar_item_fontcolor') + .click(); + + cy.get('#color-picker-0-basic-color-7') + .click(); + + cy.get('#color-picker-0-tint-3') + .click(); + + cy.get('.w2ui-tb-image.w2ui-icon.textcolor') + .should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(0, 0, 255) 0px -6px inset;'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p font') + .should('have.attr', 'color', '#0000ff'); + }); + + it('Apply highlight color.', function() { + cy.get('#tb_editbar_item_backcolor') + .click(); + + cy.get('#color-picker-0-basic-color-9') + .click(); + + cy.get('#color-picker-0-tint-3') + .click(); + + cy.get('.w2ui-tb-image.w2ui-icon.backcolor') + .should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(255, 0, 255) 0px -6px inset;'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p font span') + .should('have.attr', 'style', 'background: #ff00ff'); + }); + + it('Apply left / right paragraph alignment.', function() { + cy.get('#tb_editbar_item_rightpara div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_rightpara') + .click(); + + cy.get('#tb_editbar_item_rightpara div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'right'); + + cy.get('#tb_editbar_item_leftpara div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_leftpara') + .click(); + + cy.get('#tb_editbar_item_leftpara div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'left'); + }); + + it('Apply center paragraph alignment.', function() { + cy.get('#tb_editbar_item_centerpara div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_centerpara') + .click(); + + cy.get('#tb_editbar_item_centerpara div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'center'); + }); + + it('Apply justify paragraph alignment.', function() { + cy.get('#tb_editbar_item_justifypara div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_justifypara') + .click(); + + cy.get('#tb_editbar_item_justifypara div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'justify'); + }); + + it('Apply default numbering.', function() { + cy.get('#tb_editbar_item_defaultnumbering div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_defaultnumbering') + .click(); + + cy.get('#tb_editbar_item_defaultnumbering div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container ol li p') + .should('exist'); + }); + + it('Apply default bulleting.', function() { + cy.get('#tb_editbar_item_defaultbullet div table') + .should('not.have.class', 'checked'); + + cy.get('#tb_editbar_item_defaultbullet') + .click(); + + cy.get('#tb_editbar_item_defaultbullet div table') + .should('have.class', 'checked'); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container ul li p') + .should('exist'); + }); + + it('Increase / decrease indent.', function() { + cy.get('#tb_editbar_item_incrementindent') + .click().click(); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-left']).to.be.equal('0.98in'); + }); + + cy.get('#tb_editbar_item_decrementindent') + .click(); + + helper.copyTextToClipboard(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-left']).to.be.equal('0.49in'); + }); + }); +}); commit 978213a12da1826f4111cbb45bda3439873f9224 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Feb 3 04:07:51 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Feb 3 05:53:06 2020 +0100 cypress: mobile: Add a small wait time for style applying code. The sidebar / mobile wizard is rerendered randomly sometimes which caused this test to fail. Change-Id: I4d95cb783ca92a81ea2f6fcdc4e87efaa6747e0a diff --git a/cypress_test/integration_tests/mobile/styles_spec.js b/cypress_test/integration_tests/mobile/styles_spec.js index 7a5016bde..e641d9e82 100644 --- a/cypress_test/integration_tests/mobile/styles_spec.js +++ b/cypress_test/integration_tests/mobile/styles_spec.js @@ -34,7 +34,12 @@ describe('Apply/modify styles.', function() { cy.get('.mobile-wizard.ui-combobox-text') .contains(styleName) - .scrollIntoView() + .scrollIntoView(); + + cy.wait(200); + + cy.get('.mobile-wizard.ui-combobox-text') + .contains(styleName) .click(); // Combobox entry contains the selected font name _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits