cypress: extract dblclickOnSelectedShape() method.

Change-Id: I0947fe98cb04cd78fed63fe12aafe5198ec2e653
This commit is contained in:
Tamás Zolnai 2020-10-19 16:43:55 +02:00 committed by Tamás Zolnai
parent 36ddde6d77
commit 6ca5a0cd82
3 changed files with 24 additions and 35 deletions

View file

@ -1,4 +1,4 @@
/* global describe it cy require afterEach expect */
/* global describe it cy require afterEach */
var helper = require('../../common/helper');
var impressHelper = require('../../common/impress_helper');
@ -20,20 +20,6 @@ describe('Trigger hamburger menu options.', 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);
});
cy.get('.leaflet-cursor.blinking-cursor')
.should('exist');
}
it('Save', function() {
before('hamburger_menu.odp');
@ -44,7 +30,7 @@ describe('Trigger hamburger menu options.', function() {
.should('have.text', 'X');
// Type a new text
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
helper.typeIntoDocument('new');
@ -129,7 +115,7 @@ describe('Trigger hamburger menu options.', function() {
.should('have.text', 'X');
// Type a new character
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
helper.typeIntoDocument('q');
@ -164,7 +150,7 @@ describe('Trigger hamburger menu options.', function() {
.should('have.text', 'X');
// Type a new character
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
helper.typeIntoDocument('q');
@ -267,7 +253,8 @@ describe('Trigger hamburger menu options.', function() {
before('hamburger_menu.odp');
impressMobileHelper.selectTextShapeInTheCenter();
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
cy.get('#copy-paste-container pre')
.should('not.exist');
@ -366,7 +353,7 @@ describe('Trigger hamburger menu options.', function() {
.should('have.text', 'X');
// Type a new character
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
helper.typeIntoDocument('qqqqqq');

View file

@ -98,7 +98,23 @@ function triggerNewSVGForShapeInTheCenter() {
cy.log('Triggering new SVG for shape - end.');
}
function dblclickOnSelectedShape() {
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);
});
cy.get('.leaflet-cursor.blinking-cursor')
.should('exist');
}
module.exports.selectTextShapeInTheCenter = selectTextShapeInTheCenter;
module.exports.triggerNewSVGForShapeInTheCenter = triggerNewSVGForShapeInTheCenter;
module.exports.selectTextOfShape = selectTextOfShape;
module.exports.removeShapeSelection = removeShapeSelection;
module.exports.dblclickOnSelectedShape = dblclickOnSelectedShape;

View file

@ -26,20 +26,6 @@ describe('Searching via search bar.', 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);
});
cy.get('.leaflet-cursor.blinking-cursor')
.should('exist');
}
it('Search existing word.', function() {
cy.get('input#search-input')
.type('a');
@ -59,7 +45,7 @@ describe('Searching via search bar.', function() {
it('Search not existing word.', function() {
impressMobileHelper.selectTextShapeInTheCenter();
dblclickOnShape();
impressMobileHelper.dblclickOnSelectedShape();
helper.selectAllText();