Skip to content

Commit 35b2091

Browse files
RodBerwRodolfo Liberado (BEYONDSOFT CONSULTING INC)
andauthored
Add unit test for getting chromium browser (#467)
* Chromium browser first unit tests * chromiumPath argument validation update * chromiumPath modification * Url validation fix --------- Co-authored-by: Rodolfo Liberado (BEYONDSOFT CONSULTING INC) <[email protected]>
1 parent d052b51 commit 35b2091

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

test/browserHelper.test.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ suite('browserHelper', function () {
88
const currentSystem = process.platform;
99
const chrome = 'chrome';
1010
const edge = 'edge';
11+
const chromium = 'chromium';
1112
const url = 'http://localhost:8000/index.html';
13+
const chromiumPath = 'chromium';
1214

1315
test('Will get Chrome browser target with argument correctly for each system', async () => {
14-
const browserInfo = await browser.getBrowser(chrome, undefined, url);
16+
const browserInfo = await browser.getBrowser(chrome, undefined, url, undefined);
1517
switch (currentSystem) {
1618
case 'win32':
1719
assert.strictEqual(browserInfo.includes('chrome'), true);
@@ -32,7 +34,7 @@ suite('browserHelper', function () {
3234
});
3335

3436
test('Will get Edge browser target with argument correctly for each system', async () => {
35-
const browserInfo = await browser.getBrowser(edge, undefined, url);
37+
const browserInfo = await browser.getBrowser(edge, undefined, url, undefined);
3638
switch (currentSystem) {
3739
case 'win32':
3840
assert.equal(browserInfo.includes('msedge'), true);
@@ -52,6 +54,26 @@ suite('browserHelper', function () {
5254
}
5355
});
5456

57+
test('Will get Chromium browser target with argument correctly for each system', async () => {
58+
const browserInfo = await browser.getBrowser(chromium, undefined, url, chromiumPath);
59+
switch (currentSystem) {
60+
case 'win32':
61+
assert.strictEqual(browserInfo.includes(chromiumPath), true);
62+
assert.strictEqual(browserInfo.includes(url), false);
63+
break;
64+
case 'darwin':
65+
assert.strictEqual(browserInfo.includes(chromiumPath), true);
66+
assert.strictEqual(browserInfo.includes('chromium'), true);
67+
assert.strictEqual(browserInfo.includes(url), false);
68+
break;
69+
case 'linux':
70+
assert.strictEqual(browserInfo.includes(chromiumPath), true);
71+
assert.strictEqual(browserInfo.includes('chromium-browser'), true);
72+
assert.strictEqual(browserInfo.includes(url), false);
73+
break;
74+
}
75+
});
76+
5577
test('Should return without browser info if Showbrowser argument is set to false', async () => {
5678
var opts = {};
5779
opts.target = chrome;

0 commit comments

Comments
 (0)