Automate end-to-end test scenarios.
- Language: Typescript
- Framework: Playwright
- Test runner: managed internally by config files in playwright
- Browsers: Chrome, Safari, mobile chrome, mobile safari.
- Reporter: Playwright / Allure
- common: Common files to be reused into all domains/features like api/data/pages/utils
- configs: Files to setup the environment according the execution
- features: Folders with specific tests and steps
- Open the terminal
cd <your_desired_folder>
git clone git@github.com:Marc-AC-93/Playwright-template.git
- Create your local env files:
- src/configs/local.config.ts
- src/configs/env/local/local.env
- Install playwright in local:
npm run update
- Install allure:
npm install -g allure-commandline --save-dev
./runTests.sh [env] [config] -t [tag] -p [project] -r [reporter]
env: Environment where tests are launched
· local: launched directly in your local machine.
· docker: build test repository in docker + launch the tests in docker container.
config: Used config file to setup the test run
· local: using local application
· stage: using staging enviroenment
· prod: using production enviroenment
project: Optional parameter to select a project for current browser, by default if project is not defined will use all the browsers.
· chrome
· safari
· mobileChrome
· mobileSafari
· worker (whithout browser)
tag: Optional parameter to filter test run, use any tag to select the filter desired.
reporter: Optional parameter to open a reporter once the test run finish, if reporter is not selected won't be opened at the end of test run.
· allure
· playwright
./runTests.sh docker local
./runTests.sh docker stage -p worker -t api -r allure
Filter test using grep npm run stage -- <test_parameter>
Test parameters:
- show browsers:
--headed
- filter by project:
--project=safari
- sequential tests:
--workers=1
- invert filter:
--grep-invert '@parallel'
- regular expressions:
-g "(?=.*@parallel)((?=.*@regression))"
- combined regular expressions:
-g "(?=.*@parallel)((?=.*@regression)|(?=.*@$param))"
- sequential test with filters:
--workers=1 --project=safari -g '@param|@regression' --grep-invert '@parallel'
- Playwright: Technical report for QA/DEVs
npm run report_playwright
- Allure: Business report for PO/PM or any project stakeholder
npm run report_allure
- Playwright: Documentation