summaryrefslogtreecommitdiffstats
path: root/cypress_test
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2021-02-26 14:17:12 +0100
committerTamás Zolnai <zolnaitamas2000@gmail.com>2021-03-08 20:07:33 +0100
commit49330ad92967a7d4de7ca97296478cd33dacdd09 (patch)
treec5e39cac68b4250c7e17231643e79831fdd2191d /cypress_test
parentcypress: alias -> local variable change in formula bar tests. (diff)
downloadonline-49330ad92967a7d4de7ca97296478cd33dacdd09.tar.gz
online-49330ad92967a7d4de7ca97296478cd33dacdd09.zip
cypress: alias -> local variable change in moveCursor helper method.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com> Change-Id: I3b52648ae9d9396d4cd3eb7dacfe9248fdbc2b52 (cherry picked from commit 706206948c77172bb9afba029479a7a4dbf6953a)
Diffstat (limited to 'cypress_test')
-rw-r--r--cypress_test/integration_tests/common/helper.js56
1 files changed, 29 insertions, 27 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 2f4ae5c065..861a8917b2 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -884,17 +884,22 @@ function moveCursor(direction, modifier,
cy.log('Param - cursorSelector: ' + cursorSelector);
// Get the original cursor position.
- if (direction === 'up' ||
- direction === 'down' ||
- (direction === 'home' && modifier === 'ctrl') ||
- (direction === 'end' && modifier === 'ctrl')) {
- getCursorPos('top', 'origCursorPos', cursorSelector);
- } else if (direction === 'left' ||
- direction === 'right' ||
- direction === 'home' ||
- direction === 'end') {
- getCursorPos('left', 'origCursorPos', cursorSelector);
- }
+ var origCursorPos = 0;
+ cy.get(cursorSelector)
+ .should(function(cursor) {
+ if (direction === 'up' ||
+ direction === 'down' ||
+ (direction === 'home' && modifier === 'ctrl') ||
+ (direction === 'end' && modifier === 'ctrl')) {
+ origCursorPos = cursor.offset().top;
+ } else if (direction === 'left' ||
+ direction === 'right' ||
+ direction === 'home' ||
+ direction === 'end') {
+ origCursorPos = cursor.offset().left;
+ }
+ expect(origCursorPos).to.not.equal(0);
+ });
// Move the cursor using keyboard input.
var key = '';
@@ -921,22 +926,19 @@ function moveCursor(direction, modifier,
typeIntoDocument(key);
// Make sure the cursor position was changed.
- cy.get('@origCursorPos')
- .then(function(origCursorPos) {
- cy.get(cursorSelector)
- .should(function(cursor) {
- if (direction === 'up' ||
- direction === 'down' ||
- (direction === 'home' && modifier === 'ctrl') ||
- (direction === 'end' && modifier === 'ctrl')) {
- expect(cursor.offset().top).to.not.equal(origCursorPos);
- } else if (direction === 'left' ||
- direction === 'right' ||
- direction === 'end' ||
- direction === 'home') {
- expect(cursor.offset().left).to.not.equal(origCursorPos);
- }
- });
+ cy.get(cursorSelector)
+ .should(function(cursor) {
+ if (direction === 'up' ||
+ direction === 'down' ||
+ (direction === 'home' && modifier === 'ctrl') ||
+ (direction === 'end' && modifier === 'ctrl')) {
+ expect(cursor.offset().top).to.not.equal(origCursorPos);
+ } else if (direction === 'left' ||
+ direction === 'right' ||
+ direction === 'end' ||
+ direction === 'home') {
+ expect(cursor.offset().left).to.not.equal(origCursorPos);
+ }
});
// Cursor should be visible after move, because the view always follows it.