libreoffice-online/cypress_test/integration_tests/mobile/insert_field_spec.js
Tamás Zolnai ce063cdce4 cypress: mobile: Do the core detection inside a beforeAllMobile method.
Change-Id: I80717c8aca5b7e75f282c38aaa1608ddd14facda
2020-02-06 14:23:34 +01:00

148 lines
3.3 KiB
JavaScript

/* global describe it cy beforeEach require afterEach*/
var helper = require('../common/helper');
describe('Insert fields via insertion wizard.', function() {
beforeEach(function() {
helper.beforeAllMobile('simple.odt');
// 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() {
helper.afterAll();
});
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
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();
helper.copyTextToClipboard();
cy.get('#copy-paste-container p span sdfield')
.should('have.attr', 'type', 'DOCINFO')
.should('have.attr', 'subtype', 'THEME');
});
});