Playwright is an open-source automation library for browser testing and web scraping developed by Microsoft.
TypeScript extends JavaScript by adding types to the language.
- Fluent Interface is an object-oriented API whose design relies extensively on method chaining.
- pageObect.someFunction()
- pageOject.someElement().click()
- Page Object Model is a Design Pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication.
- The "login" screen will have a "Login page object" that contains the selectors for elements on the page and functions that can be performed on that page.
- Install NodeJS LTS
- Open the root folder using VS Code
- If you use GitHub Desktop, select the "Open in Visual Studio" button
- Open the integrated terminal
- Run
npm install
to install dependencies noted in package.json - Run
npx playwright install
to install browsers - In the root folder create a new file called
.env
- Copy+Paste the following
TEST_BASE_URL="https://the-internet.herokuapp.com" TEST_USER="tomsmith" TEST_PASS="SuperSecretPassword!"
- Save
- [One-Time Setup] Install Playwright Test for VSCode
- Select the "Testing" tab
- Click "Run Test"
- To view results, check the "TEST RESULTS" pane
- In the integrated terminal run
npx playwright test
- To view results run
npx playwright show-report
- Alternatively, in VS Code right-click
playwright-report\index.html
and select "Open with Live Server"
- Alternatively, in VS Code right-click
- [One-Time Setup] Open the
/settings
page for this repo.- Select "Secrets and variables" > "Actions"
- Select "New repository secret"
- For "Name" enter
TEST_BASE_URL
and for "Secret" enterhttps://the-internet.herokuapp.com
- Select "New repository secret"
- For "Name" enter
TEST_USER
and for "Secret" entertomsmith
- Select "New repository secret"
- For "Name" enter
TEST_PASS
and for "Secret" enterSuperSecretPassword!
- When code is commited the GHA will run, see Actions