Skip to content

Commit

Permalink
Merge branch 'sm/improve-no-binary' of https://github.com/webdriverio…
Browse files Browse the repository at this point in the history
…-community/wdio-electron-service into sm/improve-no-binary
  • Loading branch information
goosewobbler committed Dec 11, 2024
2 parents db1fc72 + caf49df commit fe3bfb3
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions packages/wdio-electron-service/test/session.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, vi, expect } from 'vitest';
import { describe, it, vi, expect, beforeAll } from 'vitest';

import { init } from '../src/session.js';

Expand All @@ -25,19 +25,43 @@ vi.mock('../src/launcher.js', () => ({
vi.mock('webdriverio', () => ({ remote: async () => Promise.resolve(browserMock) }));

describe('init', () => {
beforeAll(() => {
vi.clearAllMocks();
});
it('should create a new browser session', async () => {
const session = await init({});
expect(session).toStrictEqual(browserMock);
});

it('should call onPrepare with the expected parameters', async () => {
await init([{ 'browserName': 'electron', 'wdio:electronServiceOptions': { appBinaryPath: '/path/to/binary' } }]);
await init([
{
'browserName': 'electron',
'browserVersion': '99.9.9',
'wdio:electronServiceOptions': {
appBinaryPath: '/path/to/binary',
},
'goog:chromeOptions': {
args: ['--disable-dev-shm-usage', '--disable-gpu', '--headless'],
},
'wdio:chromedriverOptions': {
binary: '/path/to/chromedriver',
},
},
]);
expect(onPrepareMock).toHaveBeenCalledWith({}, [
{
'browserName': 'electron',
'browserVersion': '99.9.9',
'wdio:electronServiceOptions': {
appBinaryPath: '/path/to/binary',
},
'goog:chromeOptions': {
args: ['--disable-dev-shm-usage', '--disable-gpu', '--headless'],
},
'wdio:chromedriverOptions': {
binary: '/path/to/chromedriver',
},
},
]);
});
Expand Down

0 comments on commit fe3bfb3

Please sign in to comment.