cypress_test/data/mobile/impress/hamburger_menu.odp                         
|binary
 cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js            |  
  5 
 cypress_test/integration_tests/mobile/impress/apply_font_spec.js            |  
  1 
 cypress_test/integration_tests/mobile/impress/apply_paragraph_props_spec.js |  
  1 
 cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js        |  
363 ++++++++++
 cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js      |  
  3 
 6 files changed, 370 insertions(+), 3 deletions(-)

New commits:
commit d15e0dea8eaa9a2bb1cab379f2d85bbbc0026b7d
Author:     Tamás Zolnai <[email protected]>
AuthorDate: Thu Jul 9 14:09:39 2020 +0200
Commit:     Tamás Zolnai <[email protected]>
CommitDate: Thu Jul 9 15:34:55 2020 +0200

    cypress: fix removeTextSelection() helper method.
    
    Change-Id: If0b254eca495b57c8697ad17a53d0f7e952c6fba
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98430
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tamás Zolnai <[email protected]>

diff --git a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js 
b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js
index 229c0be18..e26a84a95 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js
@@ -20,6 +20,11 @@ function removeTextSelection() {
                cy.get('.spreadsheet-cell-resize-marker')
                        .invoke('attr', 'style')
                        .should('contain', '-8px,');
+
+               var regex = /[A-Z]1:[A-Z]1048576/;
+               cy.get('input#addressInput')
+                       .should('have.prop', 'value')
+                       .should('match', regex);
        }
 
        cy.log('Removing text selection - end.');
commit fb316d601e84b608a01f3c77572c5a6eb710923a
Author:     Tamás Zolnai <[email protected]>
AuthorDate: Thu Jul 9 11:56:43 2020 +0200
Commit:     Tamás Zolnai <[email protected]>
CommitDate: Thu Jul 9 15:34:42 2020 +0200

    cypress: add some tests for impress's hamburger menu (mobile).
    
    Change-Id: Idc747ac6ebb47b2ec2da086ba7e597d3bc396bf1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98427
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tamás Zolnai <[email protected]>

diff --git a/cypress_test/data/mobile/impress/hamburger_menu.odp 
b/cypress_test/data/mobile/impress/hamburger_menu.odp
new file mode 100644
index 000000000..8907786e3
Binary files /dev/null and 
b/cypress_test/data/mobile/impress/hamburger_menu.odp differ
diff --git a/cypress_test/integration_tests/mobile/impress/apply_font_spec.js 
b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
index 71c91b3be..388b32a54 100644
--- a/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
@@ -20,6 +20,7 @@ describe('Apply font on text and on text shape.', function() {
        });
 
        function triggerNewSVG() {
+               mobileHelper.closeMobileWizard();
                impressMobileHelper.triggerNewSVGForShapeInTheCenter();
        }
 
diff --git 
a/cypress_test/integration_tests/mobile/impress/apply_paragraph_props_spec.js 
b/cypress_test/integration_tests/mobile/impress/apply_paragraph_props_spec.js
index a49551dd2..b6539f2d2 100644
--- 
a/cypress_test/integration_tests/mobile/impress/apply_paragraph_props_spec.js
+++ 
b/cypress_test/integration_tests/mobile/impress/apply_paragraph_props_spec.js
@@ -20,6 +20,7 @@ describe('Apply paragraph properties.', function() {
        });
 
        function triggerNewSVG() {
+               mobileHelper.closeMobileWizard();
                impressMobileHelper.triggerNewSVGForShapeInTheCenter();
        }
 
