-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
In VS Code, we use @playwright/test
, @playwright/browser-chromium
and now we want to adopt @playwright/mcp
for our inner dev loop.
@playwright/mcp
depends on:(or some other locked alpha version)"playwright": "1.55.0-alpha-2025-08-07", "playwright-core": "1.55.0-alpha-2025-08-07",
@playwright/test
locks to whatever version is specified so"playwright": "1.54.2"
in my case^1.54.2
is what we use for@playwright/test
@playwright/browser-chromium
which is brought in via another package and resolves to using"playwright-core": "1.54.2"
I'm trying to reuse a lot of the automation code we have that leverages @playwright/test
in a @playwright/mcp
connection.
The issue is that there are types here that aren't the same... here's some examples from bumping various packages to get this working:
Error: monaco.test.ts(142,20): error TS2345: Argument of type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Page' is not assignable to parameter of type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Page'.
The types returned by 'evaluateHandle(...)' are incompatible between these types.
Type 'Promise<import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").ElementHandle<any>>' is not assignable to type 'Promise<import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").ElementHandle<any>>'.
Type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").ElementHandle<any>' is not assignable to type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").ElementHandle<any>'.
The types returned by '$(...)' are incompatible between these types.
Type 'Promise<ElementHandleForTag<any> | null>' is not assignable to type 'Promise<ElementHandle<SVGElement | HTMLElement> | null>'.
Type 'ElementHandleForTag<any> | null' is not assignable to type 'ElementHandle<SVGElement | HTMLElement> | null'.
Type 'ElementHandleForTag<any>' is not assignable to type 'ElementHandle<SVGElement | HTMLElement>'.
Types of property 'screenshot' are incompatible.
Type '(options?: { animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; } | undefined) ...' is not assignable to type '(options?: { animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; } | undefined) => Pro...'.
Types of parameters 'options' and 'options' are incompatible.
Type '{ animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; } | undefined' is not assignable to type '{ animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; } | undefined'.
Type '{ animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; }' is not assignable to type '{ animations?: "disabled" | "allow" | undefined; caret?: "hide" | "initial" | undefined; mask?: import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator[] | undefined; ... 7 more ...; type?: "png" | ... 1 more ... | undefined; }'.
Types of property 'mask' are incompatible.
Type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator[] | undefined' is not assignable to type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator[] | undefined'.
Type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator[]' is not assignable to type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator[]'.
Type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator' is not assignable to type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator'.
Types of property 'and' are incompatible.
Type '(locator: import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator) => import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator' is not assignable to type '(locator: import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator) => import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator'.
Types of parameters 'locator' and 'locator' are incompatible.
Type 'import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator' is not assignable to type 'import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator'.
The types of 'contentFrame().locator' are incompatible between these types.
Type '(selectorOrLocator: string | import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator, options?: { has?: import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator | undefined; hasNot?: impor...' is not assignable to type '(selectorOrLocator: string | import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator, options?: { has?: import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator | undefined; hasNot?: import("/home/run...'.
Types of parameters 'selectorOrLocator' and 'selectorOrLocator' are incompatible.
Type 'string | import("/home/runner/work/vscode/vscode/node_modules/playwright/node_modules/playwright-core/types/types").Locator' is not assignable to type 'string | import("/home/runner/work/vscode/vscode/node_modules/@playwright/test/node_modules/playwright-core/types/types").Locator'.
Type 'Locator' is not assignable to type 'string | Locator'.
Argument of type '() => Promise<import("d:/Code/microsoft/vscode/node_modules/playwright/node_modules/playwright-core/types/types").BrowserContext>' is not assignable to parameter of type '() => Promise<import("d:/Code/microsoft/vscode/test/mcp/node_modules/playwright-core/types/types").BrowserContext>'.
Type 'Promise<import("d:/Code/microsoft/vscode/node_modules/playwright/node_modules/playwright-core/types/types").BrowserContext>' is not assignable to type 'Promise<import("d:/Code/microsoft/vscode/test/mcp/node_modules/playwright-core/types/types").BrowserContext>'.
Property 'setStorageState' is missing in type 'import("d:/Code/microsoft/vscode/node_modules/playwright/node_modules/playwright-core/types/types").BrowserContext' but required in type 'import("d:/Code/microsoft/vscode/test/mcp/node_modules/playwright-core/types/types").BrowserContext'
and when they are the same, I get functionality differences when I pass in a context created from 1.54 of playwright
and pass it in to @playwright/mcp
which expects 1.55-alpha where I get:
### Result
Error: Ref not found, likely because element was removed. Use browser_snapshot to see what elements are currently on the page.
for any "run type text" tool calls but once I update to have our @playwright-core
version.
I need a stable dependency tree so that we can really take advantage of @playwright/mcp
and depending on all alphas (and forcing packages to use those alphas) is a recipe for failures.
- forcing my dependencies to use a specific version of their dependency is going to be fragile
- "alpha" for a prod release isn't a great practice