-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial integration testing configuration (#122)
- Loading branch information
Showing
11 changed files
with
3,334 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Automated tests | ||
|
||
## Integration | ||
|
||
End-to-end integration tests are implemented with [`cypress`](https://www.cypress.io/) and can be found in the | ||
[`tests/e2e`](https://github.com/cal-itp/benefits/tree/dev/tests/e2e) directory in the repository. | ||
|
||
See the [`cypress` Command Line](https://docs.cypress.io/guides/guides/command-line) guide for more information. | ||
|
||
### Using Docker Compose | ||
|
||
Run the tests with Docker Compose against the `client` service. | ||
|
||
1. Ensure your `.env` file has an updated `CYPRESS_baseUrl` variable: | ||
|
||
```env | ||
# using the Docker Compose service address | ||
CYPRESS_baseURL=http://client:8000 | ||
``` | ||
2. From within the `localhost` directory: | ||
```bash | ||
docker compose run tests-e2e | ||
``` | ||
### From the Dev Container | ||
`cypress` is installed and available to run directly in the devcontainer. | ||
1. Ensure your `.env` file has an updated `CYPRESS_baseUrl` variable: | ||
```env | ||
# using localhost since we're inside the container | ||
CYPRESS_baseURL=http://localhost:8000 | ||
``` | ||
2. Rebuild and Reopen the devcontainer | ||
3. Start the `benefits` app with `F5` | ||
4. From within the `tests/e2e` directory: | ||
```bash | ||
npx cypress run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
screenshots/ | ||
videos/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pluginsFile": false, | ||
"supportFile": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe("Index page spec", () => { | ||
it("Gives user transit provider options", () => { | ||
cy.visit("/") | ||
|
||
cy.contains("Choose your transit provider") | ||
.siblings(".btn") | ||
.should('not.be.empty') | ||
.each(($e) => { | ||
expect($e).attr("href").to.match(/\/[a-z]{3,}$/) | ||
}) | ||
}) | ||
|
||
it("Takes user to transit provider page", () => { | ||
cy.visit("/") | ||
|
||
cy.get(".buttons .btn") | ||
.first() | ||
.click() | ||
|
||
cy.contains("Let’s do it!") | ||
.then(($e) => { | ||
expect($e).attr("href").to.match(/\/eligibility\/$/) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.