-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Playwright and TypeScript #2978
Comments
Thanks @randomactions. All examples in our docs will work in TypeScript (since it is a superset of JS). Are you looking for something in particular? |
Hi Arjun, I am new to TS and would like to see how people implement page object model with TS. I am also wondering how to run TS tests with Mocha or Jest. Do I have to compile them to JS first? |
One of the things I am struggling with is which type "page" should be assigned. When it is an object, then I get "property "goto" does not exist on type object":
|
Playwright provides types for you which you can use:
|
Max, thanks a lot! This helps! Another thing that I might have missed in the documentation is -- does TS need to be compiled to JS with tsc first, or Playwright can manage running TS without compiling? |
Playwright is a library which is written in TypeScript and provides a JavaScript bundle and optional types which Node and your editor like Visual Studio Code can consume. So if you write JavaScript and use type annotations by JSDoc, then you don't need to compile it with |
Thanks a lot! |
Hello,
I am sorry for asking such a stupid question, but is there an example of tests written with Playwright in TS? I would really appreciate sharing this.
The text was updated successfully, but these errors were encountered: