| 1 | # E2E Tests |
| 2 | |
| 3 | ## Setup |
| 4 | |
| 5 | When running e2e tests for the first time |
| 6 | |
| 7 | ```bash |
| 8 | npm run e2e:all |
| 9 | ``` |
| 10 | |
| 11 | ## Run |
| 12 | |
| 13 | Depending on what code you update, you can use a faster loop to test your changes: |
| 14 | |
| 15 | - If you update the e2e test code and/or config.yaml/json, you can run `npm run e2e:quick` |
| 16 | - If you update the extension code, you can run `npm run e2e:recompile` |
| 17 | - If you update the gui code, you can run `npm run e2e:rebuild-gui` |
| 18 | |
| 19 | ## Writing tests |
| 20 | |
| 21 | All e2e tests are separated (by folder) into |
| 22 | |
| 23 | - `selectors` - functions that return elements |
| 24 | - `actions` - functions that perform actions on the editor |
| 25 | - `tests` - the actual tests, which are typically longer paths of functionality rather than individual actions |
| 26 | |
| 27 | ### Why are my tests failing? |
| 28 | |
| 29 | - Did you place a `data-testid` on a React component instead of an actual HTML element? |
| 30 | - Do you have a config.yaml locally but the test is failing when running with config.json in CI? |
| 31 | - Is your `data-testid` or selector actually just wrong? |
| 32 | - Are you inconsistently getting different behaviors? You can try adding a `TestUtils.waitForTimeout` between two events if you think it's caused by a race condition. Note that this may lead to flake down the road. |
| 33 | - Alternatively, you can add a `TestUtils.waitForSuccess` |
| 34 | |
| 35 | ### How is it connecting to the LLM? |
| 36 | |
| 37 | - This depends on the model provider written inside the `test-continue/config.json` and `test-continue/config.yaml`. If the model provider is `mock`, it will use `MockLLM`, and if it uses `test`, it will use `TestLLM`. |
| 38 | |
| 39 | ### Quirks |
| 40 | |
| 41 | - For non-macOS systems, `codesign` is not available. You should run `npm run e2e:all-non-mac` instead of `npm run e2e:all`. |