summaryrefslogtreecommitdiffstats
path: root/cypress_test
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2021-02-26 13:56:19 +0100
committerTamás Zolnai <zolnaitamas2000@gmail.com>2021-03-08 20:07:33 +0100
commit2bdebdb7a2d4ec5a33bf21b9e0c35c84c58fea07 (patch)
tree61fd89a3430d25043ddc42ed01e7f55bca884af6 /cypress_test
parentcypress: document desktop helper methods. (diff)
downloadonline-2bdebdb7a2d4ec5a33bf21b9e0c35c84c58fea07.tar.gz
online-2bdebdb7a2d4ec5a33bf21b9e0c35c84c58fea07.zip
cypress: alias -> local variable change in form field tests.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com> Change-Id: Ic8460a2db6648874f5a22998394666706b31da1b (cherry picked from commit 3486923e6b61311730007dab8e987448c19779e7)
Diffstat (limited to 'cypress_test')
-rw-r--r--cypress_test/integration_tests/common/helper.js22
-rw-r--r--cypress_test/integration_tests/desktop/writer/form_field_spec.js40
2 files changed, 15 insertions, 47 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index c5e669bc31..2f4ae5c065 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -565,27 +565,6 @@ function initAliasToNegative(aliasName) {
cy.log('Initializing alias to a negative value - end.');
}
-// Initialize an alias to an empty string. It can be useful
-// when we use an alias as a variable and later we intend to
-// set it to a non-empty string.
-// Parameters:
-// aliasName - a string, expected to be used as alias.
-function initAliasToEmptyString(aliasName) {
- cy.log('Initializing alias to empty string - start.');
- cy.log('Param - aliasName: ' + aliasName);
-
- // Do an empty slice to generate empty string
- cy.get('#copy-paste-container')
- .invoke('css', 'display')
- .invoke('slice', '0', '0')
- .as(aliasName);
-
- cy.get('@' + aliasName)
- .should('be.equal', '');
-
- cy.log('Initializing alias to empty string - end.');
-}
-
// Run a code snippet if we are inside Calc.
function doIfInCalc(callback) {
cy.get('#document-container')
@@ -1099,7 +1078,6 @@ module.exports.expectTextForClipboard = expectTextForClipboard;
module.exports.matchClipboardText = matchClipboardText;
module.exports.afterAll = afterAll;
module.exports.initAliasToNegative = initAliasToNegative;
-module.exports.initAliasToEmptyString = initAliasToEmptyString;
module.exports.doIfInCalc = doIfInCalc;
module.exports.doIfInImpress = doIfInImpress;
module.exports.doIfInWriter = doIfInWriter;
diff --git a/cypress_test/integration_tests/desktop/writer/form_field_spec.js b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
index 644444789f..7c6f9a3acb 100644
--- a/cypress_test/integration_tests/desktop/writer/form_field_spec.js
+++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
@@ -289,29 +289,24 @@ describe('Form field button tests.', function() {
buttonShouldExist();
- // Get the initial font size from the style
- helper.initAliasToEmptyString('prevFontSize');
-
+ // Get the initial font size from the style.
+ var prevFontSize = '';
cy.get('.drop-down-field-list-item')
- .invoke('css', 'font-size')
- .as('prevFontSize');
-
- cy.get('@prevFontSize')
- .should('not.be.equal', '');
+ .should(function(item) {
+ prevFontSize = item.css('font-size');
+ expect(prevFontSize).to.not.equal('');
+ });
desktopHelper.zoomIn();
buttonShouldExist();
// Check that the font size was changed
- cy.get('@prevFontSize')
- .then(function(prevFontSize) {
- cy.get('.drop-down-field-list-item')
- .should(function(items) {
- var prevSize = parseInt(prevFontSize, 10);
- var currentSize = parseInt(items.css('font-size'), 10);
- expect(currentSize).to.be.greaterThan(prevSize);
- });
+ cy.get('.drop-down-field-list-item')
+ .should(function(item) {
+ var prevSize = parseInt(prevFontSize, 10);
+ var currentSize = parseInt(item.css('font-size'), 10);
+ expect(currentSize).to.be.greaterThan(prevSize);
});
cy.get('.drop-down-field-list-item')
@@ -322,15 +317,10 @@ describe('Form field button tests.', function() {
buttonShouldExist();
- // Check that the font size was changed
- cy.get('@prevFontSize')
- .then(function(prevFontSize) {
- cy.get('.drop-down-field-list-item')
- .should(function(items) {
- var prevSize = parseInt(prevFontSize, 10);
- var currentSize = parseInt(items.css('font-size'), 10);
- expect(currentSize).to.be.lessThan(prevSize);
- });
+ // Check that the font size was changed back
+ cy.get('.drop-down-field-list-item')
+ .should(function(item) {
+ expect(item.css('font-size')).to.be.equal(prevFontSize);
});
});
});