Skip to content

Commit

Permalink
Merge pull request #671 from cal-itp/chore/faster-devcontainer-start
Browse files Browse the repository at this point in the history
Chore: Faster devcontainer start
  • Loading branch information
afeld authored Jun 13, 2022
2 parents 05b9dae + 9ae8f2a commit 5f6c16a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ RUN pip install -r docs/requirements.txt

COPY tests/pytest/requirements.txt tests/pytest/requirements.txt
RUN pip install -r tests/pytest/requirements.txt

# install pre-commit environments in throwaway Git repository
# https://stackoverflow.com/a/68758943
COPY .pre-commit-config.yaml .
RUN git init . && \
pre-commit install-hooks && \
rm -rf .git
10 changes: 2 additions & 8 deletions .devcontainer/postAttach.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/usr/bin/env bash
set -eu

# initialize hook environments
pre-commit install --install-hooks --overwrite

# manage commit-msg hooks
pre-commit install --hook-type commit-msg

# install cypress
cd tests/cypress && npm install && npx cypress install
# initialize pre-commit
pre-commit install --overwrite
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v1.2.0
Expand Down
23 changes: 2 additions & 21 deletions docs/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,9 @@ Feature and user interface tests are implemented with [`cypress`](https://www.cy

See the [`cypress` Command Line](https://docs.cypress.io/guides/guides/command-line) guide for more information.

### Running in the Dev Container
### Running

`cypress` is installed and available to run directly in the [devcontainer](../development/README.md#vs-code-with-devcontainers).

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/cypress` directory:
```bash
npm run cypress:ui
```
### Running outside of the Dev Container
These are instructions for running `cypress` locally on your machine, *without* the devcontainer. These steps
These are instructions for running `cypress` locally on your machine, *without* the [devcontainer](../development/README.md#vs-code-with-devcontainers). These steps
will install `cypress` and its dependencies on your machine. Make sure to run these commands in a Terminal.

1. Ensure you have Node.js and NPM available on your local machine:
Expand Down

0 comments on commit 5f6c16a

Please sign in to comment.