playwright-test is the official test runner of playwright and is especially made for end-to-end testing.
Questions tagged [playwright-test]
329 questions
1
vote
1 answer
Playwright PageObjectModel, locator().all() 'Execution context was destroyed, most likely because of a navigation at...'
OK, so I have a simple test with POM.
This is one of the PageObjects Class:
import { Expect, Page, Locator } from "@playwright/test";
export class InventoryPage {
readonly page: Page;
readonly addToCartBtn: Locator;
readonly addToCartBtnAll:…

Adrian Szymansky
- 11
- 2
1
vote
1 answer
Difference between playwright `toBeVisible` and `toBeInViewport`
Using toBeVisible:
const locator = page.locator('.my-element');
await expect(locator).toBeVisible();
Using toBeInViewport:
const locator = page.locator('.my-element');
await expect(locator).toBeInViewport();
What is the difference here? both of…

Muhammed Rahif
- 434
- 1
- 5
- 17
1
vote
1 answer
Can I validate file format of the file within a zip file, using Playwright?
I have a scenario where I need to download a file using Playwright.
When I download, I get the file in a zip format. How can I validate the file format of the actual file that is zipped. While validating manually, I can extract it and see the file…

Krishna H V
- 11
- 2
1
vote
1 answer
Playwright Framework : any way to mark a test to run alone?
Say, I kick off all my 87 (random number here) tests and there are 5 (basically, "some") of them that test on the same page and all of them make changes to that same page... of course, the tests all use the same userid to authenticate. Nope, I…

AlexD
- 561
- 6
- 11
1
vote
2 answers
Playwright - timeout in config is 2mins but i want to wait for 5mins in one my test case without change in the config waittime
I have a timeout for 2 mins in PlaywrightTestConfig file as a Global setting. In one of the test case I want to wait for 10 mins for a file validation to happen.
Global setting for all tests is defined like below:
const config: PlaywrightTestConfig…

Teja
- 13
- 3
1
vote
1 answer
Save static content of HTML but it appears to be dynamic content with scripts
I am trying to save the static content of HTML. However, I see dynamic content like the script is what got captured. Is there a way to capture the raw content ?
Please find the sample code here
import {chromium} from 'playwright'; // Web scraper…

Sunil
- 311
- 1
- 10
1
vote
1 answer
Playwright "setup" project not executing before dependent projects
I'm trying to add a setup project to Playwright like the Auth documentations recommends:
Create a new setup project in the config and declare it as a dependency for all your testing projects. This project will always run and authenticate before all…

Chen Peleg
- 953
- 10
- 16
1
vote
1 answer
Is it possible to generate test titles that depend on asynchronous functions?
I am writing a simple test in playwright that checks if a located value falls within a specific percentage either way of a provided test value. The function returns a boolean. Something like this:
export const percentValueMatch = (expectedValue,…

eglantine benedict
- 11
- 1
1
vote
0 answers
How to store access token automatically in playwright.config file in the playwright
I have run one api test for login where i get a access token in response so how can i store that token in my playwright.config file automatically.

Gopal Sakhiya
- 11
- 3
1
vote
1 answer
Setting the number of `workers` for particular tests in playwright?
I've an e2e test that uses an authenticated user, and uses a button to start a process:
load page
-> click start button
-> load new page
-> check process ends
-> click close (process page)
-> click stop button
(and if the process is…

CodeGorilla
- 811
- 1
- 6
- 21
1
vote
1 answer
How to Fix : TypeError: page.locator(...).toContainText is not a function
Tried Msplaywright for Automation: I was trying to check if the meta description of my site is correct by adding an assertion = .toContainText
Unfortunately, I got this error:
"toContainText is not a function"
enter image description here
Any idea…

Sarah G
- 21
- 10
1
vote
3 answers
How to run specific(selected) test case to run on specific browser playwright
I have many playwright test cases, I want some of the selected test cases to only run on Chrome. How can that be achieved?
Example:
test('test 1', async () => {
});
test('test 2', async () => {
});
test('test 3', async () => {
…

ali
- 492
- 2
- 7
- 18
1
vote
2 answers
Playwright How To Return page from a function that creates a browser context?
I am trying to make a function that opens the browser and logs into the page using basic auth. I would like the function to return the page so I can pick it up in the test and continue to use it.
When I pass browser to the function I need to create…

Scott Littleton
- 21
- 3
1
vote
0 answers
playwright Chromium browser not installed in heroku platform while deploying meteor app
We are deploying meteor app with nodejs in heroku platform.
meteor@1.9.2
Nodejs@1.14.1
Playwright@1.14.0
https://github.com/playwright-community/heroku-playwright-buildpack.git
https://github.com/sunny/chromium-buildpack.git
After deploying the app…

devlp1990
- 41
- 5
1
vote
1 answer
How to run the same test on multiple url in playwright
I want to run the same test for some urls (1000+) and I want to be the quickest as possible.
I loop the test for each url, but when the number of urls exceeds 10, it will cause a timeout error.
I guess this may be because each test is ran…

Tishuang
- 13
- 3