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

feat(browser): add support for custom browser capabilities #3758

Closed

Conversation

haywirez
Copy link

The aim of this PR is to add support for passing custom browser capability arguments for WebdriverIO. This was done rather quickly so improvements and suggestions are welcome, I only saw tests for playwiright.

@stackblitz
Copy link

stackblitz bot commented Jul 11, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Jul 11, 2023

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit 2051f33
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/64c7868dd3e29c0008e2e322

@haywirez haywirez force-pushed the add-custom-webdriverio-capabilities branch 2 times, most recently from f9bd487 to d3fa570 Compare July 11, 2023 18:30
docs/guide/browser.md Outdated Show resolved Hide resolved
@haywirez haywirez force-pushed the add-custom-webdriverio-capabilities branch 6 times, most recently from c9b15da to d8b2994 Compare July 12, 2023 07:19
@haywirez
Copy link
Author

Pushed changed in the spirit of the requested modifications 👍

@haywirez haywirez changed the title Add support for custom WebdriverIO capabilities Add support for custom WebdriverIO/Playwright capabilities Jul 12, 2023
@haywirez haywirez changed the title Add support for custom WebdriverIO/Playwright capabilities feat: add support for custom browser capabilities Jul 12, 2023
docs/guide/browser.md Outdated Show resolved Hide resolved
Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any changes to config types? And how do you pass down these new provider options?

docs/guide/browser.md Outdated Show resolved Hide resolved
docs/guide/browser.md Outdated Show resolved Hide resolved
packages/vitest/src/node/browser/playwright.ts Outdated Show resolved Hide resolved
packages/vitest/src/node/browser/webdriver.ts Outdated Show resolved Hide resolved
@haywirez haywirez force-pushed the add-custom-webdriverio-capabilities branch 2 times, most recently from 9917ccd to 76ba7fc Compare July 12, 2023 13:39
@haywirez haywirez force-pushed the add-custom-webdriverio-capabilities branch 2 times, most recently from 8145b58 to dfc9894 Compare July 13, 2023 07:42
@@ -2,14 +2,23 @@ import type { Awaitable } from '@vitest/utils'
import type { WorkspaceProject } from '../node/workspace'
import type { ApiConfig } from './config'

export interface ProviderSpecificOptions {
webdriverio?: WebDriver.Capabilities | WebDriver.DesiredCapabilities
playwright?: any
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find a good way here to import playwright types only

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this approach will work, because webdriverio is optional dependency. We shouldn't rely on types

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be your preferred way? Would removing added types from package.json and using unknown for both be acceptable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be acceptable for now

@sheremet-va sheremet-va changed the title feat: add support for custom browser capabilities feat(browser): add support for custom browser capabilities Jul 19, 2023
@@ -2,14 +2,23 @@ import type { Awaitable } from '@vitest/utils'
import type { WorkspaceProject } from '../node/workspace'
import type { ApiConfig } from './config'

export interface ProviderSpecificOptions {
webdriverio?: WebDriver.Capabilities | WebDriver.DesiredCapabilities
playwright?: any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this approach will work, because webdriverio is optional dependency. We shouldn't rely on types

@haywirez haywirez force-pushed the add-custom-webdriverio-capabilities branch from dfc9894 to 0ebfedd Compare July 31, 2023 08:34
@@ -57,8 +60,9 @@ export class WebdriverBrowserProvider implements BrowserProvider {
this.cachedBrowser = await remote({
logLevel: 'error',
capabilities: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are passing down only capabilities? Shouldn't it be remote options?

@haywirez
Copy link
Author

haywirez commented Sep 8, 2023

Will take another look in the coming two weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants