Let's start by setting up Playwright in our project. We'll be setting up Playwright in an independent directory which will have its own package.json
file so that the changes in the project do not affect the Playwright tests and vice-versa. So let's start by creating a new directory for the Playwright tests.
Let's initialize playwright here.
As we're using typescript for writing Playwright tests, choose the following configuration in the initializer questionnaire.
We can see that a few files have been generated for us.
Now Playwright has been initialized in our project. We'll see what the entries in the config files mean in the next chapter.
We can see that Playwright has added a few sample specs in the initialized project. We can run them by executing the following command.
We can commit these changes now.
Now let's see how we can configure Playwright according to our needs.