Skip to content

Commit c726fe5

Browse files
ETtestimBaruch Odembaruchiro
authored
Docs: E2E tests instructions (#92)
Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com> Co-authored-by: Baruch Odem <baruchiro@gmail.com>
1 parent 7ed9eda commit c726fe5

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ To start developing the extension locally, follow these steps:
108108

109109
You can now test and debug the extension on _Chrome_ or _Firefox_.
110110

111+
#### Testing
112+
113+
To run unit tests, use `yarn test`. We use [Jest](https://jestjs.io/) for testing.
114+
115+
For end-to-end tests, see the [e2e/README.md](e2e/README.md) file.
116+
111117
### Resources
112118

113119
- A YouTube video for the [Ma'akaf community](https://discord.gg/fyZ8A5nb) about [how to start to contribute to this project](https://youtu.be/OnxaCXPAWAs) (in Hebrew).
@@ -120,6 +126,7 @@ You can now test and debug the extension on _Chrome_ or _Firefox_.
120126
- https://www.linkedin.com/in/bar-lanyado-bb50b3110/
121127
- https://www.linkedin.com/in/bogdan-kortnov-58996b213/
122128
- https://www.linkedin.com/in/uriklar/
129+
- https://www.linkedin.com/in/elad-tal-0355531b7/
123130
- You?
124131

125132
## License

e2e/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# End-to-End Testing with Playwright
2+
3+
## Creating a test
4+
5+
1. Go to the right e2e file and add a test with specific name.
6+
2. create the test with minimal overhead (fewer locators, fewer API calls, etc).
7+
8+
## Run and Debug a test
9+
10+
1. download the [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) extension.
11+
2. You will see a small green play button near the test you created or want to run.
12+
3. If the test failed you need to debug it.
13+
4. Go to the fixtures file and remove the `--headless=new` from args (this will run the test on a browser on your computer), you can also uncomment the `slowMo` for seeing each step.
14+
5. Run in your terminal `yarn e2e:debug`. It will open a Playwright modal with a browser so you can see and debug each step.
15+
6. Fix the problems and run also in headless mode (undo step 4)
16+
17+
## Problems?
18+
19+
Ask around, and check the [Playwright docs](https://playwright.dev/docs/intro).
20+
Found an issue? Did we miss a case?
21+
You're welcome to open an issue or talk with us on [Discord](https://discord.gg/H2SMbzh5).

tests/README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,3 @@ These tests are _Integration Tests_ that are used to check our code against real
55
To avoid _Too Many Requests_ block, we are saving the webpages snapshot by running the `yarn update-webpages-snapshot` command manually.
66

77
Then, we are running our code against the local snapshots.
8-
9-
# Manual Test Script
10-
11-
## What we testing
12-
13-
- The extension is able to detect the packages in the page
14-
- The page contacting with the background script
15-
- The background script is able to fetch the advisories from the API
16-
- The popup is working correctly
17-
- Changes in the popup affect the indicator immediately
18-
19-
## Prerequisites
20-
21-
- Install the extension on _Chrome_ and _Firefox_ browsers
22-
- Have a test page ready (e.g. https://stackoverflow.com/questions/33527653)
23-
24-
## Steps
25-
26-
1. Open the test page on both browsers
27-
2. Verify that the indicator appears on the packages in the page and shows the number of issues
28-
3. Click on the extension logo to open his popup
29-
4. Verify that the popup shows the details of the advisories and has a toggle button to enable or disable them
30-
5. Click on the toggle button to disable the advisories
31-
6. Verify that the indicator updates and shows zero issues
32-
7. Refresh the page and verify that the indicator is still zero

0 commit comments

Comments
 (0)