cypress_test/cypress.json                                              |    3 -
 cypress_test/data/mobile/calc/image_to_insert.png                      |binary
 cypress_test/data/mobile/impress/image_to_insert.png                   |binary
 cypress_test/data/mobile/writer/image_to_insert.png                    |binary
 cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js    |   24 
++++++++--
 cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js |   10 
++--
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js     |    9 
++-
 cypress_test/package.json                                              |    1 
 cypress_test/support/index.js                                          |    1 
 9 files changed, 39 insertions(+), 9 deletions(-)

New commits:
commit 71f2d7b95d32113c487b2a71cde5254a0c70f55e
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Jun 12 17:38:33 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Fri Jun 12 18:55:56 2020 +0200

    cypress: test insertion of local images.
    
    Adding a file for insertion from cypress code
    is not trivial. I added cypress-file-upload package
    which can be used for this.
    
    Change-Id: Ife7da586d1d87c2c4580730af29857c1d0d91750
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96232
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/cypress.json b/cypress_test/cypress.json
index f8f277eb2..2510a6094 100644
--- a/cypress_test/cypress.json
+++ b/cypress_test/cypress.json
@@ -4,5 +4,6 @@
     "pluginsFile" : "plugins/index.js",
     "defaultCommandTimeout" : 6000,
     "ignoreTestFiles" : "*helper.js",
-    "modifyObstructiveCode": false
+    "modifyObstructiveCode": false,
+    "fixturesFolder" : "data"
 }
diff --git a/cypress_test/data/mobile/calc/image_to_insert.png 
b/cypress_test/data/mobile/calc/image_to_insert.png
new file mode 100644
index 000000000..5449e368b
Binary files /dev/null and b/cypress_test/data/mobile/calc/image_to_insert.png 
differ
diff --git a/cypress_test/data/mobile/impress/image_to_insert.png 
b/cypress_test/data/mobile/impress/image_to_insert.png
new file mode 100644
index 000000000..5449e368b
Binary files /dev/null and 
b/cypress_test/data/mobile/impress/image_to_insert.png differ
diff --git a/cypress_test/data/mobile/writer/image_to_insert.png 
b/cypress_test/data/mobile/writer/image_to_insert.png
new file mode 100644
index 000000000..5449e368b
Binary files /dev/null and 
b/cypress_test/data/mobile/writer/image_to_insert.png differ
diff --git 
a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js 
b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
index 7c0c2ebf7..e4dfbb142 100644
--- a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js
@@ -26,12 +26,30 @@ describe('Calc insertion wizard.', function() {
                helper.afterAll(testFileName);
        });
 
-       it('Check existence of image insertion items.', function() {
+       it('Inset local image.', function() {
+               // We can't use the menu item directly, because it would open 
file picker.
                cy.contains('.menu-entry-with-icon', 'Local Image...')
                        .should('be.visible');
 
-               cy.contains('.menu-entry-with-icon', 'Image...')
-                       .should('be.visible');
+               cy.get('#insertgraphic[type=file]')
+                       .attachFile('/mobile/calc/image_to_insert.png');
+
+               // Could not find a good indicator here, because the inserted 
image
+               // is not selected after insertion.
+               cy.wait(1000);
+
+               // Select image
+               cy.get('.spreadsheet-cell-resize-marker:nth-of-type(2)')
+                       .then(function(items) {
+                               expect(items).to.have.lengthOf(1);
+                               var XPos = 
items[0].getBoundingClientRect().right + 10;
+                               var YPos = items[0].getBoundingClientRect().top;
+                               cy.get('body')
+                                       .click(XPos, YPos);
+                       });
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane svg g.Graphic')
+                       .should('exist');
        });
 
        it('Insert chart.', function() {
diff --git 
a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js 
b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
index 3a20c0ec1..b61d0c0e0 100644
--- a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
@@ -52,14 +52,18 @@ describe('Impress insertion wizard.', function() {
                        .should('exist');
        }
 
-       it('Check existence of image insertion items.', function() {
+       it('Insert local image.', function() {
                mobileHelper.openInsertionWizard();
 
+               // We can't use the menu item directly, because it would open 
file picker.
                cy.contains('.menu-entry-with-icon', 'Local Image...')
                        .should('be.visible');
 
-               cy.contains('.menu-entry-with-icon', 'Image...')
-                       .should('be.visible');
+               cy.get('#insertgraphic[type=file]')
+                       .attachFile('/mobile/writer/image_to_insert.png');
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane svg g')
+                       .should('exist');
        });
 
        it('Insert comment.', function() {
diff --git a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js 
b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
index 3267c1796..f649db16d 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -33,10 +33,15 @@ describe('Insert objects via insertion wizard.', function() 
{
        it('Insert local image.', function() {
                mobileHelper.openInsertionWizard();
 
-               // We check whether the entry is there
+               // We can't use the menu item directly, because it would open 
file picker.
                cy.contains('.menu-entry-with-icon', 'Local Image...')
                        .should('be.visible');
-               // We not not test the insertion, it might depend on the system.
+
+               cy.get('#insertgraphic[type=file]')
+                       .attachFile('/mobile/impress/image_to_insert.png');
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane svg g.Graphic')
+                       .should('exist');
        });
 
        it('Insert comment.', function() {
diff --git a/cypress_test/package.json b/cypress_test/package.json
index 55b4d799d..42d0f63c6 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -6,6 +6,7 @@
   "dependencies": {
     "cypress": "4.5.0",
     "cypress-failed-log": "2.6.2",
+    "cypress-file-upload": "4.0.7",
     "cypress-select-tests": "1.5.7",
     "eslint": "6.8.0",
     "eslint-plugin-cypress-rules": "file:eslint_plugin",
diff --git a/cypress_test/support/index.js b/cypress_test/support/index.js
index 8f683db34..453ced414 100644
--- a/cypress_test/support/index.js
+++ b/cypress_test/support/index.js
@@ -1,3 +1,4 @@
 /* global require */
 
 require('cypress-failed-log');
+require('cypress-file-upload');
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to