2020-11-03 06:10:58 -06:00
|
|
|
/* global cy expect require Cypress */
|
2020-04-07 04:22:38 -05:00
|
|
|
|
|
|
|
var helper = require('./helper');
|
|
|
|
|
|
|
|
// Enable editing if we are in read-only mode.
|
|
|
|
function enableEditingMobile() {
|
2020-04-07 09:13:23 -05:00
|
|
|
cy.log('Enabling editing mode - start.');
|
|
|
|
|
2020-04-07 04:22:38 -05:00
|
|
|
cy.get('#mobile-edit-button')
|
|
|
|
.then(function(button) {
|
|
|
|
if (button.css('display') !== 'none') {
|
2020-09-24 01:04:52 -05:00
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_closemobile .editmode')
|
|
|
|
.should('not.exist');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_closemobile .closemobile')
|
|
|
|
.should('be.visible');
|
|
|
|
|
2020-04-07 04:22:38 -05:00
|
|
|
cy.get('#mobile-edit-button')
|
|
|
|
.click();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-09-24 01:04:52 -05:00
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_closemobile .editmode')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_closemobile .closemobile')
|
|
|
|
.should('not.exist');
|
2020-04-07 09:13:23 -05:00
|
|
|
|
2020-06-18 13:17:30 -05:00
|
|
|
// Wait until all UI update is finished.
|
|
|
|
cy.get('#toolbar-down')
|
|
|
|
.should('be.visible');
|
|
|
|
|
2020-06-22 05:34:06 -05:00
|
|
|
helper.doIfInCalc(function() {
|
|
|
|
cy.get('#formulabar')
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
2020-06-18 13:17:30 -05:00
|
|
|
|
2020-11-30 06:57:22 -06:00
|
|
|
// In writer, we should have the blinking cursor visible
|
|
|
|
// after stepping into editing mode.
|
|
|
|
helper.doIfInWriter(function() {
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
|
2020-04-07 09:13:23 -05:00
|
|
|
cy.log('Enabling editing mode - end.');
|
2020-04-07 04:22:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function longPressOnDocument(posX, posY) {
|
2020-04-07 09:13:23 -05:00
|
|
|
cy.log('Emulating a long press - start.');
|
|
|
|
cy.log('Param - posX: ' + posX);
|
2020-04-07 10:48:50 -05:00
|
|
|
cy.log('Param - posY: ' + posY);
|
2020-04-07 09:13:23 -05:00
|
|
|
|
2020-04-07 04:22:38 -05:00
|
|
|
cy.get('.leaflet-pane.leaflet-map-pane')
|
|
|
|
.then(function(items) {
|
|
|
|
expect(items).have.length(1);
|
|
|
|
|
|
|
|
var eventOptions = {
|
|
|
|
force: true,
|
|
|
|
button: 0,
|
|
|
|
pointerType: 'mouse',
|
|
|
|
x: posX - items[0].getBoundingClientRect().left,
|
|
|
|
y: posY - items[0].getBoundingClientRect().top
|
|
|
|
};
|
|
|
|
|
|
|
|
cy.get('.leaflet-pane.leaflet-map-pane')
|
|
|
|
.trigger('pointerdown', eventOptions)
|
|
|
|
.trigger('pointermove', eventOptions);
|
|
|
|
|
|
|
|
// This value is set in Map.TouchGesture.js.
|
|
|
|
cy.wait(500);
|
|
|
|
|
|
|
|
cy.get('.leaflet-pane.leaflet-map-pane')
|
|
|
|
.trigger('pointerup', eventOptions);
|
|
|
|
});
|
2020-04-07 09:13:23 -05:00
|
|
|
|
|
|
|
cy.log('Emulating a long press - end.');
|
2020-04-07 04:22:38 -05:00
|
|
|
}
|
|
|
|
|
2020-04-07 08:44:57 -05:00
|
|
|
function openHamburgerMenu() {
|
|
|
|
cy.log('Opening hamburger menu - start.');
|
|
|
|
|
|
|
|
cy.get('#toolbar-hamburger')
|
|
|
|
.should('not.have.class', 'menuwizard-opened');
|
|
|
|
|
2020-04-07 04:22:38 -05:00
|
|
|
cy.get('#toolbar-hamburger .main-menu-btn-icon')
|
|
|
|
.click({force: true});
|
2020-04-07 08:44:57 -05:00
|
|
|
|
|
|
|
cy.get('#toolbar-hamburger')
|
|
|
|
.should('have.class', 'menuwizard-opened');
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard-content')
|
|
|
|
.should('not.be.empty');
|
|
|
|
|
|
|
|
cy.log('Opening hamburger menu - end.');
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeHamburgerMenu() {
|
|
|
|
cy.log('Closing hamburger menu - start.');
|
|
|
|
|
|
|
|
cy.get('#toolbar-hamburger')
|
|
|
|
.should('have.class', 'menuwizard-opened');
|
|
|
|
|
|
|
|
cy.get('#toolbar-hamburger .main-menu-btn-icon')
|
|
|
|
.click({force: true});
|
|
|
|
|
|
|
|
cy.get('#toolbar-hamburger')
|
|
|
|
.should('not.have.class', 'menuwizard-opened');
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard-content')
|
|
|
|
.should('be.empty');
|
|
|
|
|
|
|
|
cy.log('Closing hamburger menu - end.');
|
2020-04-07 04:22:38 -05:00
|
|
|
}
|
|
|
|
|
2020-04-07 04:39:57 -05:00
|
|
|
function openMobileWizard() {
|
|
|
|
cy.log('Opening mobile wizard - start.');
|
|
|
|
|
|
|
|
// Open mobile wizard
|
|
|
|
cy.get('#tb_actionbar_item_mobile_wizard')
|
|
|
|
.should('not.have.class', 'disabled')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Mobile wizard is opened and it has content
|
|
|
|
cy.get('#mobile-wizard-content')
|
|
|
|
.should('not.be.empty');
|
|
|
|
cy.get('#tb_actionbar_item_mobile_wizard table')
|
|
|
|
.should('have.class', 'checked');
|
|
|
|
|
|
|
|
cy.log('Opening mobile wizard - end.');
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeMobileWizard() {
|
|
|
|
cy.log('Closing mobile wizard - start.');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_mobile_wizard table')
|
|
|
|
.should('have.class', 'checked');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard')
|
|
|
|
.should('not.be.visible');
|
|
|
|
cy.get('#tb_actionbar_item_mobile_wizard table')
|
|
|
|
.should('not.have.class', 'checked');
|
|
|
|
|
|
|
|
cy.log('Closing mobile wizard - end.');
|
|
|
|
}
|
|
|
|
|
2020-04-08 07:03:58 -05:00
|
|
|
function executeCopyFromContextMenu(XPos, YPos) {
|
|
|
|
cy.log('Executing copy from context menu - start.');
|
|
|
|
cy.log('Param - XPos: ' + XPos);
|
|
|
|
cy.log('Param - YPos: ' + YPos);
|
|
|
|
|
|
|
|
longPressOnDocument(XPos, YPos);
|
|
|
|
|
|
|
|
// Execute copy
|
2020-04-14 09:09:22 -05:00
|
|
|
cy.contains('.menu-entry-with-icon', 'Copy')
|
2020-04-08 07:03:58 -05:00
|
|
|
.click();
|
|
|
|
|
|
|
|
// Close warning about clipboard operations
|
|
|
|
cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Wait until it's closed
|
|
|
|
cy.get('.vex-overlay')
|
|
|
|
.should('not.exist');
|
|
|
|
|
|
|
|
cy.log('Executing copy from context menu - end.');
|
|
|
|
}
|
|
|
|
|
2020-04-09 04:53:23 -05:00
|
|
|
function openInsertionWizard() {
|
|
|
|
cy.log('Opening insertion wizard - start.');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.should('not.have.class', 'disabled')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard-content')
|
|
|
|
.should('not.be.empty');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
|
|
|
|
.should('have.class', 'checked');
|
|
|
|
|
|
|
|
cy.log('Opening insertion wizard - end.');
|
|
|
|
}
|
|
|
|
|
2020-12-31 20:35:51 -06:00
|
|
|
function openCommentWizard() {
|
|
|
|
cy.log('Opening Comment wizard - start.');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_comment_wizard')
|
|
|
|
.should('not.have.class', 'disabled')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_comment_wizard table')
|
|
|
|
.should('have.class', 'checked');
|
|
|
|
|
|
|
|
cy.log('Opening Comment wizard - end.');
|
|
|
|
}
|
|
|
|
|
2020-04-09 04:53:23 -05:00
|
|
|
function closeInsertionWizard() {
|
|
|
|
cy.log('Closing insertion wizard - start.');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
|
|
|
|
.should('have.class', 'checked');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard')
|
|
|
|
.should('not.be.visible');
|
|
|
|
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
|
|
|
|
.should('not.have.class', 'checked');
|
|
|
|
|
|
|
|
cy.log('Closing insertion wizard - end.');
|
|
|
|
}
|
|
|
|
|
2020-06-01 05:20:25 -05:00
|
|
|
function selectFromColorPalette(paletteNum, groupNum, colorNum) {
|
|
|
|
cy.log('Selecting a color from the color palette - start.');
|
|
|
|
|
|
|
|
cy.get('#color-picker-' + paletteNum.toString() + '-basic-color-' + groupNum.toString())
|
|
|
|
.click();
|
|
|
|
|
|
|
|
if (colorNum !== undefined) {
|
|
|
|
cy.get('#color-picker-' + paletteNum.toString() + '-tint-' + colorNum.toString())
|
|
|
|
.click();
|
|
|
|
}
|
|
|
|
|
|
|
|
cy.get('#mobile-wizard-back')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.log('Selecting a color from the color palette - end.');
|
|
|
|
}
|
|
|
|
|
2020-08-02 23:24:11 -05:00
|
|
|
function openTextPropertiesPanel() {
|
|
|
|
openMobileWizard();
|
|
|
|
|
|
|
|
helper.clickOnIdle('#TextPropertyPanel');
|
|
|
|
|
|
|
|
cy.get('#Bold')
|
|
|
|
.should('be.visible');
|
|
|
|
}
|
|
|
|
|
2020-10-12 06:32:53 -05:00
|
|
|
function selectHamburgerMenuItem(menuItems) {
|
|
|
|
cy.log('Selecting hamburger menu item - start.');
|
|
|
|
cy.log('Param - menuItems: ' + menuItems);
|
|
|
|
|
|
|
|
openHamburgerMenu();
|
|
|
|
|
|
|
|
for (var i = 0; i < menuItems.length; i++) {
|
|
|
|
cy.contains('.menu-entry-with-icon', menuItems[i])
|
|
|
|
.click();
|
|
|
|
|
2020-11-03 06:10:58 -06:00
|
|
|
if (Cypress.env('INTEGRATION') !== 'nextcloud') {
|
2020-12-30 10:05:37 -06:00
|
|
|
if (i === menuItems.length - 1) {
|
|
|
|
cy.contains('.menu-entry-with-icon', menuItems[i])
|
|
|
|
.should('not.exist');
|
|
|
|
} else {
|
|
|
|
cy.contains('.menu-entry-with-icon', menuItems[i])
|
|
|
|
.should('not.be.visible');
|
|
|
|
}
|
2020-11-03 06:10:58 -06:00
|
|
|
}
|
2020-10-12 06:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
cy.log('Selecting hamburger menu item - end.');
|
|
|
|
}
|
|
|
|
|
2020-10-12 18:25:35 -05:00
|
|
|
function selectAnnotationMenuItem(menuItem) {
|
|
|
|
cy.log('Selecting annotation menu item - start.');
|
|
|
|
|
2020-12-31 20:35:51 -06:00
|
|
|
cy.get('.wizard-comment-box .loleaflet-annotation-menu')
|
2020-10-12 18:25:35 -05:00
|
|
|
.click({force: true});
|
|
|
|
|
|
|
|
cy.get('.context-menu-list')
|
|
|
|
.should('exist');
|
|
|
|
|
2020-10-19 00:04:34 -05:00
|
|
|
cy.contains('.context-menu-item', menuItem)
|
2020-10-12 18:25:35 -05:00
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.log('Selecting annotation menu item - end.');
|
|
|
|
}
|
|
|
|
|
2020-11-18 05:28:50 -06:00
|
|
|
function selectListBoxItem(listboxSelector, item) {
|
|
|
|
cy.log('Selecting an item from listbox - start.');
|
|
|
|
|
|
|
|
helper.clickOnIdle(listboxSelector);
|
|
|
|
|
|
|
|
helper.clickOnIdle('.mobile-wizard.ui-combobox-text', item);
|
|
|
|
|
|
|
|
// Combobox entry contains the selected item
|
|
|
|
cy.get(listboxSelector + ' .ui-header-right .entry-value')
|
|
|
|
.should('have.text', item);
|
|
|
|
|
|
|
|
cy.log('Selecting an item from listbox - end.');
|
|
|
|
}
|
|
|
|
|
2020-11-18 06:07:05 -06:00
|
|
|
function selectListBoxItem2(listboxSelector, item) {
|
|
|
|
cy.log('Selecting an item from listbox 2 - start.');
|
|
|
|
|
|
|
|
helper.clickOnIdle(listboxSelector);
|
|
|
|
|
|
|
|
helper.clickOnIdle('.ui-combobox-text', item);
|
|
|
|
|
|
|
|
cy.get(listboxSelector + ' .ui-header-left')
|
|
|
|
.should('have.text', item);
|
|
|
|
|
|
|
|
cy.log('Selecting an item from listbox 2 - end.');
|
|
|
|
}
|
|
|
|
|
2020-04-07 04:22:38 -05:00
|
|
|
module.exports.enableEditingMobile = enableEditingMobile;
|
|
|
|
module.exports.longPressOnDocument = longPressOnDocument;
|
2020-04-07 08:44:57 -05:00
|
|
|
module.exports.openHamburgerMenu = openHamburgerMenu;
|
2020-10-12 06:32:53 -05:00
|
|
|
module.exports.selectHamburgerMenuItem = selectHamburgerMenuItem;
|
2020-10-12 18:25:35 -05:00
|
|
|
module.exports.selectAnnotationMenuItem = selectAnnotationMenuItem;
|
2020-04-07 08:44:57 -05:00
|
|
|
module.exports.closeHamburgerMenu = closeHamburgerMenu;
|
2020-04-07 04:39:57 -05:00
|
|
|
module.exports.openMobileWizard = openMobileWizard;
|
|
|
|
module.exports.closeMobileWizard = closeMobileWizard;
|
2020-04-08 07:03:58 -05:00
|
|
|
module.exports.executeCopyFromContextMenu = executeCopyFromContextMenu;
|
2020-04-09 04:53:23 -05:00
|
|
|
module.exports.openInsertionWizard = openInsertionWizard;
|
|
|
|
module.exports.closeInsertionWizard = closeInsertionWizard;
|
2020-06-01 05:20:25 -05:00
|
|
|
module.exports.selectFromColorPalette = selectFromColorPalette;
|
2020-08-02 23:24:11 -05:00
|
|
|
module.exports.openTextPropertiesPanel = openTextPropertiesPanel;
|
2020-11-18 05:28:50 -06:00
|
|
|
module.exports.selectListBoxItem = selectListBoxItem;
|
2020-11-18 06:07:05 -06:00
|
|
|
module.exports.selectListBoxItem2 = selectListBoxItem2;
|
2020-12-31 20:35:51 -06:00
|
|
|
module.exports.openCommentWizard = openCommentWizard;
|