diff --git a/packages/wdio-electron-service/test/session.spec.ts b/packages/wdio-electron-service/test/session.spec.ts index 1009f5fe..1eb48f96 100644 --- a/packages/wdio-electron-service/test/session.spec.ts +++ b/packages/wdio-electron-service/test/session.spec.ts @@ -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'; @@ -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', + }, }, ]); });