Skip to content

Commit 7db24f7

Browse files
authored
chore(tests/e2e): script to run locally (#6475)
1 parent 6bef900 commit 7db24f7

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

cypress.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ if (!process.env.RUN_AGAINST_LOCAL_SERVICES) {
88
dotenv.config({ path: import.meta.dirname + '/integration-tests/.env' });
99
}
1010

11+
if (process.env.RUN_AGAINST_LOCAL_SERVICES === '1') {
12+
const dotenv = await import('dotenv');
13+
dotenv.config({ path: import.meta.dirname + '/packages/services/server/.env.template' });
14+
// It seems that this has to be set in the environment that the cypress cli is executed from.
15+
// process.env.CYPRESS_BASE_URL = process.env.CYPRESS_BASE_URL ?? 'http://localhost:3000';
16+
}
17+
1118
const isCI = Boolean(process.env.CI);
1219

1320
export const seed = initSeed();

docs/TESTING.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ To run integration tests locally, from the pre-build Docker image, follow:
6565

6666
## E2E Tests
6767

68-
e2e Tests are based on Cypress, and matches files that ends with `.cy.ts`. The tests flow runs from
69-
a pre-build Docker image.
68+
We use [Cypress](https://www.cypress.io). Any file that ends with `.cy.ts` is an E2E test.
7069

71-
#### Running on built Docker images from source code
70+
#### Running Against Local Development Services
7271

73-
To run e2e tests locally, from the local source code, follow:
72+
1. Run the [development setup](./DEVELOPMENT.md) as usual.
73+
2. Run `pnpm test:e2e:local`
74+
75+
#### Running Against Locally Built Docker Images
7476

7577
1. Make sure you have Docker installed. If you are having issues, try to run `docker system prune`
7678
to clean the Docker caches.
@@ -79,9 +81,7 @@ To run e2e tests locally, from the local source code, follow:
7981
4. Run `./local.sh` for building the project and starting the Docker containers
8082
5. Follow the output instruction from the script for starting the tests
8183

82-
#### Running from pre-built Docker image
83-
84-
To run integration tests locally, from the pre-build Docker image, follow:
84+
#### Running Against Pre-Built Docker Images
8585

8686
1. Make sure you have Docker installed. If you are having issues, try to run `docker system prune`
8787
to clean the Docker caches.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"start": "pnpm run local:setup",
4646
"test": "vitest",
4747
"test:e2e": "CYPRESS_BASE_URL=$HIVE_APP_BASE_URL cypress run --browser chrome",
48+
"test:e2e:local": "CYPRESS_BASE_URL=http://localhost:3000 RUN_AGAINST_LOCAL_SERVICES=1 cypress open --browser chrome",
4849
"test:e2e:open": "CYPRESS_BASE_URL=$HIVE_APP_BASE_URL cypress open",
4950
"test:integration": "cd integration-tests && pnpm test:integration",
5051
"typecheck": "pnpm run -r --filter '!hive' typecheck",

0 commit comments

Comments
 (0)