Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Faster devcontainer start #671

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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