[Libreoffice-commits] online.git: Branch 'feature/cypress_integration' - 3 commits - cypress_test/integration_tests cypress_test/package.json cypress_test/README

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 13 20:12:10 UTC 2020


 cypress_test/README                                                  |   27 +-
 cypress_test/integration_tests/desktop/example_desktop_test_spec.js  |    4 
 cypress_test/integration_tests/desktop/example_desktop_test_spec2.js |    4 
 cypress_test/integration_tests/mobile/toolbar_spec.js                |   99 +++++++++-
 cypress_test/package.json                                            |    4 
 5 files changed, 122 insertions(+), 16 deletions(-)

New commits:
commit e4d13f2a188bbd42c82018ab0cf175f9d20ec698
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 21:01:01 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Jan 13 21:08:41 2020 +0100

    cypress: mobile: Add some tests about pushing toolbar items.
    
    Change-Id: I2b40dbee18fa04fbece4f4da0630e3ac619e0968

diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 24838aeb8..83851f976 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -95,4 +95,99 @@ describe('Toolbar tests', function() {
     cy.get('#tb_actionbar_item_redo')
       .should('not.have.class', 'disabled')
   })
+
+  it('Open and close mobile wizard by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on mobile wizard toolbar item
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+
+    // Toolbar button is checked
+    cy.get('#tb_actionbar_item_mobile_wizard table')
+      .should('have.class', 'checked')
+
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .click()
+
+    // Mobile wizard is closed
+    cy.get('#mobile_wizard')
+      .should('not.be.visible');
+
+    cy.get('#tb_actionbar_item_mobile_wizard table')
+      .should('not.have.class', 'checked')
+
+    // Open mobile wizard again
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    // TODO: fix this bug
+    /*cy.get('#mobile-wizard-content')
+      .should('not.be.empty'); */
+  })
+
+  it('Open and close insertion mobile wizard by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on toolbar item
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+
+    // Toolbar button is checked
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+      .should('have.class', 'checked')
+
+    // Click on toolbar item again
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .click()
+
+    // Mobile wizard is closed
+    cy.get('#mobile_wizard')
+      .should('not.be.visible');
+
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+      .should('not.have.class', 'checked')
+
+    // Open mobile wizard again
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+  })
+
+  it('Open insert comment dialog by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on toolbar item
+    cy.get('#tb_actionbar_item_insertcomment')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Comment insertion dialog is opened
+    cy.get('.loleaflet-annotation-table')
+      .should('be.visible');
+
+    // Close the dialog
+    cy.contains('Cancel')
+      .click()
+
+    cy.get('.loleaflet-annotation-table')
+      .should('be.not.visible');
+  })
 })
commit 0b72f9e81f2084fd225522913e1ea9826b75479f
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 20:20:30 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Jan 13 21:08:35 2020 +0100

    cypress: Update README about test execution.
    
    Change-Id: I6c7b7fd8c77f89289630a06f9dbaf94ae5082aa8

diff --git a/cypress_test/README b/cypress_test/README
index aebd3fa34..efeb6e10a 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -5,38 +5,49 @@ Running tests
 ------------------
 
 All tests are part of the make check build. So you can
-just execute it in the top folder.
+just execute it from the root folder of online repository.
 
     make check
 
 To run only cypress test cases, you need to start loolwsd
-server first and then run the given cyrun command.
+server first. To do that you can call make run on a separate
+command line window, so LibreOffice online is started.
+
+After the server is running you can execute the test,
+calling the given run command. You need to run the
+command under cypress_test\ folder.
+
 To run all cypress tests:
 
-    make run &
-    cd cypress
     npm run cyrun
 
 To run all desktop tests:
 
-    cd cypress
     npm run cyrun_desktop
 
 To run all mobile tests:
 
-    cd cypress
     npm run cyrun_mobile
 
+To run one specific test suit of desktop tests:
+
+    npm run cyrun_desktop --spec example_desktop_test_spec.js
+
+To run one specific test suit of mobile tests:
+
+    npm run cyrun_mobile --spec toolbar_spec.js
+
 You can also open cypress tests in the browser, so you can
 check what happens during test run. It's useful for writing
 new tests or checking why an existing test fails.
 
 To open desktop tests in browser:
 
-    cd cypress
     npm run cyopen_desktop
 
 To open mobile tests in browser:
 
-    cd cypress
     npm run cyopen_mobile
+
+During the build we run the tests with Chrome browser, so make sure
+you select Chrome browser on the GUI while checking tests.
diff --git a/cypress_test/package.json b/cypress_test/package.json
index 6f7d05a17..a9d281112 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -14,7 +14,7 @@
     "cyrun": "npm run cyrun_desktop && npm run cyrun_mobile",
     "cyrun_desktop": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/desktop --headless",
     "cyrun_mobile": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\" --headless",
-    "cyopen_desktop": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/desktop",
-    "cyopen_mobile": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
+    "cyopen_desktop": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/desktop",
+    "cyopen_mobile": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
   }
 }
commit d8514dad27d22e8484b488a7736f974212acdcba
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 20:08:38 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Jan 13 20:08:38 2020 +0100

    cypress: Added a better wait method for document load.
    
    Change-Id: I482df38159009f5583ad7ed9f676e09a350bb0a8

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 c5b1ab1b0..68d6b4f18 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -3,8 +3,8 @@ describe('Example test suit 1', function() {
     // Open test documnt
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
 
     // Select a text
     cy.get('#document-container').dblclick()
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index 6b2c9b9bd..fde36a757 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -3,8 +3,8 @@ describe('Example test suit 2', function() {
     // Open test documnt
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
 
     // Select a text
     cy.get('#document-container').dblclick()
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 36982f3ee..24838aeb8 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -4,8 +4,8 @@ describe('Toolbar tests', function() {
     cy.viewport('iphone-3')
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
   });
 
   it('State of mobile wizard toolbar item.', function() {


More information about the Libreoffice-commits mailing list