Rebased ref, commits from common ancestor: commit 53fbe9c4cd4749ce92bcb215243a2b6bd219b51a Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jan 29 15:24:01 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Jan 29 15:27:20 2020 +0100
cypress: mobile: Add some more insertion tests. Change-Id: Ie918fa1c386e25b767340afc9ec2fc61d8038ced diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js index 6b9001894..3fdbeffa9 100644 --- a/cypress_test/integration_tests/mobile/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/insert_object_spec.js @@ -41,7 +41,7 @@ describe('Insert objects via insertion wizard.', function() { .click(); }); - it('Insert table.', function() { + it('Insert default table.', function() { // Open Table submenu cy.get('.menu-entry-with-icon.flex-fullwidth') .contains('Table') @@ -66,6 +66,37 @@ describe('Insert objects via insertion wizard.', function() { .should('have.length', 2); }); + it('Insert custom table.', function() { + // Open Table submenu + cy.get('.menu-entry-with-icon.flex-fullwidth') + .contains('Table') + .click(); + cy.get('.mobile-wizard.ui-text') + .should('be.visible'); + + // Scroll to the bottom + cy.get('#mobile-wizard-content').scrollTo(0, 1000); + + // 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') + .should('exist') + .should('have.length', 4); + cy.get('.leaflet-marker-icon.table-row-resize-marker') + .should('exist') + .should('have.length', 3); + }); + it('Insert header.', function() { // Get the blinking cursor pos cy.get('#document-container').type('xxxx'); @@ -103,6 +134,43 @@ describe('Insert objects via insertion wizard.', function() { }); }); + it.only('Insert footer.', 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; + }); + + // Open header/footer submenu + cy.get('.sub-menu-title') + .contains('Header and Footer') + .click(); + cy.get('.ui-header.level-1.mobile-wizard.ui-widget') + .should('be.visible'); + + // Open footer submenu + cy.get('.ui-header.level-1.mobile-wizard.ui-widget .sub-menu-title') + .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); + }); + }); + it('Insert footnote.', function() { // Get the blinking cursor pos cy.get('#document-container').type('xxxx'); commit a948b8cfb7fff7dee704e4e4f8ded054350f2de4 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jan 29 14:46:30 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Jan 29 15:27:20 2020 +0100 cypress: mobile: Test applying paragraph properties. Change-Id: Icee81a71dcbdd7888f77e8cd53d7f0b9234ea94c diff --git a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js new file mode 100644 index 000000000..1660bec7e --- /dev/null +++ b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js @@ -0,0 +1,504 @@ +/* global describe it cy beforeEach require expect afterEach*/ + +var helper = require('../common/helper'); + +describe('Apply paragraph properties.', function() { + beforeEach(function() { + helper.loadTestDoc('simple.odt', true); + + // Click on edit button + cy.get('#mobile-edit-button').click(); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .should('not.have.class', 'disabled') + .click(); + + // Open paragraph properties + cy.get('#Paragraph') + .click(); + }); + + afterEach(function() { + cy.get('.closemobile').click(); + cy.wait(200); // wait some time to actually release the document + }); + + function generateTextHTML() { + // Do a new selection + cy.get('#document-container').click(); + cy.get('.leaflet-marker-icon') + .should('not.exist'); + + cy.wait(200); + + cy.get('body').type('{shift}{home}'); + cy.get('.leaflet-marker-icon'); + + cy.wait(200); + + // Open context menu + cy.get('.leaflet-marker-icon') + .then(function(marker) { + expect(marker).to.have.lengthOf(2); + var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; + var YPos = marker[0].getBoundingClientRect().top - 5; + cy.get('body').rightclick(XPos, YPos); + }); + + // Execute copy + cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link') + .contains('Copy') + .click(); + + // Close warning about clipboard operations + cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first') + .click(); + } + + it('Apply left alignment.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change alignment + cy.get('#CenterPara') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'center'); + + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Open paragraph properties + cy.get('#Paragraph') + .click(); + + // Change alignment + cy.get('#LeftPara') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'left'); + }); + + it('Apply center alignment.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change alignment + cy.get('#CenterPara') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'center'); + }); + + it('Apply right alignment.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change alignment + cy.get('#RightPara') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'right'); + }); + + it('Apply justify alignment.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change alignment + cy.get('#JustifyPara') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'align', 'justify'); + }); + + it('Change writing direction.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change writing mode + cy.get('#ParaRightToLeft') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'dir', 'rtl'); + + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Open paragraph properties + cy.get('#Paragraph') + .click(); + + // Change writing mode + cy.get('#ParaLeftToRight') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .should('not.have.attr', 'dir'); + }); + + it('Apply default bulleting.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + cy.get('#DefaultBullet') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container ul li p') + .should('exist'); + }); + + it('Apply default numbering.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + cy.get('#DefaultNumbering') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container ol li p') + .should('exist'); + }); + + it('Apply background color.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change background color + cy.get('#BackgroundColor') + .click(); + + cy.get('#color-picker-2-basic-color-5') + .click(); + + cy.get('#color-picker-2-tint-3') + .click(); + + cy.get('#mobile-wizard-back') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['background']).to.be.equal('rgb(0, 255, 0)'); + }); + }); + + it('Increase / decrease para spacing.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Increase para spacing + cy.get('#ParaspaceIncrease') + .click(); + cy.get('#ParaspaceIncrease') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-top']).to.be.equal('0.08in'); + expect(item[0].style['margin-bottom']).to.be.equal('0.08in'); + }); + + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Open paragraph properties + cy.get('#Paragraph') + .click(); + + // Decrease para spacing + cy.get('#ParaspaceDecrease') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-top']).to.be.equal('0.04in'); + expect(item[0].style['margin-bottom']).to.be.equal('0.04in'); + }); + }); + + it('Change para spacing via combobox.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Check para spacing current value + cy.get('#aboveparaspacing .spinfield') + .should('have.attr', 'value', '0.0'); + cy.get('#belowparaspacing .spinfield') + .should('have.attr', 'value', '0.0'); + + // Change spacing + cy.get('#aboveparaspacing .sinfieldcontrols .plus') + .click(); + cy.get('#aboveparaspacing .spinfield') + .should('have.attr', 'value', '0.02'); + cy.get('#aboveparaspacing .sinfieldcontrols .plus') + .click(); + cy.get('#aboveparaspacing .spinfield') + .should('have.attr', 'value', '0.04'); + cy.get('#aboveparaspacing .sinfieldcontrols .plus') + .click(); + cy.get('#aboveparaspacing .spinfield') + .should('have.attr', 'value', '0.06'); + + cy.get('#belowparaspacing .sinfieldcontrols .plus') + .click(); + cy.get('#belowparaspacing .spinfield') + .should('have.attr', 'value', '0.02'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-top']).to.be.equal('0.06in'); + expect(item[0].style['margin-bottom']).to.be.equal('0.02in'); + }); + }); + + it('Increase / decrease indent.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Increase indent + cy.get('#IncrementIndent') + .click(); + cy.get('#IncrementIndent') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-left']).to.be.equal('0.98in'); + }); + + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Open paragraph properties + cy.get('#Paragraph') + .click(); + + // Decrease indent + cy.get('#DecrementIndent') + .click(); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-left']).to.be.equal('0.49in'); + }); + }); + + it('Apply before text indent.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change indent + cy.get('#beforetextindent .sinfieldcontrols .plus') + .click(); + cy.get('#beforetextindent .spinfield') + .should('have.attr', 'value', '0.02'); + cy.get('#beforetextindent .sinfieldcontrols .plus') + .click(); + cy.get('#beforetextindent .spinfield') + .should('have.attr', 'value', '0.04'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-left']).to.be.equal('0.04in'); + }); + }); + + it('Apply after text indent.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Change indent + cy.get('#aftertextindent .sinfieldcontrols .plus') + .click(); + cy.get('#aftertextindent .spinfield') + .should('have.attr', 'value', '0.02'); + cy.get('#aftertextindent .sinfieldcontrols .plus') + .click(); + cy.get('#aftertextindent .spinfield') + .should('have.attr', 'value', '0.04'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['margin-right']).to.be.equal('0.04in'); + }); + }); + + it('Apply first line indent.', function() { + // Select text + cy.get('#document-container').dblclick(); + cy.get('.leaflet-marker-icon'); + + // Increase firstline indent + cy.get('#firstlineindent .sinfieldcontrols .plus') + .click(); + cy.get('#firstlineindent .spinfield') + .should('have.attr', 'value', '0.02'); + cy.get('#firstlineindent .sinfieldcontrols .plus') + .click(); + cy.get('#firstlineindent .spinfield') + .should('have.attr', 'value', '0.04'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].style['text-indent']).to.be.equal('0.04in'); + }); + }); +}); commit b0dac4231ab61b610d25eede1e94e29d85e39d55 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jan 29 12:57:54 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Jan 29 15:27:18 2020 +0100 cypress: mobile: Test formatting mark insertion. Change-Id: Ib3619e6830f25d7c78e369d714e0c4de6a47244b diff --git a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js new file mode 100644 index 000000000..76a68f62e --- /dev/null +++ b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js @@ -0,0 +1,194 @@ +/* global describe it cy beforeEach require expect afterEach*/ + +var helper = require('../common/helper'); + +describe('Insert formatting mark via insertion wizard.', function() { + beforeEach(function() { + helper.loadTestDoc('simple.odt', true); + + // Click on edit button + cy.get('#mobile-edit-button').click(); + + // Open insertion wizard + cy.get('#tb_actionbar_item_insertion_mobile_wizard') + .should('not.have.class', 'disabled') + .click(); + }); + + afterEach(function() { + cy.get('.closemobile').click(); + cy.wait(200); // wait some time to actually release the document + }); + + function generateTextHTML() { + // Do a new selection + cy.get('#document-container').click(); + cy.get('.leaflet-marker-icon') + .should('not.exist'); + + cy.wait(200); + + cy.get('body').type('{shift}{home}'); + cy.get('.leaflet-marker-icon'); + + cy.wait(200); + + // Open context menu + cy.get('.leaflet-marker-icon') + .then(function(marker) { + expect(marker).to.have.lengthOf(2); + var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; + var YPos = marker[0].getBoundingClientRect().top; + cy.get('body').rightclick(XPos, YPos); + }); + + // Execute copy + cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link') + .contains('Copy') + .click(); + + // Close warning about clipboard operations + cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first') + .click(); + } + + it('Insert non-breaking space.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('Non-breaking space') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u00a0'); + }); + }); + + it('Insert non-breaking hyphen.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('Non-breaking hyphen') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u2011'); + }); + }); + + it('Insert soft hyphen.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('Soft hyphen') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u00ad'); + }); + }); + + it('Insert no-width optional break.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('No-width optional break') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u200b'); + }); + }); + + it('Insert no-width no break.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('No-width no break') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u2060'); + }); + }); + + it('Insert left-to-right mark.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('Left-to-right mark') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u200e'); + }); + }); + + it('Insert right-to-left mark.', function() { + // Open formatting marks + cy.get('.sub-menu-title') + .contains('Formatting Mark') + .click(); + + // Do the insertion + cy.get('.menu-entry-no-icon') + .contains('Right-to-left mark') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p') + .then(function(item) { + expect(item).to.have.lengthOf(1); + expect(item[0].innerText).to.have.string('\u200f'); + }); + }); +}); diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js index 2754fbd00..6b9001894 100644 --- a/cypress_test/integration_tests/mobile/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/insert_object_spec.js @@ -238,23 +238,4 @@ describe('Insert objects via insertion wizard.', function() { expect(svg[0].getBBox().height).to.be.greaterThan(0); }); }); - - it('Insert formatting mark.', function() { - // Open formatting marks - cy.get('.sub-menu-title') - .contains('Formatting Mark') - .click(); - - // Do the insertion - cy.get('.menu-entry-no-icon') - .contains('Non-breaking space') - .should('be.visible') - .click(); - - // Do a selection to see something is inserted - cy.get('body').type('{shift}{leftarrow}'); - cy.get('.leaflet-marker-icon') - .should('exist') - .should('have.length', 2); - }); }); commit 68695c68653a2cfd7ff7341217c6cb2dbc5b8b28 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jan 29 12:57:39 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Jan 29 15:27:03 2020 +0100 cypress: mobile: Test field insertion. Change-Id: Ie7618436c57a30ef4282c042ff04262f55e0b17c diff --git a/cypress_test/integration_tests/mobile/insert_field_spec.js b/cypress_test/integration_tests/mobile/insert_field_spec.js new file mode 100644 index 000000000..65e4b732f --- /dev/null +++ b/cypress_test/integration_tests/mobile/insert_field_spec.js @@ -0,0 +1,181 @@ +/* global describe it cy beforeEach require expect afterEach*/ + +var helper = require('../common/helper'); + +describe('Insert fields via insertion wizard.', function() { + beforeEach(function() { + helper.loadTestDoc('simple.odt', true); + + // Click on edit button + cy.get('#mobile-edit-button').click(); + + // Open insertion wizard + cy.get('#tb_actionbar_item_insertion_mobile_wizard') + .should('not.have.class', 'disabled') + .click(); + }); + + afterEach(function() { + cy.get('.closemobile').click(); + cy.wait(200); // wait some time to actually release the document + }); + + function generateTextHTML() { + // Do a new selection + cy.get('#document-container').click(); + cy.get('.leaflet-marker-icon') + .should('not.exist'); + + cy.wait(200); + + cy.get('body').type('{shift}{home}'); + cy.get('.leaflet-marker-icon'); + + cy.wait(200); + + // Open context menu + cy.get('.leaflet-marker-icon') + .then(function(marker) { + expect(marker).to.have.lengthOf(2); + var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; + var YPos = marker[0].getBoundingClientRect().top; + cy.get('body').rightclick(XPos, YPos); + }); + + // Execute copy + cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link') + .contains('Copy') + .click(); + + // Close warning about clipboard operations + cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first') + .click(); + } + + it('Insert page number field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Page Number') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'PAGE') + .contains('1'); + }); + + it('Insert page count field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Page Count') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DOCSTAT') + .contains('1'); + }); + + it('Insert date field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Date') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DATETIME') + .should('have.attr', 'sdnum', '1033;1033;MM/DD/YY'); + }); + + it('Insert time field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Time') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DATETIME') + .should('have.attr', 'sdnum', '1033;1033;HH:MM:SS AM/PM'); + }); + + it('Insert title field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Title') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DOCINFO') + .should('have.attr', 'subtype', 'TITLE'); + }); + + it('Insert author field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('First Author') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DOCINFO') + .should('have.attr', 'subtype', 'CREATE') + .should('have.attr', 'format', 'AUTHOR'); + }); + + it('Insert subject field.', function() { + // Open fields submenu + cy.get('.sub-menu-title') + .contains('More Fields...') + .click(); + + // Insert field + cy.get('.menu-entry-with-icon') + .contains('Subject') + .click(); + + generateTextHTML(); + + cy.get('#copy-paste-container p span sdfield') + .should('have.attr', 'type', 'DOCINFO') + .should('have.attr', 'subtype', 'THEME'); + }); +}); diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js index 7de023130..2754fbd00 100644 --- a/cypress_test/integration_tests/mobile/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/insert_object_spec.js @@ -66,22 +66,6 @@ describe('Insert objects via insertion wizard.', function() { .should('have.length', 2); }); - it('Insert field.', function() { - // Open fields submenu - cy.get('.sub-menu-title') - .contains('More Fields...') - .click(); - cy.get('.menu-entry-with-icon') - .contains('Page Number') - .click(); - - // Do a selection to see something is inserted - cy.get('body').type('{shift}{leftarrow}'); - cy.get('.leaflet-marker-icon') - .should('exist') - .should('have.length', 2); - }); - it('Insert header.', function() { // Get the blinking cursor pos cy.get('#document-container').type('xxxx'); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits