Skip to content

Commit

Permalink
Add unit test for getting chromium browser (#467)
Browse files Browse the repository at this point in the history
* Chromium browser first unit tests

* chromiumPath argument validation update

* chromiumPath modification

* Url validation fix

---------

Co-authored-by: Rodolfo Liberado (BEYONDSOFT CONSULTING INC) <[email protected]>
  • Loading branch information
RodBerw and Rodolfo Liberado (BEYONDSOFT CONSULTING INC) authored Mar 15, 2024
1 parent d052b51 commit 35b2091
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions test/browserHelper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ suite('browserHelper', function () {
const currentSystem = process.platform;
const chrome = 'chrome';
const edge = 'edge';
const chromium = 'chromium';
const url = 'http://localhost:8000/index.html';
const chromiumPath = 'chromium';

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

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

test('Will get Chromium browser target with argument correctly for each system', async () => {
const browserInfo = await browser.getBrowser(chromium, undefined, url, chromiumPath);
switch (currentSystem) {
case 'win32':
assert.strictEqual(browserInfo.includes(chromiumPath), true);
assert.strictEqual(browserInfo.includes(url), false);
break;
case 'darwin':
assert.strictEqual(browserInfo.includes(chromiumPath), true);
assert.strictEqual(browserInfo.includes('chromium'), true);
assert.strictEqual(browserInfo.includes(url), false);
break;
case 'linux':
assert.strictEqual(browserInfo.includes(chromiumPath), true);
assert.strictEqual(browserInfo.includes('chromium-browser'), true);
assert.strictEqual(browserInfo.includes(url), false);
break;
}
});

test('Should return without browser info if Showbrowser argument is set to false', async () => {
var opts = {};
opts.target = chrome;
Expand Down

0 comments on commit 35b2091

Please sign in to comment.