> For the complete documentation index, see [llms.txt](https://openup.gitbook.io/wazi-ng-technical/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openup.gitbook.io/wazi-ng-technical/testing/gui-tests.md).

# GUI Tests

### File structure

* We use Cypress for GUI tests along with Cucumber
* All the GUI tests could be found in `__tests__/gui` folder
* The test steps are in the `.feature` files and the test step definitions are in the `.js` files in the folder that shares the same name as the `.feature` file
  * For example the step definitions of `facility_modal.feature` need to be in the `facility_modal`folder(name of the js files are not important)
* We intercept all the requests and respond with local data. The data for each test are kept in json files in the folder of the corresponding test.

### Running the tests

* Start the project
* In a new terminal running `yarn cypress:open` will open the cypress window.
* In the cypress window you can see all the e2e and gui tests and by clicking on any of it you can start testing
* Without opening the cypress window, there are 2 ways to run the gui tests
  * `yarn cypress:gui` runs all the gui tests and saves their result in cypress dashboard
  * `yarn cypress:gui-local` runs all the gui tests without saving anything to the cypress dashboard. While working locally, this script should be used to prevent exceeding dashboard monthly test quota

### Cypress dashboard

* <https://dashboard.cypress.io/>
* The credentials for the dashboard could be found in OpenUp general credentials file
* Everytime `cypress:gui` script is run, the test results, logs and their videos are saved to the dashboard. Github actions runs this script too.&#x20;
* By selecting `WazimapNG` in the Projects page, all the latest test runs could be viewed.

![Projects page](https://405987915-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3zapxOsLjq_qKRcmH8%2F-Mj4F0LzAipJuVBUEHxb%2F-Mj4NTyqc7frM4qmdX2M%2Fimage.png?alt=media\&token=da883ce8-b2de-4845-892e-d522ce698497)

![Latest test runs of WazimapNG project](https://405987915-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3zapxOsLjq_qKRcmH8%2F-Mj4F0LzAipJuVBUEHxb%2F-Mj4OO4IBMh770ghwWxD%2Fimage.png?alt=media\&token=084bca96-a036-43fc-a8d7-3a2a2e40e6e0)

* By clicking on any of the test runs, you can view
  * Overview : How many tests are failed / passed / skipped.... etc
  * Test results : Details, statuses, result logs... etc
  * Specs : Screenshots, videos... etc

![Analytics](https://405987915-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3zapxOsLjq_qKRcmH8%2F-Mj4F0LzAipJuVBUEHxb%2F-Mj4PPWfJcepdnzhkqkL%2Fimage.png?alt=media\&token=21d36fcc-0f25-4a22-9baa-f3c836e831af)

* More useful details(Average run duration, Top failures, Slowest tests...)  could be found in Analytics menu of the dashboard.&#x20;
