# Testing Strategy

When a PR is submitted, a series of tests will be run with Github actions. It is fine to just submit your PR and let the tests run on Github. However, if the tests fail, you may need to run the tests locally to investigate what's going on, then either fix the tests, or fix your code.

## Running Cypress tests locally

[Cypress](https://www.cypress.io/) is a frontend test framework that is used on part of Portal.

To run Cypress tests locally, you need two shell windows.

**Shell #1**

The following will run the portal/game on local server.

```
./run
```

**Shell #2**&#x20;

This will run the Cypress tests in the terminal.

```
yarn run cypress run
```

If you want to view the tests as they run using Cypress' test runner window, you can run:

```
yarn run cypress open
```

## Running Selenium tests locally

Selenium is a frontend test framework that is **used in Rapid Router and in Portal**. We aim to gradually migrate Selenium tests to Cypress.

**To run Selenium tests you need to install chromedriver**. Please check here on [how to install](https://chromedriver.chromium.org/getting-started) for your OS.

Similar with Cypress, it will launch a browser windows and you should be able to see a series of frontend actions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codeforlife.education/software-developer-guide/front-end/testing-strategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