diff --git 
a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js 
b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
new file mode 100644
index 000000000..8f870fe83
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
@@ -0,0 +1,363 @@
+/* global describe it cy require afterEach expect */
+
+var helper = require('../../common/helper');
+var mobileHelper = require('../../common/mobile_helper');
+var impressMobileHelper = require('./impress_mobile_helper');
+
+describe('Trigger hamburger menu options.', function() {
+       var testFileName = '';
+
+       function before(testFile) {
+               testFileName = testFile;
+               mobileHelper.beforeAllMobile(testFileName, 'impress');
+
+               // Click on edit button
+               mobileHelper.enableEditingMobile();
+       }
+
+       afterEach(function() {
+               helper.afterAll(testFileName);
+       });
+
+       function dblclickOnShape() {
+               cy.get('.transform-handler--rotate')
+                       .then(function(items) {
+                               expect(items).to.have.length(1);
+                               var XPos = 
(items[0].getBoundingClientRect().left + 
items[0].getBoundingClientRect().right) / 2;
+                               var YPos = 
items[0].getBoundingClientRect().bottom + 50;
+                               cy.get('body')
+                                       .dblclick(XPos, YPos);
+                       });
+       }
+
+       it('Save', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'File')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Save')
+                       .click();
+
+               // TODO: we have no visual indicator of save was done
+               // So just trigger saving to catch any exception / console error
+               cy.wait(500);
+       });
+
+       it('Print', function() {
+               before('hamburger_menu.odp');
+
+               // A new window should be opened with the PDF.
+               cy.window()
+                       .then(function(win) {
+                               cy.stub(win, 'open');
+                       });
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'File')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Print')
+                       .click();
+
+               cy.window().its('open').should('be.called');
+       });
+
+       it('Download as PDF', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Download as')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'PDF Document (.pdf)')
+                       .click();
+
+               cy.get('iframe')
+                       .should('have.attr', 'data-src')
+                       .should('contain', 'document.pdf');
+       });
+
+       it('Download as ODP', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Download as')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'ODF presentation (.odp)')
+                       .click();
+
+               cy.get('iframe')
+                       .should('have.attr', 'data-src')
+                       .should('contain', 'document.odp');
+       });
+
+       it('Download as PPT', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Download as')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'PowerPoint 2003 
Presentation (.ppt)')
+                       .click();
+
+               cy.get('iframe')
+                       .should('have.attr', 'data-src')
+                       .should('contain', 'document.ppt');
+       });
+
+       it('Download as PPTX', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Download as')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'PowerPoint Presentation 
(.pptx)')
+                       .click();
+
+               cy.get('iframe')
+                       .should('have.attr', 'data-src')
+                       .should('contain', 'document.pptx');
+       });
+
+       it('Undo/redo.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'X');
+
+               // Type a new character
+               dblclickOnShape();
+
+               cy.get('textarea.clipboard')
+                       .type('q');
+
+               impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'Xq');
+
+               // Undo
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Undo')
+                       .click();
+
+               impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'X');
+
+               // Redo
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Redo')
+                       .click();
+
+               impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'Xq');
+       });
+
+       it('Repair.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'X');
+
+               // Type a new character
+               dblclickOnShape();
+
+               cy.get('textarea.clipboard')
+                       .type('q');
+
+               impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'Xq');
+
+               // Revert one undo step via Repair
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Repair')
+                       .click();
+
+               cy.get('.leaflet-popup-content')
+                       .should('be.visible');
+
+               cy.get('.leaflet-popup-content table tr:nth-of-type(2)')
+                       .should('contain.text', 'Undo');
+
+               cy.get('.leaflet-popup-content table tr:nth-of-type(2)')
+                       .click();
+
+               cy.get('.leaflet-popup-content input[value=\'Jump to state\']')
+                       .click();
+
+               impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+               cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition 
tspan')
+                       .should('have.text', 'X');
+       });
+
+       it('Cut.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+               impressMobileHelper.selectTextOfShape();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Cut')
+                       .click();
+
+               // TODO: cypress does not support clipboard operations
+               // so we get a warning dialog here.
+               cy.get('.vex-dialog-form')
+                       .should('be.visible');
+
+               cy.get('.vex-dialog-message')
+                       .should('have.text', 'Please use the copy/paste buttons 
on your on-screen keyboard.');
+
+               cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+                       .click();
+
+               cy.get('.vex-dialog-form')
+                       .should('not.be.visible');
+       });
+
+       it('Copy.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+               impressMobileHelper.selectTextOfShape();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Copy')
+                       .click();
+
+               // TODO: cypress does not support clipboard operations
+               // so we get a warning dialog here.
+               cy.get('.vex-dialog-form')
+                       .should('be.visible');
+
+               cy.get('.vex-dialog-message')
+                       .should('have.text', 'Please use the copy/paste buttons 
on your on-screen keyboard.');
+
+               cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+                       .click();
+
+               cy.get('.vex-dialog-form')
+                       .should('not.be.visible');
+       });
+
+       it('Paste.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+               impressMobileHelper.selectTextOfShape();
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Paste')
+                       .click();
+
+               // TODO: cypress does not support clipboard operations
+               // so we get a warning dialog here.
+               cy.get('.vex-dialog-form')
+                       .should('be.visible');
+
+               cy.get('.vex-dialog-message')
+                       .should('have.text', 'Please use the copy/paste buttons 
on your on-screen keyboard.');
+
+               cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+                       .click();
+
+               cy.get('.vex-dialog-form')
+                       .should('not.be.visible');
+       });
+
+       it('Select all.', function() {
+               before('hamburger_menu.odp');
+
+               impressMobileHelper.selectTextShapeInTheCenter();
+               dblclickOnShape();
+
+               cy.get('#copy-paste-container pre')
+                       .should('not.exist');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Edit')
+                       .click();
+
+               cy.contains('.menu-entry-with-icon', 'Select All')
+                       .click();
+
+               cy.get('.leaflet-marker-icon')
+                       .should('be.visible');
+
+               helper.expectTextForClipboard('X');
+       });
+
+       it('Search some word.', function() {
+               before('hamburger_menu.odp');
+
+               mobileHelper.openHamburgerMenu();
+
+               cy.contains('.menu-entry-with-icon', 'Search')
+                       .click();
+
+               // Search bar become visible
+               cy.get('#mobile-wizard-content')
+                       .should('not.be.empty');
+
+               // Search for some word
+               helper.inputOnIdle('#searchterm', 'X');
+
+               cy.get('#search')
+                       .should('not.have.attr', 'disabled');
+
+               helper.clickOnIdle('#search');
+
+               // A shape and some text should be selected
+               cy.get('.transform-handler--rotate')
+                       .should('be.visible');
+               cy.get('.leaflet-selection-marker-start')
+                       .should('be.visible');
+       });
+});
diff --git 
a/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js 
b/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
index 141ad6b11..24f2caade 100644
--- a/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
+++ b/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
@@ -1,7 +1,6 @@
 /* globals cy expect require */
 
 var helper = require('../../common/helper');
-var mobileHelper = require('../../common/mobile_helper');
 
 function selectTextShapeInTheCenter() {
        // Click on the center of the slide to select the text shape there
@@ -42,8 +41,6 @@ function selectTextOfShape() {
 }
 
 function triggerNewSVGForShapeInTheCenter() {
-       mobileHelper.closeMobileWizard();
-
        // Remove selection first with clicking next to the rotate handler
        cy.get('.transform-handler--rotate')
                .then(function(items) {
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to