Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adnanmc/playwright-multi-project-example
Example setup standalone repo containing test for multiple projects
https://github.com/adnanmc/playwright-multi-project-example
playwright playwright-multi-project playwright-setup playwright-typescript
Last synced: about 2 months ago
JSON representation
Example setup standalone repo containing test for multiple projects
- Host: GitHub
- URL: https://github.com/adnanmc/playwright-multi-project-example
- Owner: adnanmc
- Created: 2024-07-13T12:38:11.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-08-17T21:16:25.000Z (6 months ago)
- Last Synced: 2024-10-31T03:25:34.233Z (3 months ago)
- Topics: playwright, playwright-multi-project, playwright-setup, playwright-typescript
- Language: TypeScript
- Homepage:
- Size: 5.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Playwright Multi Project Test Example
This repo is an example setup to house test for multiple project by defining them in `playwright.config.ts` file like below:
```typescript
projects: [
{
name: 'project1-smoke',
testDir: './tests/project1/smoke',
use: { ...devices['Desktop Chrome'] },
},
]
```## Folders and files
Under `tests/` folder there are 2 projects, `projects1/` and `project2/`. Each project has its `pom/` folder to house all the page object model definitions. There are addition sub folders such as `smoke/` `regression/` to group test for easiness.
`sample.env` can be renamed to `.env` to avoid git commit. For safety rename and use it to store sensitive information such as email, password, auth token, url etc.
Inside `playwright.config.ts` logic exist to load `.env` by default. You can tweak the logic there to manage multiple `.env` files based on different environments such as QA, DEV, STG, PROD etc.
## NPM Command
below `npm` command added in `package.json` file for easiness. Note: `npm run all` will run all the tests for all projects in the `tests/` folder. Run `npm run report` to display report with tracing. Tracing have been turned on inside `playwright.config.ts`. You can refer to playwright docs for more option: https://playwright.dev/docs/api/class-testoptions#test-options-trace
`npm run ui-browser` command will allow you to access the ui mode from browser on localhost:8080
```json
"scripts": {
"ui": "playwright test --ui",
"ui-browser": "playwright test --ui-port=8080 --ui-host=0.0.0.0",
"p1s": "playwright test --project=project1-smoke",
"p2s": "playwright test --project=project2-smoke",
"all": "playwright test",
"report": "playwright show-report"
},
```