From 7ff20b3c6bba925114c186ae39377c684156eace Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Sat, 23 Mar 2019 17:52:09 +0100 Subject: [PATCH 1/2] fixed 1561 properly --- lib/helper/WebDriver.js | 3 +++ test/helper/WebDriver_test.js | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 1bc6747c9..4dd07ab6d 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -2069,6 +2069,9 @@ async function forEachAsync(array, callback, option = {}) { throw err; } } + if (values.length === 0) { + return ''; + } return values; } diff --git a/test/helper/WebDriver_test.js b/test/helper/WebDriver_test.js index 3de9de8cd..65374b4a1 100644 --- a/test/helper/WebDriver_test.js +++ b/test/helper/WebDriver_test.js @@ -206,6 +206,7 @@ describe('WebDriver', function () { })); it('should check text is not equal to empty string of element text', () => wd.amOnPage('https://codecept.discourse.group/') + .then(() => wd.seeTextEquals('', '[id="site-logo"]')) .then(() => wd.seeTextEquals('This is not empty', '[id="site-logo"]')) .catch((e) => { e.should.be.instanceOf(Error); From dd68c11f0af1b6c0bc66e5da6eb23d8aee27c511 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Sat, 23 Mar 2019 18:39:41 +0100 Subject: [PATCH 2/2] lint fixed --- lib/assert/equal.js | 3 +++ lib/helper/WebDriver.js | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/assert/equal.js b/lib/assert/equal.js index 323652ce7..768a3ba89 100644 --- a/lib/assert/equal.js +++ b/lib/assert/equal.js @@ -6,6 +6,9 @@ const output = require('../output'); class EqualityAssertion extends Assertion { constructor(params) { const comparator = function (a, b) { + if (b.length === 0) { + b = ''; + } return a === b; }; super(comparator, params); diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 4dd07ab6d..1bc6747c9 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -2069,9 +2069,6 @@ async function forEachAsync(array, callback, option = {}) { throw err; } } - if (values.length === 0) { - return ''; - } return values; }