From 468dcd1dc4ba5c4135546abb08c81a4c6dcafef2 Mon Sep 17 00:00:00 2001 From: Julia Aranovich Date: Thu, 22 Sep 2016 12:45:18 +0300 Subject: [PATCH] Fix syntax in intern tests !A || B logic changed to A && B into functional tests. Partial-Bug: #1626059 Change-Id: I31cfd2145c4fc3f5cf85c51340bee5f734ba0dab --- static/tests/functional/pages/cluster.js | 4 ++-- static/tests/functional/pages/common.js | 2 +- static/tests/functional/pages/login.js | 4 ++-- static/tests/functional/test_cluster_network.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/static/tests/functional/pages/cluster.js b/static/tests/functional/pages/cluster.js index 9d37fe261..0a2fe83d9 100644 --- a/static/tests/functional/pages/cluster.js +++ b/static/tests/functional/pages/cluster.js @@ -48,7 +48,7 @@ class ClusterPage { .then(() => this.modal.waitToOpen()) .then(() => this.modal.clickFooterButton('Delete')) .findAllByCssSelector('.confirmation-form input[type=text]') - .then((confirmInputs) => !confirmInputs.length || + .then((confirmInputs) => !!confirmInputs.length && confirmInputs[0] .type(clusterName) .then(() => this.modal.clickFooterButton('Delete')) @@ -108,7 +108,7 @@ class ClusterPage { .then(() => this.modal.checkTitle('Reset Environment')) .then(() => this.modal.clickFooterButton('Reset')) .findAllByCssSelector('.confirmation-form input[type=text]') - .then((confirmationInputs) => !confirmationInputs.length || + .then((confirmationInputs) => !!confirmationInputs.length && confirmationInputs[0] .type(clusterName) .then(() => this.modal.clickFooterButton('Reset')) diff --git a/static/tests/functional/pages/common.js b/static/tests/functional/pages/common.js index 565840727..25703a45b 100644 --- a/static/tests/functional/pages/common.js +++ b/static/tests/functional/pages/common.js @@ -92,7 +92,7 @@ class CommonMethods { .clickByCssSelector('.btn-add-nodes') .waitForElementDeletion('.btn-add-nodes', 3000) .waitForCssSelector('.node', 3000) - .then(() => !nodeNameFilter || this.clusterPage.searchForNode(nodeNameFilter)) + .then(() => !!nodeNameFilter && this.clusterPage.searchForNode(nodeNameFilter)) .then(() => this.clusterPage.checkNodeRoles(nodesRoles)) .then(() => this.clusterPage.checkNodes(nodesAmount, nodeStatus)) .clickByCssSelector('.btn-apply') diff --git a/static/tests/functional/pages/login.js b/static/tests/functional/pages/login.js index 016b6b295..78c65aa09 100644 --- a/static/tests/functional/pages/login.js +++ b/static/tests/functional/pages/login.js @@ -29,7 +29,7 @@ class LoginPage { .setFindTimeout(500) .setWindowSize(1280, 1024) .getCurrentUrl() - .then((url) => url === Helpers.serverUrl + '/#login' || this.logout()) + .then((url) => url !== Helpers.serverUrl + '/#login' && this.logout()) .setInputValue('[name=username]', username) .setInputValue('[name=password]', password) .clickByCssSelector('.login-btn'); @@ -38,7 +38,7 @@ class LoginPage { logout() { return this.remote .getCurrentUrl() - .then((url) => url.indexOf(Helpers.serverUrl) === 0 || + .then((url) => url.indexOf(Helpers.serverUrl) !== 0 && this.remote .get(Helpers.serverUrl + '/#logout') .findByClassName('login-btn') diff --git a/static/tests/functional/test_cluster_network.js b/static/tests/functional/test_cluster_network.js index dea21731d..40509ca0f 100644 --- a/static/tests/functional/test_cluster_network.js +++ b/static/tests/functional/test_cluster_network.js @@ -55,7 +55,7 @@ registerSuite(() => { .findByCssSelector('.btn-revert-changes') .then( (element) => element.isEnabled() - .then((isEnabled) => !isEnabled || element.click()) + .then((isEnabled) => isEnabled && element.click()) ) .end(); },