2020-02-06 06:29:10 -06:00
|
|
|
/* global describe it cy beforeEach require expect afterEach Cypress*/
|
2020-01-25 23:33:14 -06:00
|
|
|
|
2020-02-12 11:01:47 -06:00
|
|
|
var helper = require('../../common/helper');
|
2020-03-09 08:00:44 -05:00
|
|
|
var writerHelper = require('./writer_helper');
|
2020-01-25 23:33:14 -06:00
|
|
|
|
|
|
|
describe('Insert objects via insertion wizard.', function() {
|
|
|
|
beforeEach(function() {
|
2020-02-20 15:01:27 -06:00
|
|
|
helper.beforeAllMobile('insert_object.odt', 'writer');
|
2020-02-06 06:29:10 -06:00
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Click on edit button
|
|
|
|
cy.get('#mobile-edit-button').click();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function() {
|
2020-02-02 22:34:25 -06:00
|
|
|
helper.afterAll();
|
2020-01-25 23:33:14 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert local image.', function() {
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// We check whether the entry is there
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Local Image...');
|
|
|
|
// We not not test the insertion, it might depend on the system.
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert comment.', function() {
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Comment')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Comment insertion dialog is opened
|
|
|
|
cy.get('.loleaflet-annotation-table')
|
|
|
|
.should('exist');
|
|
|
|
|
2020-03-06 08:12:34 -06:00
|
|
|
// Add some comment
|
|
|
|
cy.get('.loleaflet-annotation-textarea')
|
|
|
|
.type('some text');
|
|
|
|
|
|
|
|
cy.get('.vex-dialog-button-primary')
|
2020-01-25 23:33:14 -06:00
|
|
|
.click();
|
2020-03-06 08:12:34 -06:00
|
|
|
|
|
|
|
cy.get('.loleaflet-annotation')
|
|
|
|
.should('exist');
|
|
|
|
|
|
|
|
cy.get('.loleaflet-annotation-content.loleaflet-dont-break')
|
|
|
|
.contains('some text');
|
2020-01-25 23:33:14 -06:00
|
|
|
});
|
|
|
|
|
2020-01-29 08:24:01 -06:00
|
|
|
it('Insert default table.', function() {
|
2020-02-06 06:29:10 -06:00
|
|
|
// TODO: Select all does not work with core/master
|
|
|
|
if (Cypress.env('LO_CORE_VERSION') === 'master')
|
|
|
|
return;
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Open Table submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.ui-header.level-0.mobile-wizard.ui-widget')
|
2020-01-25 23:33:14 -06:00
|
|
|
.contains('Table')
|
|
|
|
.click();
|
|
|
|
cy.get('.mobile-wizard.ui-text')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// Push insert table button
|
|
|
|
cy.get('.inserttablecontrols button')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Table is inserted with the markers shown
|
|
|
|
cy.get('.leaflet-marker-icon.table-column-resize-marker')
|
2020-02-04 05:37:50 -06:00
|
|
|
.should('exist');
|
|
|
|
|
2020-03-09 08:00:44 -05:00
|
|
|
writerHelper.copyTableToClipboard();
|
2020-02-04 05:37:50 -06:00
|
|
|
|
|
|
|
// Two rows
|
|
|
|
cy.get('#copy-paste-container tr')
|
2020-01-25 23:33:14 -06:00
|
|
|
.should('have.length', 2);
|
2020-02-04 05:37:50 -06:00
|
|
|
// Four cells
|
|
|
|
cy.get('#copy-paste-container td')
|
|
|
|
.should('have.length', 4);
|
2020-01-25 23:33:14 -06:00
|
|
|
});
|
|
|
|
|
2020-01-29 08:24:01 -06:00
|
|
|
it('Insert custom table.', function() {
|
2020-02-06 06:29:10 -06:00
|
|
|
// TODO: Select all does not work with core/master
|
|
|
|
if (Cypress.env('LO_CORE_VERSION') === 'master')
|
|
|
|
return;
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-29 08:24:01 -06:00
|
|
|
// Open Table submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.ui-header.level-0.mobile-wizard.ui-widget')
|
2020-01-29 08:24:01 -06:00
|
|
|
.contains('Table')
|
|
|
|
.click();
|
|
|
|
cy.get('.mobile-wizard.ui-text')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// Change rows and columns
|
|
|
|
cy.get('.inserttablecontrols #rows .sinfieldcontrols .plus')
|
|
|
|
.click();
|
|
|
|
cy.get('.inserttablecontrols #cols .sinfieldcontrols .plus')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Push insert table button
|
|
|
|
cy.get('.inserttablecontrols button')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Table is inserted with the markers shown
|
|
|
|
cy.get('.leaflet-marker-icon.table-column-resize-marker')
|
2020-02-04 05:37:50 -06:00
|
|
|
.should('exist');
|
|
|
|
|
2020-03-09 08:00:44 -05:00
|
|
|
writerHelper.copyTableToClipboard();
|
2020-02-04 05:37:50 -06:00
|
|
|
|
|
|
|
// Three rows
|
|
|
|
cy.get('#copy-paste-container tr')
|
2020-01-29 08:24:01 -06:00
|
|
|
.should('have.length', 3);
|
2020-02-04 05:37:50 -06:00
|
|
|
// Nine cells
|
|
|
|
cy.get('#copy-paste-container td')
|
|
|
|
.should('have.length', 9);
|
2020-01-29 08:24:01 -06:00
|
|
|
});
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
it('Insert header.', function() {
|
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
2020-02-06 10:17:25 -06:00
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
var cursorOrigLeft = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1) ;
|
|
|
|
cursorOrigLeft = cursor[0].getBoundingClientRect().left;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Open header/footer submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.menu-entry-with-icon')
|
2020-01-25 23:33:14 -06:00
|
|
|
.contains('Header and Footer')
|
|
|
|
.click();
|
|
|
|
cy.get('.ui-header.level-1.mobile-wizard.ui-widget')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// Open header submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.ui-header.level-1.mobile-wizard.ui-widget')
|
2020-01-25 23:33:14 -06:00
|
|
|
.contains('Header')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Insert header for All
|
|
|
|
cy.get('.menu-entry-no-icon')
|
|
|
|
.contains('All')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().left).to.be.lessThan(cursorOrigLeft);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-01-29 13:26:43 -06:00
|
|
|
it('Insert footer.', function() {
|
2020-01-29 08:24:01 -06:00
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
|
|
|
var cursorOrigTop = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1) ;
|
|
|
|
cursorOrigTop = cursor[0].getBoundingClientRect().top;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-29 08:24:01 -06:00
|
|
|
// Open header/footer submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.menu-entry-with-icon')
|
2020-01-29 08:24:01 -06:00
|
|
|
.contains('Header and Footer')
|
|
|
|
.click();
|
|
|
|
cy.get('.ui-header.level-1.mobile-wizard.ui-widget')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// Open footer submenu
|
2020-02-24 04:10:19 -06:00
|
|
|
cy.get('.ui-header.level-1.mobile-wizard.ui-widget')
|
2020-01-29 08:24:01 -06:00
|
|
|
.contains('Footer')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Insert footer for All
|
|
|
|
cy.get('.ui-content.level-1.mobile-wizard[title~="Footer"] .ui-header.level-2.mobile-wizard.ui-widget .menu-entry-no-icon')
|
|
|
|
.contains('All')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
it('Insert footnote.', function() {
|
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
|
|
|
var cursorOrigTop = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
cursorOrigTop = cursor[0].getBoundingClientRect().top;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Insert footnote
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Footnote')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved down
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert endnote.', function() {
|
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
|
|
|
var cursorOrigTop = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
cursorOrigTop = cursor[0].getBoundingClientRect().top;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Insert endnote
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Endnote')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved down
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert page break.', function() {
|
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
|
|
|
var cursorOrigTop = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
cursorOrigTop = cursor[0].getBoundingClientRect().top;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Insert endnote
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Page Break')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved down
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert column break.', function() {
|
|
|
|
// Get the blinking cursor pos
|
|
|
|
cy.get('#document-container').type('xxxx');
|
|
|
|
var cursorOrigTop = 0;
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
cursorOrigTop = cursor[0].getBoundingClientRect().top;
|
|
|
|
});
|
|
|
|
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Do insertion
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Column Break')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.wait(100);
|
|
|
|
|
|
|
|
// Check that the cursor was moved down
|
|
|
|
cy.get('.blinking-cursor')
|
|
|
|
.then(function(cursor) {
|
|
|
|
expect(cursor).to.have.lengthOf(1);
|
|
|
|
expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert hyperlink.', function() {
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Open hyperlink dialog
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Hyperlink...')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Dialog is opened
|
|
|
|
cy.get('.vex-content.hyperlink-dialog')
|
|
|
|
.should('exist');
|
|
|
|
|
2020-03-06 08:01:21 -06:00
|
|
|
// Type text and link
|
|
|
|
cy.get('.vex-content.hyperlink-dialog input[name="text"]')
|
|
|
|
.type('some text');
|
|
|
|
cy.get('.vex-content.hyperlink-dialog input[name="link"]')
|
|
|
|
.type('www.something.com');
|
|
|
|
|
|
|
|
// Insert
|
|
|
|
cy.get('.vex-content.hyperlink-dialog .vex-dialog-button-primary')
|
2020-01-25 23:33:14 -06:00
|
|
|
.click();
|
2020-03-06 08:01:21 -06:00
|
|
|
|
2020-03-09 08:00:44 -05:00
|
|
|
writerHelper.copyTextToClipboard();
|
2020-03-06 08:01:21 -06:00
|
|
|
|
|
|
|
cy.get('#copy-paste-container p')
|
|
|
|
.contains('some text');
|
|
|
|
|
|
|
|
cy.get('#copy-paste-container p a')
|
|
|
|
.should('have.attr', 'href', 'http://www.something.com/');
|
2020-01-25 23:33:14 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Insert shape.', function() {
|
2020-02-06 10:17:25 -06:00
|
|
|
// Open insertion wizard
|
|
|
|
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
|
|
|
|
.click();
|
|
|
|
|
2020-01-25 23:33:14 -06:00
|
|
|
// Do insertion
|
|
|
|
cy.get('.menu-entry-with-icon')
|
|
|
|
.contains('Shape')
|
|
|
|
.click();
|
2020-01-27 06:21:58 -06:00
|
|
|
|
|
|
|
cy.get('.col.w2ui-icon.basicshapes_rectangle').
|
|
|
|
click();
|
|
|
|
|
|
|
|
// Check that the shape is there
|
|
|
|
cy.get('.leaflet-pane.leaflet-overlay-pane svg g')
|
|
|
|
.should('exist');
|
|
|
|
|
|
|
|
cy.get('.leaflet-pane.leaflet-overlay-pane svg')
|
|
|
|
.then(function(svg) {
|
|
|
|
expect(svg[0].getBBox().width).to.be.greaterThan(0);
|
|
|
|
expect(svg[0].getBBox().height).to.be.greaterThan(0);
|
|
|
|
});
|
2020-01-25 23:33:14 -06:00
|
|
|
});
|
|
|
|
});
|