From e5f67f12310977e3e307345c49a2b16ee047d865 Mon Sep 17 00:00:00 2001 From: Sam Vevang Date: Mon, 1 Jul 2024 16:27:23 -0500 Subject: [PATCH] Add to the readme, add notes on yarn --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 077c593..980a335 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,75 @@ # PRX Acceptance Tests -Acceptance tests for PRX systems +Acceptance tests for PRX systems using Cypress. -Written in [Cypress](https://www.cypress.io/) +## What is Cypress? + +Cypress is a next-generation front end testing tool built for the modern web. +It enables you to write all types of tests: +- End-to-end tests +- Integration tests +- Unit tests + +We're using for E2E tests to cover core functionality of apps at PRX. + +## Requirements + +- [Node.js](https://nodejs.org/) (preferably managed with [asdf](https://github.com/asdf-vm/asdf)) +- [Yarn](https://yarnpkg.com/) ## Installation -You probably have NodeJS installed via `asdf` right? +1. Clone this repository +2. Install dependencies: + ```sh + yarn install + ``` +3. Configure your test user/pass/fixtures: + ```sh + cp env-example .env + # Edit .env with your settings + ``` -Then let's get started: +## Running Tests -```sh -yarn +There are two main ways to run Cypress tests: -# configure your test user/pass/fixtures -cp env-example .env -vi .env +### Headless Mode (Run) -# run the tests headless +Run tests in headless mode: +```sh yarn test +``` -# open cypress +This command runs all tests in the terminal without opening a browser window. +It's useful for continuous integration environments or when you want to quickly +run all tests. + +### Interactive Mode (Open) + +Open Cypress Test Runner: +```sh yarn start ``` -## Development +This command opens the Cypress Test Runner, a graphical user interface that allows you to: +- See all test files +- Choose specific tests to run +- Watch tests run in real time in the browser +- Debug tests using browser developer tools + +The Test Runner is particularly useful during test development and debugging. +You can set a `debugger` statement or inspect the DOM! + +## Writing Tests + +Cypress tests are located in the `cypress/e2e` directory. To create a new test: + +1. Create a new `.cy.ts` file in the `cypress/e2e` directory +2. Write your test using Cypress commands +3. Run your test using the Cypress Test Runner or command line -I'm still figuring it out, okay? +For more information on writing Cypress tests, refer to the [Cypress Documentation](https://docs.cypress.io/). ## License