Skip to content

Commit f00bd59

Browse files
authored
Merge branch 'develop' into main
2 parents c284750 + cffaddb commit f00bd59

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/e2e_testing.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,22 @@ test('Recent tab shows layers that were selected', async () => {
141141
- For elements that are not defined in the `selectors.js` file you can use `page.locator()` or any other locator. A full list can be found in the [Playwright Locators docs](https://playwright.dev/docs/locators)
142142
- If you are only performing an action on an element such as `click()` you do not need to define the element as a variable. You can simply write `await page.locator('.recent-tab').click()`
143143
- If you are performing an assertion on an element, you will need to define the element as a variable first `const aquaAerosolRow = await page.locator('#MODIS_Aqua_Aerosol-search-row')` `await expect(aquaAerosolRow).toBeVisible()`
144+
145+
### Running Code Coverage Tests
146+
1. `npm install nyc playwright-test-coverage start-server-and-test`
147+
2. Create the following scripts in the `package.json`
148+
```
149+
"playwright:coverage": "NODE_ENV=playwright nyc playwright test --project=chromium --reporter=list",
150+
"playwright:ci": "start-server-and-test start http-get://localhost:3000 playwright:coverage",
151+
```
152+
3. Add the following to babel.config.js
153+
```
154+
env: {
155+
playwright: {
156+
plugins: ['istanbul']
157+
}
158+
}
159+
```
160+
4. Use VSCode's search & replace tool to search for all instances of "@playwright/test" in the e2e/features directory and replace them with "playwright-test-coverage".
161+
5. Run the `playwright:ci script`
162+
6. After the tests finish, you can view results from the coverage/lcov-report directory index.html file.

0 commit comments

Comments
 (0)