Relative Content

Tag Archive for playwrightplaywright-testplaywright-typescript

How can I extend the Locator class to implement my own custom Locator?

I have a reoccuring element I’d like to build a custom Locator API for. How can I extend the Locator class. It seems like I can only import the interface and implement it. I don’t want rewrite that whole class, I just want to extend it for a few unique methods and flows. How do I import and inherit from the actual class ?

Playwright: How can I extend the Locator class to implement my own custom Locator?

I have a reoccuring element I’d like to build a custom Locator API for. How can I extend the Locator class. It seems like I can only import the interface and implement it. I don’t want rewrite that whole class, I just want to extend it for a few unique methods and flows. How do I import and inherit from the actual class ?

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 record anything

Excel File is not getting downloaded using waitforEvent(‘download’) in Playwright

await this.page.waitForEvent(‘download’).then(blobFile => { blobFile.saveAs(testFolder + ‘/’ + testCaseFileName + blobFile.suggestedFilename()) this.page.waitForTimeout(10000); fs.readdirSync(testFolder).forEach(async file => { if (file.includes(“Summary”) && file.endsWith(“.xlsx”)) { filepath = await (testFolder + ‘/’ + file); await console.log(“Summary Report generated successfully”); } }); }) This is my code, it shows the file is downloaded when I check in headed mode. However, the file is […]

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: ‘**playwright/tests/bootstrap/users/citizen-users.setup.ts’, teardown: ‘citizen-users-teardown’, }, { name: ‘citizen-auth-setup’, use: { …devices[‘Desktop Chrome’] }, testMatch: ‘**playwright/tests/bootstrap/auth/citizen-auth.setup.ts’, dependencies: [‘citizen-users-setup’], teardown: ‘citizen-auth-teardown’, }, { name: ‘citizen-auth-teardown’, use: { …devices[‘Desktop Chrome’] }, testMatch: ‘**playwright/tests/bootstrap/auth/citizen-auth.teardown.ts’, }, { name: ‘full-functional’, use: {…devices[‘Desktop Chrome’] }, dependencies: [‘citizen-auth-setup’], }, ], I have […]

Is there a way that playwright with 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: ‘**playwright/tests/bootstrap/users/citizen-users.setup.ts’, teardown: ‘citizen-users-teardown’, }, { name: ‘citizen-auth-setup’, use: { …devices[‘Desktop Chrome’] }, testMatch: ‘**playwright/tests/bootstrap/auth/citizen-auth.setup.ts’, dependencies: [‘citizen-users-setup’], teardown: ‘citizen-auth-teardown’, }, { name: ‘citizen-auth-teardown’, use: { …devices[‘Desktop Chrome’] }, testMatch: ‘**playwright/tests/bootstrap/auth/citizen-auth.teardown.ts’, }, { name: ‘full-functional’, use: {…devices[‘Desktop Chrome’] }, dependencies: [‘citizen-auth-setup’], }, ], I have […]