playwright-test is the official test runner of playwright and is especially made for end-to-end testing.
Questions tagged [playwright-test]
329 questions
15
votes
14 answers
Playwright VSCode gives `No tests found` message
I've installed the Playwright vscode extension but when I go to the testing area I get a "No tests have been found in this workspace" message. But when I run $> playwright test on the CLI it works like a charm. The weird thing is, that some time ago…

Jeanluca Scaljeri
- 26,343
- 56
- 205
- 333
14
votes
1 answer
How to achieve browser resizing in run time using playwright? in a e2e test run
We have in protractor like:
browser.driver.manage().window().setSize(
width - 30,
height
);
How to achieve this in playwright?

Sangeetha
- 151
- 2
- 4
13
votes
4 answers
Playwright before each for all spec files
I very new to Playwright. Due to my test suites, I need to login into my application before running each test. Inside a single spec file that is easy, I can simply call test.beforeEach. My issue is: I need to before the login before each test of…

Pelicer
- 1,348
- 4
- 23
- 54
9
votes
2 answers
Playwright - Test against different environments and different variables
Im looking to use Playwright to test against a web page.
The system im working on has 4 different environments that we need to deploy against,
for example the test urls may be
www.test1.com
www.test2.com
www.test3.com
www.test4.com
The first…

OrdinaryKing
- 411
- 1
- 7
- 16
8
votes
2 answers
How to console.log in playwright
I want to log one of the variables inside the playwright test case but am unable to load the log in developer tools console as I am using a page.on() function
test('largest contentful paint', async ({ page }) => {
await…

ali
- 492
- 2
- 7
- 18
8
votes
1 answer
How to run a Playwright test on specific browsers and viewport
I have an E2E tests suite with Playwright that runs on different browsers and viewports.
I specified the different browsers and viewports in my playwright.config.ts:
projects: [
{
name: 'chromium',
use: {
...devices['Desktop…

J. Hesters
- 13,117
- 31
- 133
- 249
8
votes
1 answer
TypeScript + Playwright Error: Cannot find module
I ran into a problem coding test automation with playwright.
When running the test,
the following error occurs at test.spec.ts:
Error: Cannot find module '@common/common'
code: 'MODULE_NOT_FOUND'
How to solve this problem?
there are codes…

안성민
- 163
- 1
- 1
- 5
7
votes
4 answers
Playwright tests - using variable from .env file
I've got Playwright test written using TypeScript and I would like to use variables from .env in my test file, how can I do that?

MichalG
- 221
- 1
- 4
- 11
6
votes
4 answers
Playwright - how to wait for an element to be clickable
like in selenium, do we have option in Playwright to wait for an element to be clickable ?

sumit
- 91
- 1
- 1
- 5
6
votes
1 answer
How to run particular file with Playwright?
A have multiple test files into specific folder with extension spec.ts, how I can run particular file with Playwright.
Currently for configuration is set as test folder and will run all files (tests) from it:
testDir: './smokeTests',
Assume that is…

Gaj Julije
- 1,538
- 15
- 32
6
votes
3 answers
Error: Cannot find module '@playwright/test'
I am currently trying to use expect to do assertions by using const { expect } = require('@playwright/test'); but every time I get Error: Cannot find module '@playwright/test'. It is a very short script but something is wrong with that.
const {…

Antonio contreras
- 107
- 1
- 1
- 5
5
votes
1 answer
TS/playwright - how to post api request with x-www-form-urlencoded body?
I need to create playwright API request with x-www-form-urlencoded body:
Example from postman:
working postman request example
I was trying to it that way:
async getNewApiAccesToken({request})
{
const postResponse = await…

kiwiKiwiKiwi
- 111
- 4
5
votes
2 answers
How can I use browserContext in the playwright test runner?
I'm using playwright to test a PWA (Progressive Web App) and I want to test the offline behavior.
browserContext has a setOffline method.
When calling playwright as a library, I can set browserContext like this:
// example.js
const playwright =…

Patrick Kenny
- 4,515
- 7
- 47
- 76
5
votes
2 answers
Playwright: Two elements with the same name, how to fill the one that is visible?
I have an Ionic React app that uses react-router 5 to display various pages.
The app defaults to a login form, but if users go to the support page, there is a contact form.
I'm trying to test the contact form in Playwright with code like this:
…

Patrick Kenny
- 4,515
- 7
- 47
- 76
5
votes
3 answers
How can I set the baseURL for expect in playwright?
In my Playwright tests, I set the base-url according to the docs:
const config: PlaywrightTestConfig = {
projects: [
{
name: 'Safari MacBook Air',
use: {
browserName: 'webkit',
viewport: {
width: 2560,
…

Patrick Kenny
- 4,515
- 7
- 47
- 76