Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test for getting chromium browser #467

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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