Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 1,413: Line 1,413:


== Section 8: Advanced ==
== Section 8: Advanced ==
=== NPM Scripts and CLI Commands ===
=== npm Scripts and CLI Commands ===
<nowiki>
npx playwright test usePageObjects.spec.ts --project=chromium
npx playwright show-report
npx playwright test usePageObjects.spec.ts --project=firefox
</nowiki>
 
In file: <code>package.json</code> add these to scripts node
<nowiki>
"pageObjects-chrome": "npx playwright test usePageObjects.spec.ts --project=chromium",
"pageObjects-firefox": "npx playwright test usePageObjects.spec.ts --project=firefox",
"pageObjects-all": "npm run pageObjects-chrome & npm run pageObjects-firefox"</nowiki>
 
<nowiki>
npm run pageObjects-chrome
npm run pageObjects-firefox
npm run pageObjects-all</nowiki>
 
Notes:
* && runs sequentially
* & runs parallely
* On windows npm scripts are executed in cmd.exe by default, use this to change it to bash <code>npm config set script-shell "C:/Program Files/Git/bin/bash.exe"</code>
 
=== Test Data Generator ===
=== Test Data Generator ===
=== Test Retries ===
=== Test Retries ===

Navigation menu