Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox, and WebKit with a single API. It is built to enable cross-browser web automation that is reliable and fast. Playwright, also has its own test runner for end-to-end tests called Playwright Test. Some of its other features include:

  • Can execute tests in parallel.
  • Provides context isolation out of the box.
  • Captures videos, screenshots, and other artifacts on failure.
  • Integrates your POM’s as extensible fixtures.
  •  
    Playwright provides a very interactive method of installation using the init command. Let’s look into it step by step. The following steps are based on the assumption that Node JS is installed on your system. Also, the below steps will work for both Windows and MAC machines.

    Step 1: Create your project folder and run the command at the root level:

    1
    npm init playwright

     
    Step 2: Next, choose the language you want to use in your project – ‘Javascript’ or ‘Typescript’.

    playwright init typescript
     
    Step 3: Next, add the folder name where you want to keep your tests. By default, the folder name is ‘tests’.

    playwright init tests folder
     
    Step 4: Next, choose if you want to add a Github Actions workflow to your project. By default, it is set to yes(Y).

    playwright init github actions
     
    Step 5: Finally, when everything is selected, Playwright will install all necessary dependencies and will also create the project structure.

    playwright init complete
     
    Step 6: To make sure everything is set up correctly, we will now execute the example test that was created during the installation.

    1
    npx playwright test

    playwright example test execution

    Do check out 🙂

    Github: https://github.com/alapanme/Playwright-Automation