Questions tagged [playwright-test]

playwright-test is the official test runner of playwright and is especially made for end-to-end testing.

329 questions
1
vote
1 answer

How to click the right button when there are two buttons with same text

There are two buttons both with Login as inner text

Log in by Email


Email:

Log in…

Clara Lee
  • 35
  • 6
1
vote
0 answers

How do I use both the --save-storage feature to save auth while using a custom setup?

On this page, Playwright recommends to use the --save-storage option with Codegen in order to save the auth state. It also recommends just below to run a JS script instead of calling Codegen in CLI if we want to use a custom setup. Now, I need to do…
1
vote
0 answers

How can I configure Playwright programmatically to take screenshots on failure?

I am using Cucumber integration with Playwright (e.g. https://github.com/e2e-boilerplate/playwright-commonjs-cucumber-expect/blob/master/features/support/steps.js). Because of this I don't have a playwright config file and I launch the browser…
goofballLogic
  • 37,883
  • 8
  • 44
  • 62
1
vote
1 answer

How to detect "Uncaught (in promise) TypeError" in Playwright?

I'm using Playwright to test my TypeScript webapp, and I want to ensure no errors are logged to the console. (I want my tests to fail if an error occurs.) To do so, based on this post, I use the following code: import { test as base, expect } from…
Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76
1
vote
1 answer

Why test performance become worse when worker count increasing?

I have 4 kinds of test cases with the same steps for each type. When I use 1 worker, the case duration looks better. When I tried to increase the worker number to 2, 4, and 6, the case duration became longer. Some case duration is doubled. Here is…
Gavin Wang
  • 11
  • 2
1
vote
1 answer

Is there a Test Explorer for Playwright?

I am looking for a tests explorer for Playwright that has a GUI, similar to what Cypress has (as shown in the screenshot). That is, an interface that allows you to visualize and run your tests, but I find that in Playwright you can only run the…
Lewis Munene
  • 134
  • 7
1
vote
1 answer

Playwright: how to test the order in which elements load

I keep getting TimeoutError with page.wait_for_selector('selector'). The method page.wait_for_load_state() doesn't help either so I am using time.sleep() as an alternative. Is there a way to study which elements of page load and in what order. Is…
charsee
  • 33
  • 4
1
vote
1 answer

Unable to open playwright HTML Report (using Docker)

I have pulled the image using below command into my root of the project docker pull mcr.microsoft.com/playwright:v1.24.2-focal and then run the image using below command: docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.24.2-focal…
syed1234
  • 761
  • 5
  • 12
  • 30
1
vote
0 answers

Playwright page reference is not initialised to the page constructors

Abstract: Launch the Chrome extension background page and continue with the test. How is it implemented? All the pages are (Login, Admin pages) with the page object model. Invoke the persistent context browser with the chrome extension URL and pass…
ramkumar-yoganathan
  • 1,918
  • 3
  • 13
  • 29
1
vote
1 answer

How to set the `Accept-Language` header for one test in Playwright?

How can I set the Accept-Language header for one test call in Playwright ? E.g.: import { test, expect } from '@playwright/test'; test( 'language is interpreted correctly', async function({ page, context }) { // ----- // HERE: Set the…
kca
  • 4,856
  • 1
  • 20
  • 41
1
vote
1 answer

Setting default browser when debugging playwright tests

I am trying to figure out how to change the default browser when debugging playwright tests using VSCODE. Currently, in VSCODE when I run or debug it defaults to chrome. I want to change that to use webkit and cannot seem to find where that…
1
vote
2 answers

One time authentication in playwright is giving issues

I tried to have a one time authentication using session and use the same for all the tests in the spec file. While trying to run my test , sometimes i get this below error which im unable to underdstand or fix. Any help on this would be…
1
vote
1 answer

can i run playwright outside of 'with'?

how can i run browser = sync_playwright().chromium.launch() according to documentation, playwrite must be run with with with sync_playwrith as p: what causes my browser to close as soon as 'with' ends taking sync_playwright() out of with I want my…
1
vote
2 answers

How to compose fixtures in playwright

I want to compose fixtures. The first fixture should always be available (think of it as base class). second fixture will vary in different test files (think of it as derived class) I tried following code and it's working as I was expecting. Is this…
hasan.in
  • 559
  • 6
  • 16
1
vote
1 answer

How to set source root directory via PLAYWRIGHT_JAVA_SRC environment variable when source collection is enabled

I'm trying to run my first Playwright trace using java and i'm getting below error, I'm not sure what i'm missing out and I'm running mu code in Intlij Playwright playwright = Playwright.create(); Browser browser =…
Deepak_Mahalingam
  • 454
  • 1
  • 9
  • 21