playwright-community / jest-playwright

Running tests using Jest & Playwright
MIT License
531 stars 74 forks source link

[Question] How to use PlaywrightEnvironment with Typescript? #771

Closed mostor-v closed 2 years ago

mostor-v commented 3 years ago

Hi, I see PlaywrightEnvironment.ts file in repository (src->PlaywrightEnvironment.ts), but while I make yarn install I don't see that file and can't extend it using Typescript. All versions are latest. jest = 27.0.6 ts-jest = 27.0.4 jest-playwright = 1.7.0 playwright = 1.13.0

mmarkelov commented 3 years ago

@mostor-v PlaywrightEnvironment.ts will be compiled to js file. But you should be able to use typescript with your custom environment. It will be pretty close to regular js file https://github.com/playwright-community/jest-playwright#usage-with-custom-testenvironment

mostor-v commented 3 years ago

@mmarkelov I can't use types from PlaywrightEnvironment.ts

mxschmitt commented 2 years ago

jest-playwright is in maintenance mode, we recommend switching to the official test-runner: https://playwright.dev/docs/intro

It supports TypeScript out of the box and contains a lot of testing goodies like web-first assertions, parallelisation etc.