diff --git a/packages/browser/package.json b/packages/browser/package.json index e79fa6f0fd10..ca25dd6cabc5 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -51,7 +51,6 @@ }, "peerDependencies": { "playwright": "*", - "safaridriver": "*", "vitest": "^1.0.0", "webdriverio": "*" }, diff --git a/packages/browser/src/node/providers/webdriver.ts b/packages/browser/src/node/providers/webdriver.ts index 311e445a8a7f..9480ba6a5716 100644 --- a/packages/browser/src/node/providers/webdriver.ts +++ b/packages/browser/src/node/providers/webdriver.ts @@ -14,7 +14,6 @@ export class WebdriverBrowserProvider implements BrowserProvider { public name = 'webdriverio' private cachedBrowser: WebdriverIO.Browser | null = null - private stopSafari: () => void = () => {} private browser!: WebdriverBrowser private ctx!: WorkspaceProject @@ -39,14 +38,6 @@ export class WebdriverBrowserProvider implements BrowserProvider { if (this.browser === 'safari') { if (options.headless) throw new Error('You\'ve enabled headless mode for Safari but it doesn\'t currently support it.') - - const safaridriver = await import('safaridriver') - safaridriver.start({ diagnose: true }) - this.stopSafari = () => safaridriver.stop() - - process.on('beforeExit', () => { - safaridriver.stop() - }) } const { remote } = await import('webdriverio') @@ -97,7 +88,6 @@ export class WebdriverBrowserProvider implements BrowserProvider { async close() { await Promise.all([ - this.stopSafari(), this.cachedBrowser?.sessionId ? this.cachedBrowser?.deleteSession?.() : null, ]) // TODO: right now process can only exit with timeout, if we use browser diff --git a/test/browser/package.json b/test/browser/package.json index 6f1f4214b041..a190c82e6808 100644 --- a/test/browser/package.json +++ b/test/browser/package.json @@ -6,6 +6,7 @@ "test": "pnpm run test:webdriverio && pnpm run test:playwright", "test:webdriverio": "PROVIDER=webdriverio node --test specs/", "test:playwright": "PROVIDER=playwright node --test specs/", + "test:safaridriver": "PROVIDER=webdriverio BROWSER=safari node --test specs/", "coverage": "vitest --coverage.enabled --coverage.provider=istanbul --browser.headless=yes" }, "devDependencies": { diff --git a/test/browser/specs/runner.test.mjs b/test/browser/specs/runner.test.mjs index 49bba6971186..ed8fd9fd4dbe 100644 --- a/test/browser/specs/runner.test.mjs +++ b/test/browser/specs/runner.test.mjs @@ -4,8 +4,12 @@ import test from 'node:test' import { execa } from 'execa' const browser = process.env.BROWSER || (process.env.PROVIDER === 'playwright' ? 'chromium' : 'chrome') +const argv = ['vitest', '--run', `--browser.name=${browser}`] -const { stderr, stdout } = await execa('npx', ['vitest', '--run', `--browser.name=${browser}`, '--browser.headless'], { +if (browser !== 'safari') + argv.push('--browser.headless') + +const { stderr, stdout } = await execa('npx', argv, { env: { ...process.env, CI: 'true',