CivicActions / cypress-tests

A repository to store Cypress test recipes created by CivicActions engineers
Other
5 stars 3 forks source link
cypress

Cypress Tests

The purpose of this repo is to archive and be able to retrieve cypress test recipes and documentation created/contributed by CivicActions staff.

Quickstart

There's a lot to the documentation and examples sections of this repository; however, to get started quickly, you can run the following commands:

```bash
# Install dependencies.
npm install

# Run the Cypress example suite tests.
npm run cy:run:examples

# Run the CivicActions example suite tests.
npm run cy:run:ca-examples

# Open the Cypress GUI to run e2e tests with the electron browser.
npm run cy:open --e2e --browser electron

# Install Drupal site to run tests against.
# Sets up site at https://drupal.ddev.site
./scripts/setup.sh
```

Docs

You should start by reading the "Getting Started" documentation section that will orient you to Cypress and how CivicActions uses it to test web applications.

Examples

If you are a seasoned Cypress user and are looking for concrete examples of how to do something, you can find them in the examples section of documentation. We try to turn the examples into actual tests and link to the working tests in the example documentation. We also include handy custom commands you can use in your own tests.

Contributing

We encourage you to contribute to this repository as you are working on your client and personal projects. It is often the case that developers will add a new Cypress best practice to project work first, but not all of that knowledge is known and shared outside the project.

For example, this issue https://github.com/CivicActions/cypress-tests/issues/8 was created because a developer encountered uncaught exceptions causing a Cypress test to fail but wanted to ask what others thought the best practice way to handle this was. The developer then created a PR to add an example to the repository that could inform future developers that encounter the same issue on their projects.

Please see CONTRIBUTING.md for details on how to help grow this repository.

Communications