mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 03:09:47 -06:00
While reading the (excellent) documentation here, I noticed a few stale references to `.js` files that are now implemented in TypeScript. * Update `*.js` to `*.ts` in Markdown documentation. * Update `app.js` to `out/dist/app.js` in `docs/SystemdSocketActivation.md`. _I managed to follow these instructions and locally run Compiler Explorer through socket activation after that change._ * Update `*.js` to `*.ts` in the GitHub labeller config `.github/labeler.yml`. _Also correct some misnamed files here. I have checked the new version with `ls $(grep -E "^ - " .github/labeler.yml | sed "s/ - //g")`. If I were more familiar here, I would have liked to add a similar check to the automated tests._ - Sheepishly add myself to the contributors list, despite this being a tiny find-and-replace change. --------- Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>
35 lines
1.4 KiB
Markdown
35 lines
1.4 KiB
Markdown
# Frontend testing
|
|
|
|
We have a mixture of typescript in the main website's code (located in `static/tests`) and Cypress (located in
|
|
`cypress/integration`) to test and report on the workings of that code.
|
|
|
|
But there's always the possibility to use Cypress code to do UI checks and testing.
|
|
|
|
## Recommended
|
|
|
|
The recommended way of testing is to use typescript to test the inner workings of the various interfaces that are
|
|
available.
|
|
|
|
This has the advantage of having types and being able to verify your code is consistent with the rest of the website and
|
|
probably going to run correctly - without having to startup the website and Cypress.
|
|
|
|
## Adding a test
|
|
|
|
Steps to add a test:
|
|
|
|
- Create a new file in `static/tests` (copy paste from `static/tests/hello-world.ts`)
|
|
- Make sure to change the `description` as well as the test
|
|
- Add the file to the imports of `static/tests/_all.ts`
|
|
- Add a test file with a `runFrontendTest()` call in `cypress/e2e`
|
|
|
|
## Starting tests locally
|
|
|
|
You don't need to install an entire X server to actually run cypress (just xfvb).
|
|
|
|
You can find a complete list at https://docs.cypress.io/guides/getting-started/installing-cypress#System-requirements
|
|
|
|
If you have the prerequisites installed, you should be able to run `npx cypress run` - however, you will need to start
|
|
the CE website separately in another terminal before that.
|
|
|
|
Some extra tips can be found [here](../UsingCypress.md)
|