playwright-test is the official test runner of playwright and is especially made for end-to-end testing.
Questions tagged [playwright-test]
329 questions
5
votes
2 answers
Playwright save storage state only for certain files
I currently have a test pack that has >50 files. 49 of the files will use the same authentication, so I have set up the below inside my playwright config file:
storageState: 'myauth.json',
This allows me to store the state and use…

OrdinaryKing
- 411
- 1
- 7
- 16
4
votes
1 answer
Playwright error: browserType.launch: Timeout 180000ms exceeded at Object.playwrightFixtures.browser.scope [as fn]
Version: "@playwright/test": "^1.29.2"
Browser: Microsoft Edge
Has anyone else also faced similar issue before? I'm getting below error,
"browserType.launch: Timeout 180000ms exceeded at Object.playwrightFixtures.browser.scope [as fn]"
I have 3…

Vishal R
- 189
- 1
- 6
4
votes
0 answers
Playwright - SSH Cert login for website through playwright
I have a requirement where I need to use SSL Certification for each login to the website. I do create cert and key pem files. Not sure how to add it to the code for login.
The feature is open and yet to be worked on in github by the playwright team…

Tester123
- 51
- 1
4
votes
1 answer
Root level Hooks in playwright test
Referring the documentation provided by playwright, seems like the hooks (example: afterAll / beforeAll) can be used only inside a spec/ test file as below:
// example.spec.ts
import { test, expect } from '@playwright/test';
test.beforeAll(async ()…

Allen
- 111
- 1
- 11
4
votes
0 answers
Playwright: .toBeVisible() timeout is ignored
I faced an unclear behavior in the Playwright 1.18 toBeVisible() expectation.
Here is the test row:
await expect(this.page.locator('.top-row .close i')).toBeVisible({timeout: 2000 })
And if the element is not visible, it hangs forever.
If I jump…

Bohdan Nesteruk
- 794
- 17
- 42
4
votes
1 answer
Using multiple test fixtures in a single test with Playwright
// foo.ts
import { test as base } from "@playwright/test";
const test = base.extend<{foo: string}>({
foo: "hello"
});
export { test };
// bar.ts
import { test as base } from "@playwright/test";
const test = base.extend<{bar: string}>({
…

Twisted Whisper
- 1,166
- 2
- 15
- 27
4
votes
2 answers
how can I get playwright to listen to message events
I have a website that communicates through postMessage commands
window.parent.postMessage(communication, this.origin);
When using playwright, I'm trying to do an "on message" handler
function eventListener(returnEvent: any): any {
…

Matt Westlake
- 3,499
- 7
- 39
- 80
4
votes
2 answers
How do I roll to a specific browser version with Playwright?
I need to run some tests using Playwright among different Chromium versions. I have different Chromium folders with different versions, but I don't know how to switch from a version to another using the CLI to run my tests. Some help? Thanks :)

Ciccios_1518
- 435
- 1
- 6
- 13
4
votes
1 answer
Equivalent of by.name selector in playwright
I have been trying to learn playwright and during the course of implementation I am trying to write a test case which find an input element by Name and fills it with some values
Unfortunately, the element has only class and name attributes. I have…

Vivek
- 156
- 3
- 18
3
votes
1 answer
Playwright Compare screenshot against existing image
take clip screenshort
compare screenshort against existing picture stored in my repo
const screenshot = await page.screenshot({ clip: { height: 20, width: 20, x: 630, y: 283 }, path:…

mbdev
- 43
- 1
- 7
3
votes
2 answers
how to implement comparing two screenshots in one test with playwright
I am very new to playwright and i have a problem.
I am trying to implement comparing two screenshots (before and after) in one test.
this is what i want to achieve:
navigate to webpage
take screenshot (before.png)
do some stuff,state changes,…

Luka Mis
- 543
- 1
- 7
- 18
3
votes
1 answer
Playwright API testing: intercept API request
I'm testing a server with Playwright's API testing.
I have a simple GET route, that always returns a 405 not allowed. It also logs that the API route was called. For the sake of this StackOverflow example, I replaced the log with a fetch to a place…

J. Hesters
- 13,117
- 31
- 133
- 249
3
votes
3 answers
Playwright test failure in headless mode
I have a beforeAll function that performs the login in the application I am testing in every test.describe. When I am in headless: false mode, everything works perfectly. This is the beforeAll and the login function:
//before alll…

Pelicer
- 1,348
- 4
- 23
- 54
3
votes
0 answers
Playwright - JS - Accessing objects/variables created in another JS file
I'm using Playwright as my automation tool.
I've defined objects in a dedicated JS file like in the following example:
//UserObjects.js :
let userObject1 = {
section1: {
properties1: {
propery1: "property1",
…

autimation_guy
- 31
- 1
3
votes
1 answer
Playwright; asserting nested `img src` values
Note, this is related to my previous question here: https://stackoverflow.com/a/73043433/4190664
I am looking to further assert somethings within the DOM when I click the 'Print' button.
From troubleshooting I am seeing the following:
the pdfjs…

kmancusi
- 591
- 3
- 20