Install Playwright and run your first test
Check Node, create a project with npm init playwright, tour the files it creates, run the example tests and open the HTML report.
Transcript
Before you write a test, you need three things: Node dot J S, a code editor like VS Code, and a terminal. Check that Node is installed with the command node dash dash version.
Then create a project with n p m init playwright at latest. Answer the questions: pick TypeScript, keep the tests folder, and let it install the browsers.
Look at what it created. The tests folder holds your test files. The file playwright dot config dot ts holds the settings. And package dot json lists the packages your project uses.
Run your tests with n p x playwright test. Playwright starts the browsers in the background, runs every test, and prints one result per test.
Then open the report with n p x playwright show dash report. You get a web page with every test, its steps, and its result.
Remember: install with n p m init playwright, run with n p x playwright test, and read the result in the report.
More in this series
1:531Why automate tests?
What manual regression really costs, what is worth automating and what is not, where Playwright fits in the test pyramid, and why your test cases are the valuable part.
1:383Anatomy of a test: from test case to code
Map a manual test case to a Playwright test: the title, the steps as awaited actions, the expected result as an assertion, and how a pass or a failure looks.