This is the skeleton Playwright framework for use with internal Scott Logic projects
-
Start by placing/copying this folder/file structure in the
UI
directory of the main project repo. -
You will also need to install the following Node packages in the
UI
directory:npm i -D dotenv
npm i -D @playwright/test
npm i -D totp-generator
npm i -D cross-env
-
We also recommend you add the following scripts to your existing
package.json
"test:e2e": "playwright test"
"test:e2e-debug": "cross-env PWDEBUG=1 playwright test --project=chromium"
This guide will walk you through configuring the totp-generator to handle the MFA steps during an automated login flow
- Create the
.env.playwright
file - Getting the totp-key from your MS profile
- Adding the totp-generator to your approved authentication methods
- In the Summit Explorer UI directory, create a file name
.env.playwright
- Add 4 variables to this file:
testUsername = your SL username
testPassword = your SL password
user = First and Last name (i.e. Kieran Ellis)
totpKey = leave this blank
- Please remember to add the
.env.playwright
file to yourgitignore
as it may contain sensitive credentials
- Got to https://mysignins.microsoft.com/security-info
- Add new sign-in method
- Select Authenticator app
- Click on the link "I want to use a different authenticator app"
- Click on Next and you should see a QR code
- Click on "Can't Scan Image"
- Copy the "Secret Key" - do not close this window
- Add the Secret Key to your
.env.playwright
file as thetotpKey
value - From the UI directory, run
npm run generate-totp
- this should output a 6 digit code, make a copy of this - Back to the Authenticator setup in your browser, click Next and enter the 6 digit code
- Click Next to complete the setup
This has now added the totp-generator
as a valid form of MFA for your Scott Logic account
- Create the
.env.playwright
file - Getting the totp-key from your MS profile
- Adding the totp-generator to your approved authentication methods
- In the Summit Explorer UI directory, create a file name
.env.playwright
(this is already listed in .gitignore so won't get committed) - Add 4 variables to this file:
testUsername = your SL username
testPassword = your SL password
user = First and Last name (i.e. Kieran Ellis)
totpKey = leave this blank
- Got to https://mysignins.microsoft.com/security-info
- Add new sign-in method
- Select Authenticator app
- Click on the link "I want to use a different authenticator app"
- Click on Next and you should see a QR code
- Click on "Can't Scan Image"
- Copy the "Secret Key" - do not close this window
- Add the Secret Key to your
.env.playwright
file as thetotpKey
value - From the UI directory, run
npm run generate-totp
- this should output a 6 digit code, make a copy of this - Back to the Authenticator setup in your browser, click Next and enter the 6 digit code
- Click Next to complete the setup
This has now added the totp-generator
as a valid form of MFA for your Scott Logic account