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
Reusing an existing test in same spec file in playwright
Problem Statement : In test.spec.ts I have a describe block inside which I have a test. In the same file, I have another describe block inside which I have a test that needs to call the test in first describe block and then proceed with it's rest of…

utkarsh-k
- 836
- 8
- 17
1
vote
2 answers
Unable to get total number of elements in Playwright
I implemented a Page Object Design pattern to my automation suite and for a simple test case, I'm trying to get total number for elements from a simple table in https://www.saucedemo.com/inventory.html website. But unfortunately im getting
Error:…

AVI
- 5,516
- 5
- 29
- 38
1
vote
1 answer
How to use forEach loop over async/await code to run sequentially
What I want to do :
There is an input box and when you start typing an email id like abc@example.com, it will show you a recommendation list of person names that can have that associated email id you are trying to type. You can click on any person…

utkarsh-k
- 836
- 8
- 17
1
vote
1 answer
In playwright, locating elements that are lazy loaded in HTML
I have an interesting element to locate in playwright.
There is a list of rows that comes up when I visit a URL. The number of records that comes from an API called on that page is say 400 but only first 100 rows from those records are shown in the…

utkarsh-k
- 836
- 8
- 17
1
vote
0 answers
PlayAudit function call is closing the browser/page automatically after first Lighthouse analysis
We are trying to perform Lighthouse analysis on a web application by using Playwright-lighthouse library as a utility by calling it in multiple stages within a single test.
Sample:
Before all {
browser initiation }
test {
goto(url);
await…

user3517391
- 11
- 2
1
vote
1 answer
Having an await inside an expect as well as outside in playwright assertion statement
I was writing some tests in playwright for my application. I encountered an assertion
that passes when written like this -
await expect(await page.locator("#editor-banner > div:nth-child(1)").innerText()).toEqual("Some Heading");
and fails when…

utkarsh-k
- 836
- 8
- 17
1
vote
1 answer
Playwright - setup is not running before tests
I want to run global setup before all the tests using project configuration. This is my playwright.config.ts file -
import { defineConfig } from '@playwright/test';
require('dotenv').config();
export default defineConfig({
testDir: './tests',
…

Saurav Likhar
- 51
- 4
1
vote
1 answer
Playwright- How to set timeout for globalsetup.ts file?
I know that we can set timeout for all the tests using Playwright.config.ts file or through command line argument. Also we can set timeout for each of the tests separately using test.setTimeout() at the beginning of the test.
But in my scenario, I…

Saurav Likhar
- 51
- 4
1
vote
0 answers
waitForLoadState('networkidle') does not work in Playwright
For fully page loading I have used waitForLoadState('networkidle'). It works before but for now randomly error 'Error: page.waitForLoadState: Navigation failed because page was closed!' appeared after test run.
What is the alternative for…

Hellen
- 11
- 1
1
vote
1 answer
Executing Parameterized Playwright Tests in Parallel in Node.JS
I am trying to run Parametrized Playwright tests created with Node.js in Parallel.
SRC: https://playwright.dev/docs/test-parameterize
SRC: https://playwright.dev/docs/test-parallel
However, when I combine the two, the test cases run…

SKR
- 779
- 4
- 17
- 31
1
vote
1 answer
Use OneTimeSetUp with Playwright C#
I am trying to use the "[OneTimeSetUp]" attribute in my TestFixture but I am receiving a NullReferenceException on "Page"? I am using Microsoft.Playwright.NUnit. I can use the "[Setup]" attribute fine but just not the "[OneTimeSetup]"?
I am trying…

user500770
- 11
- 2
1
vote
1 answer
How to run different browser tests for a single test file in playwright sequentially
I am attempting to write a test to cover the 'create account' process of our software. The problem I'm running into is that once an account is created an account with the same credentials cannot be created again. I can delete the account during test…

Kyle R
- 99
- 2
- 12
1
vote
1 answer
Not able close the model using Playwright
I am trying to close a modal using Playwright JS but I am running into issues. Here's the relevant HTML:
1
vote
1 answer
Playwright Tests Fail on Gitlab's CI/CD but working perfectly in Local
const username = process.env.USERNAME as string;
const password = process.env.PASSWORD as string;
test.beforeEach(async ({ page }) => {
await page.goto(neo_bank_portal_login);
await page.fill('[name="username"]', username);
await…

Dids
- 137
- 2
- 2
- 18
1
vote
2 answers
Configuring PlayWright and Jest returns 'Playwright Test needs to be invoked via 'npx playwright test' and excluded from Jest test runs'
I've tried configuring Jest into my Playwright project, so far I've done this
npm init && npm install -D jest jest-playwright-preset playwright
and then added a file called
jest.config.js
which contains
module.exports = {
rootDir:…

Cyro Buosi
- 41
- 2