chore(tests/e2e): script to run locally (#6475)

This commit is contained in:
Jason Kuhrt 2025-02-07 06:20:05 -05:00 committed by GitHub
parent 6bef900ae9
commit 7db24f7a34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 7 deletions

View file

@ -8,6 +8,13 @@ if (!process.env.RUN_AGAINST_LOCAL_SERVICES) {
dotenv.config({ path: import.meta.dirname + '/integration-tests/.env' });
}
if (process.env.RUN_AGAINST_LOCAL_SERVICES === '1') {
const dotenv = await import('dotenv');
dotenv.config({ path: import.meta.dirname + '/packages/services/server/.env.template' });
// It seems that this has to be set in the environment that the cypress cli is executed from.
// process.env.CYPRESS_BASE_URL = process.env.CYPRESS_BASE_URL ?? 'http://localhost:3000';
}
const isCI = Boolean(process.env.CI);
export const seed = initSeed();

View file

@ -65,12 +65,14 @@ To run integration tests locally, from the pre-build Docker image, follow:
## E2E Tests
e2e Tests are based on Cypress, and matches files that ends with `.cy.ts`. The tests flow runs from
a pre-build Docker image.
We use [Cypress](https://www.cypress.io). Any file that ends with `.cy.ts` is an E2E test.
#### Running on built Docker images from source code
#### Running Against Local Development Services
To run e2e tests locally, from the local source code, follow:
1. Run the [development setup](./DEVELOPMENT.md) as usual.
2. Run `pnpm test:e2e:local`
#### Running Against Locally Built Docker Images
1. Make sure you have Docker installed. If you are having issues, try to run `docker system prune`
to clean the Docker caches.
@ -79,9 +81,7 @@ To run e2e tests locally, from the local source code, follow:
4. Run `./local.sh` for building the project and starting the Docker containers
5. Follow the output instruction from the script for starting the tests
#### Running from pre-built Docker image
To run integration tests locally, from the pre-build Docker image, follow:
#### Running Against Pre-Built Docker Images
1. Make sure you have Docker installed. If you are having issues, try to run `docker system prune`
to clean the Docker caches.

View file

@ -45,6 +45,7 @@
"start": "pnpm run local:setup",
"test": "vitest",
"test:e2e": "CYPRESS_BASE_URL=$HIVE_APP_BASE_URL cypress run --browser chrome",
"test:e2e:local": "CYPRESS_BASE_URL=http://localhost:3000 RUN_AGAINST_LOCAL_SERVICES=1 cypress open --browser chrome",
"test:e2e:open": "CYPRESS_BASE_URL=$HIVE_APP_BASE_URL cypress open",
"test:integration": "cd integration-tests && pnpm test:integration",
"typecheck": "pnpm run -r --filter '!hive' typecheck",