Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Split make install for e2e, fix devcontainer pgadmin vers, expose port
Browse files Browse the repository at this point in the history
  • Loading branch information
4ydan committed Aug 5, 2023
1 parent 0942507 commit f46c135
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile.pg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This Dockerfile is used inside the docker-compose.yml as development environment
FROM dpage/pgadmin4
FROM dpage/pgadmin4:7.3

COPY ./servers.json ./servers.json
COPY ./pgpass ../pgpass
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
command: sleep infinity
ports:
- "8080:8080"
- "5173:5173"
networks:
- permaplant-dev

Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ help: ## Show help for each of the Makefile recipes.

.PHONY: run-frontend
run-frontend: build-frontend ## Build & Run frontend.
cd frontend && npm run dev
cd frontend && npm run dev -- --host

.PHONY: run-backend
run-backend: build-backend ## Build & Run backend.
Expand Down Expand Up @@ -144,13 +144,19 @@ clean-storybook: ## Remove storybook static folder.
.PHONY: install
install: ## Install ALL dependencies within the source repo.
cd backend && make install
cd e2e && ./install.sh
cargo install mdbook mdbook-mermaid mdbook-linkcheck
cargo install --git https://github.com/ElektraInitiative/mdbook-generate-summary mdbook-generate-summary --locked

.PHONY: uninstall
uninstall: ## Uninstall ALL dependencies within the source repo.
-cd backend && make uninstall
-cd e2e && python3 -m pip uninstall -y -r requirements.txt
-cargo uninstall mdbook mdbook-mermaid mdbook-linkcheck
-cargo uninstall mdbook-generate-summary

.PHONY: install-e2e
install-e2e:
cd e2e && ./install.sh

-PHONY: uninstall-e2e
uninstall-e2e:
cd e2e && ./uninstall.sh
22 changes: 18 additions & 4 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All commands/scripts in this README are executed from this folder (/e2e).
├── features Gherkin features
├── pages Page object models
├── steps The actual tests
├── conftest.py Global pytest fixtures, functions.
├── test-reports pie charts, tables, runtime, etc.
├── test-results screenshots, videos, etc.
```
Expand Down Expand Up @@ -40,15 +41,28 @@ source venv/bin/activate

### Inside Docker

Assuming your database is not inside a network and everything is basically on localhost.

Change [ENV](.env) variables with `docker run -e`.
Assuming your app and database is on your localhost network.

```sh
docker build -t permaplant-e2e .
docker run permaplant-e2e
docker run --network="host" permaplant-e2e
```

If you have a more complicated network/database setup you might need to configure all env variables and use `docker run --network`.

Lets say:

- Your app/db are both inside a docker network called `plant`
- The web apps container name is `rudolph`
- The db is at postgres:5433 (for cleaning up after tests)

```sh
docker run --network="plant" -e TEST_URL=rudolph:5173 -e POSTGRES_HOST=postgres -e POSTGRES_PORT=5433 permaplant-e2e
```

There is probably plenty of other setups, we haven't tested all.
Feel free to open an Issue/PR if something is not working.

### Optional arguments

Most of these are set inside `.entrypoint.sh`
Expand Down
2 changes: 0 additions & 2 deletions e2e/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

grep -E '^(E2E|POSTGRES)_[A-Z_]+=' .env

# Only run clean_db script
# when env variable CI is set
if [ -z "$CI" ]; then
Expand Down
2 changes: 2 additions & 0 deletions e2e/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python3 -m playwright uninstall
python3 -m pip uninstall -y -r requirements.txt

0 comments on commit f46c135

Please sign in to comment.