Questions tagged [playwright-test]
playwright-test is the official test runner of playwright and is especially made for end-to-end testing.
playwright-test
442
questions
1
vote
2
answers
42
views
Playwright API fixture gets timeout
I am trying to implement a fixtures helper file in Playwright so that certain data setup commands used by many tests can be better maintained v having all of these in every test spec that needs to ...
0
votes
0
answers
16
views
Unable to run playwright tests in Jenkins
I am trying to run playwright tests using Jenkins pipeline. Here is the pipeline script:
pipeline {
agent any
// Define the custom workspace directory
environment {
CUSTOM_WORKSPACE = 'C:\\...
0
votes
0
answers
36
views
waitForUrl behaviour in Playwright
I am using page.waitForUrl method to wait for desired url. After clicking the submit button, I am trying to wait for url using
page.waitForURL("/my-test-url/v1/foo/") but getting time out ...
0
votes
0
answers
11
views
run vue playwright e2e tests in GitHub actions
While trying to write my CI using GitHub actions,
This is one step that I'm not able to do, run the e2e tests.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
...
0
votes
1
answer
15
views
PlayWright VS Code Inspector doesn't open inspector
I'm trying to record a test from the vs code extension.
When I click on record new, it opens chromium and new file, but dosn't open any isnpector or something like this, and when I navigate it dosn't ...
1
vote
0
answers
25
views
PerformanceObserver On Page Refresh
I have been using PerformanceObserver API with PlayWright to capture several metrics in my application which. My application has multiple browser instances on Button/link clicks. Metrics like FCP, LCP,...
0
votes
1
answer
89
views
Using Playwright - how to test SVG image by d values?
In the website I'm automating, there are SVG images with icons.
In once scenario, the SVG has a special arrow that points up and right.
<svg class="SecretClass" focusable="false" viewBox="0 0 ...
1
vote
1
answer
249
views
Playwright is not locating data-testId
I'm using data-testid to locate a title entry field on a page. The input field has the tag "createTitle", however when I use the getByTestId method to locate it, the element cant be found ...
0
votes
1
answer
32
views
Excel File is not getting downloaded using waitforEvent('download')
await this.page.waitForEvent('download').then(blobFile => {
blobFile.saveAs(testFolder + '/' + testCaseFileName + blobFile.suggestedFilename())
this.page.waitForTimeout(10000);
fs....
1
vote
0
answers
38
views
How to switch between multiple videos as webcam mock in Playwright tests?
I'm working on a test automation project using Playwright where I need to simulate reading QR codes from the webcam. The test scenario involves reading QR codes from different video files. I'm trying ...
1
vote
1
answer
52
views
Is it possible to write a "isAlertDisplayed" method on a separate AlertHelper file?
I am trying to write a "isAlertDisplayed" method on a separate AlertHelper file using Playwright TypeScript. My test scenario is when a button is clicked for 5 seconds there is no alert.
It ...
0
votes
1
answer
123
views
How to log detailed output log for playwright tests while running in CI
I would like to output detailed playwright tests while running in CI using github actions. Following is my playwright.yml file.
Something like this:
jobSearch.spec.js:39:3 › Search functionality › ...
0
votes
2
answers
178
views
How to use Playwright fixture to modify or add custom command?
I want a custom Playwright command for page.goto called page.gotoDOM that automatically passes the waitUntil: 'domcontentloaded' parameter so I don't have to code it in every test.
I have followed the ...
1
vote
0
answers
27
views
Is there a way that playwright can run the teardown of a playwright project even if test gets interrupted by using cmd + c
projects: [
{
name: 'citizen-users-teardown',
testMatch: '**playwright/tests/bootstrap/users/citizen-users.teardown.ts',
},
{
name: 'citizen-users-setup',
testMatch:...
1
vote
0
answers
45
views
Is there a way to configure credit card details by visiting chrome://settings/payments?
When I try to visit chrome://setttings/payments I am getting error:
Error: page.goto: Target page, context or browser has been closed
Call log:
navigating to "chrome://settings", waiting ...
-1
votes
1
answer
41
views
Playwright - Page elements hierarchy [closed]
An HTML page is essentially a hierarchy of nested nodes. For example, I might have a panel that displays a dialog containing a form, and within that form, a confirmation button.
When locating this ...
0
votes
1
answer
40
views
Playwright test failing: props return different values in Playwright testing UI and actual React app on Chrome browser
I am creating an e2e testing for my application using Playwright (version 1.44.1). I have a react 18 application (created with Vite) for a blogs app. When I run the application the UI shows correct ...
0
votes
0
answers
15
views
Change runsettings file for Cross Browser Testing in Playwright Dotnet
Is there any way for us to just change the runsettings file for Cross Browser Testing in Playwright with dotnet (any Test Runner)? I want each test to run in multiple browsers, so that each test is ...
0
votes
2
answers
151
views
How to continue tests using existing browser session in Playwright with Typescript?
I am trying to use Page Object Model for Playwright UI tests. I have created a setup file for login, as this is always the first step in each test.
import { test as setup, expect } from '@...
1
vote
0
answers
77
views
How to run tests in parallel in playwright having access to the test parameters
Playwright has documentation about how to parametrize tests from using project/fixture options:
import { test as base } from '@playwright/test';
export type TestOptions = {
person: string;
};
...
0
votes
0
answers
44
views
Not able to see context menu dialog on UI and trace mode (Playwright with Typescript)
Trying to verify and expect dialog messages. but can't able to visualize in ui and trace mode.
it displays the page context menu dialog when I run & open the Chromium browser (VS code Extension).
...
0
votes
1
answer
46
views
How could I setup a single ws endpoint for multiple browsers in playwright?
Essentially, I'd like to run my playwright browsers in a container for a cloud application. The test options do offer the setting to setup a remote wsEndpoint but this is for each browser. Is it ...
2
votes
1
answer
176
views
Playwright: Unable to capture URL address of a new tab in headless mode
The test fails in headless mode, but when mode is headless: false test passed.
await productAttachment.element.click(); // this action opens a new page with a pdf attachment
const newPage = await ...
1
vote
1
answer
273
views
Playwright: how to create a static utility method?
I'm trying to think of the best way to make a utility method that utilizes the page.waitForResponse from Playwright. See: https://playwright.dev/docs/api/class-page#page-wait-for-response
Essentially, ...
0
votes
0
answers
47
views
Can't implement playwright in behave steps file
So In steps file I wrote this code and it just stops. Nothing really happens. It opens and closes down in seconds, I can't understand why?
Error: raise Error("Event loop is closed! Is Playwright ...
0
votes
0
answers
13
views
Maintaining Parameters Across Page Redirections in Playwright Automation
Is it feasible to consistently append parameters to URLs in Playwright automation, ensuring they persist through redirects and subsequent page transitions?
When initiating automation with a URL like ...
1
vote
0
answers
130
views
After hooks in playwright takes time to finish
Playwright version: 1.43.1
I am currently investigating why some of my e2e tests are very slow; if it needs to be rewritten or just need to increase the default timeout. I recognize some tests that ...
0
votes
0
answers
23
views
Unable to get textcontent of an element using page.evaluate
I am updating firstname and trying to verify it . I am unable to see the updated firstname in DOM but it is visible in UI. Below is the code I am using
var updatedFirstName = await page.evaluate(() =&...
0
votes
0
answers
55
views
Playwright (1.43.1) trace Viewer fails to render UI
I have encountered a weird issue while testing a specific page on a website. All the tests work as expected, capturing a screenshot to a file works fine, but at some point, after the page gets ...
0
votes
0
answers
32
views
When script is in headless mode facing error: ERR_ABORTED; maybe frame was detached
[2024-04-12 13:22:30,522: INFO/ForkPoolWorker-8] Facing Error: ['Traceback (most recent call last):\n', ' File "/home/venv/lib/python3.10/site-packages/playwright/_impl/_frame.py", line ...
0
votes
0
answers
196
views
Playwright dotenv: Unable to pull values form env file
While integrating environment variables from a .env file at the project’s root directory into Playwright, I’ve encountered an anomaly where the variables are not being recognized during test execution,...
0
votes
2
answers
68
views
Playwright automation exception - Page.LocatorOptions().setHasText() giving 2 elements. How to identify uniquely
I am trying to select a value from an Angular dropdown using Playwright-Java. It is failing due to multiple values found. How to uniquely identify by text.
getPage().locator(obj).click();
...
0
votes
0
answers
50
views
How to click button with Playwright without id [duplicate]
I am using Playwright to log into a site and extract some data. After logging in, I have to click a button to specify what type of user I am. There are two of these buttons, and after inspecting the ...
0
votes
1
answer
576
views
Error: No tests found. Make sure that arguments are regular expressions matching test files
Got this error when I tried to run the playwright test in my vs code -- "Error: No tests found. Make sure that arguments are regular expressions matching test files. You may need to escape ...
0
votes
0
answers
18
views
Playwright sometimes reports false Pass in default report?
async clickSearchReult(context: Context, testInfo:TestInfo,enteredValue: string) {
const [newPage] = await this.newWindowNavigate(context, enteredValue);
//this.addNotestToAccount(...
0
votes
1
answer
68
views
Playwright - asserting expected validation is matching validation result
I have the following code for asserting that the validation error messages are matching with the elements text contents
test('Assert validations are present on the checkout page', async ({ page }) =&...
0
votes
0
answers
47
views
Playwright integration with github: [WebServer] Error: supabaseUrl is required
Im'm new to Playwright and I have been struggling with the integration with github.
On the jobs executed on github actions I have the following error after previous jobs are passed:
Run npx playwright ...
1
vote
0
answers
219
views
What is the difference between `expect(locator).toBeVisible()` and `locator.waitFor()` in Playwright?
I have seen examples of using await locator.waitFor(), to assert whether an element is visible on the page. I would like to know if it should be used this way.
await locator.waitFor()
await expect(...
1
vote
1
answer
35
views
Page refreshes after clicking a button that updates the page; test/assertion times out with two headings but not one
https://youtu.be/dpYMGGSmRaw
I created a simple test that clicks a button, which adds two headings to the pages. This works if I check the text with toHaveText(). However, if I check number of ...
0
votes
0
answers
117
views
Avoid Authentication for Every Test in Playwright
Framework: Nodejs, typescript, Angular
This is the setup of my test:
Using fixture estimatePage in test.beforeAll. The estimatePage fixture used homePage fixture, where the authentication stage ...
-1
votes
1
answer
107
views
Test timing out waiting for click when using Playwright
I am having trouble with my test not working when using playwright.
After I run npm i playwright i proceed to create a new file called 'record1demo.spec.js' in my tests folder. I then run npx ...
0
votes
1
answer
219
views
Integrating Allure Reporting into Playwright Tests Azure Pipeline
I am practicing with Playwright automation and learning to integrate it with CI/CD pipelines in Azure.
I have managed to create a Repo and Pipeline in Azure that runs my Playwright code, but I am a ...
0
votes
1
answer
127
views
Playwright test with file uploading says : Target is closed
I have a playwright test that consists in uploading a file. The test passes under my local environment (Windows, Playwright 1.35.1 with up-to-date deps) on both projects (Chromium and Firefox)
...
1
vote
0
answers
39
views
How to share the locators which are page constructor to other page in playwright?
export class AlertsPage {
readonly page: Page;
readonly alertsToBeApprovedTab: Locator;
readonly alertsToBeReviewedTab: Locator;
readonly allAlertsTab: Locator;
readonly ...
2
votes
1
answer
135
views
How to execute test by exact name (equals) via command in playwright
I'm trying to execute a specific test by it's name.
The problem is that when I'm executing npx playwright test -g "test" grep (-g) executes all test that has the given string ("test&...
0
votes
1
answer
244
views
How to enable Camera and microphone permissions for Safari (webkit) and firefox using playwright?
For my automation test using playwright, my browser need to have camera and microphone permissions. I am able to grant it for chromium browser but unable to do it for Firefox and safari (webkit).
...
0
votes
1
answer
246
views
Is there some command or api to see which browser version was installed for a specific playwright version?
I would like to know which browser versions where installed by Playwright after running npx playwright install —with-deps chromium firefox
Is there some command to see that or is there some playwright ...
0
votes
0
answers
73
views
How to run all the tests across all spec files on single browser instance?
In our scenario, all the tests across different spec file should run on one single browser context.I should open a browser and run all the test cases on the same browser session.How to achieve this ...
1
vote
2
answers
389
views
how to log request object in playwright API testing
I am using Playwright for API testing and to log request object in Playwright using the code below. I tried a few options but none of them worked. Can someone suggest how to do that? Thanks!
test(&...
0
votes
0
answers
308
views
How to use custom Playwright Test Page fixture from separate repository with Typescript?
I am trying to create framework on top of playwright where custom fixtures and other methods can be there. All my tests related project can use framework repository.
With that, I maintain a repository ...