From 9bdd54f4f848075e0b9b995847d4e20bea2c56a0 Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Tue, 20 Mar 2018 19:05:30 -0400 Subject: [PATCH] update cypress docs --- docs/tests.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/tests.md b/docs/tests.md index bc4b5f5c..7b6ef211 100644 --- a/docs/tests.md +++ b/docs/tests.md @@ -74,7 +74,18 @@ yarn dev:e2e ### Introduction to Cypress -I recommend checking out our Cypress tests in `tests/e2e/specs`, then reading through [the _Core Concepts_](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-Is-Simple) in the Cypress docs, which are fantastic. This section will be pretty short, because I can't offer much improvement over what you'll see there. +I recommend checking out our Cypress tests in `tests/e2e/specs`, then reading through at least these sections of the excellent Cypress docs: + +* [Core Concepts](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-Is-Simple) +* [Best Practices](https://docs.cypress.io/guides/references/best-practices.html) + +Beyond that, also know that you can access our app in Cypress on the `window`. For example, to dispatch a Vuex action that sets up some state: + +```js +cy.window().then(window => { + return window.__app__.$store.dispatch('someModule/someAction') +}) +``` ## The mock API @@ -89,7 +100,7 @@ The mock API is an [Express](https://expressjs.com/) server in `tests/mock-api` ### Testing/developing against a real server -In some situations, you might prefer to test against a local server while developing, or maybe just during continuous integration. To do so, you can run any development or test command with the `API_BASE_URL` environment variable: +In some situations, you might prefer to test against a local server while developing, or maybe just during continuous integration. To do so, you can run any development or test command with the `API_BASE_URL` environment variable. For example: ```sh API_BASE_URL=http://localhost:3000 yarn test