You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{test,expect,chromium,firefox}from"@playwright/test";test("Run a test - chromium",async()=>{constbrowser=awaitchromium.launch();constcontext=awaitbrowser.newContext();constpage=awaitcontext.newPage();expect(awaitpage.evaluate(()=>1+1)).toBe(2);});test("Run a test - firefox",async()=>{constbrowser=awaitfirefox.launch();constcontext=awaitbrowser.newContext();constpage=awaitcontext.newPage();expect(awaitpage.evaluate(()=>1+1)).toBe(2);});
Run the tests using npx playwright test
Expected behavior
Both tests pass.
Actual behavior
The test "Run a test - firefox" fails with this error:
In the console output, the "Run a test - firefox" test has a [chromium] tag, meaning the chromium project is active, but that should not prevent me from launching a Firefox browser.
This sounds expected, you should never use launch() inside the test and let Playwright launch the browsers for you. We expose fixtures for browser, context, and page: https://playwright.dev/docs/test-fixtures
If you manually launch a specific browser inside your test it basically means you bypass our existing project infrastructure which is supposed to parameterise tests with different browsers.
Version
1.52.0
Steps to reproduce
npm init playwright@latest
playwright.config.js
:npx playwright test
Expected behavior
Both tests pass.
Actual behavior
The test "Run a test - firefox" fails with this error:
Additional context
In the console output, the "Run a test - firefox" test has a
[chromium]
tag, meaning thechromium
project is active, but that should not prevent me from launching a Firefox browser.Environment
The text was updated successfully, but these errors were encountered: