Playwright Implementation

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.

 

First off, You may need to install latest node and npm before installing playwright.

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

npm init playwright

 

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

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

Step 4: Next, choose if you want to add a Github Actions workflow to your project. By default, it is set to yes(Y). in our case we would select n

 

Step 5: Once It’s installed , you can open your code ide (VS code) to check the playwright project

Step 6: run your test

npx playwright test

 

Note: npx is the npm package runner CLI.

 

Existing issues:

we only allow trusted devices & browsers, and we don’t have a non-prod authentication environment. As such when testing via none headless , the browser would be opened in-private / cognito mode.

 

Solution:

1- If we had a SSO with a dev/test environment where we could disable MFA this would provide us the ability to run automated tests with significantly less effort. (this solutions is against the security policies.)

2- having a TC generic testing AAD account with MFA disabled would be good option