From 1098404f76b6359fd35a7b93744d727c7dcebd32 Mon Sep 17 00:00:00 2001 From: Denys Lins Date: Thu, 3 Aug 2023 17:22:22 -0300 Subject: [PATCH 1/4] fix: add msedge as browser name --- lib/core/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/client.js b/lib/core/client.js index e7e2dda824..e4e576f84b 100644 --- a/lib/core/client.js +++ b/lib/core/client.js @@ -107,7 +107,7 @@ class NightwatchAPI { } isEdge() { - return this.__isBrowserName(Browser.EDGE, 'edge'); + return this.__isBrowserName(Browser.EDGE, 'edge') || this.__isBrowserName(Browser.EDGE, 'msedge'); } isInternetExplorer() { From 3bc290092f36151ef22274760c9d0ed53cbe85a5 Mon Sep 17 00:00:00 2001 From: Denys Lins Date: Tue, 8 Aug 2023 16:08:46 -0300 Subject: [PATCH 2/4] refacto: pass browser name as a list --- lib/core/client.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/core/client.js b/lib/core/client.js index e4e576f84b..e98e4fbc2b 100644 --- a/lib/core/client.js +++ b/lib/core/client.js @@ -68,7 +68,13 @@ class NightwatchAPI { const browserNames = [this.browserName, lowerCaseBrowserName]; if (alternateName) { - return [browser, alternateName].some(name => browserNames.includes(name)); + alternateName = Array.isArray(alternateName) + ? alternateName + : [alternateName]; + + return [browser, ...alternateName].some(name => + browserNames.includes(name) + ); } return browserNames.includes(browser); @@ -107,7 +113,7 @@ class NightwatchAPI { } isEdge() { - return this.__isBrowserName(Browser.EDGE, 'edge') || this.__isBrowserName(Browser.EDGE, 'msedge'); + return this.__isBrowserName(Browser.EDGE, ['edge', 'msedge']); } isInternetExplorer() { From ffa8a0acec8331e49f5caf32d8822b7ebc097724 Mon Sep 17 00:00:00 2001 From: Denys Lins Date: Tue, 8 Aug 2023 16:09:28 -0300 Subject: [PATCH 3/4] test: add test to msedge browser name --- test/src/index/transport/testEdgeOptions.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/src/index/transport/testEdgeOptions.js b/test/src/index/transport/testEdgeOptions.js index f566bb1c79..dba75dfef1 100644 --- a/test/src/index/transport/testEdgeOptions.js +++ b/test/src/index/transport/testEdgeOptions.js @@ -130,5 +130,17 @@ describe('Test edge option', function(){ }); }); + it('BrowserName option', function () { + const client = Nightwatch.createClient({ + desiredCapabilities: { + browserName: 'msedge' + } + }); + const options = client.transport.createSessionOptions(); + + assert.strictEqual(options instanceof EdgeOptions, true); + assert.strictEqual(client.api.isEdge(), true); + assert.strictEqual(client.api.browserName, 'msedge'); + }); }); From a90df7f8380b7911a5351e0458714148aec9a8d6 Mon Sep 17 00:00:00 2001 From: Priyansh Garg <39924567+garg3133@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:34:02 +0530 Subject: [PATCH 4/4] Change test case title. --- test/src/index/transport/testEdgeOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/index/transport/testEdgeOptions.js b/test/src/index/transport/testEdgeOptions.js index dba75dfef1..d442579698 100644 --- a/test/src/index/transport/testEdgeOptions.js +++ b/test/src/index/transport/testEdgeOptions.js @@ -130,7 +130,7 @@ describe('Test edge option', function(){ }); }); - it('BrowserName option', function () { + it('msedge as browserName', function () { const client = Nightwatch.createClient({ desiredCapabilities: { browserName: 'msedge'