Skip to content

Commit

Permalink
Update README for setting a base url in different dev environments
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjarling committed Apr 8, 2024
1 parent c98d7c3 commit adfa1a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,31 @@ A pre-commit hook will ensure code is linted before committed.

Test fixtures can be accessed by pointing the app to a [Test Environment API](https://github.com/nulib/dc-test-environment).

```
`NEXT_PUBLIC_DCAPI_ENDPOINT="https://dc-test-api.rdc-staging.library.northwestern.edu/api/v2"`
```

In local dev mode, run the following commands:

```bash

# Point to the test environment
# Set this variable either in your shell or in a `.env.local` file
NEXT_PUBLIC_DCAPI_ENDPOINT="https://dc-test-api.rdc-staging.library.northwestern.edu/api/v2"
```

# Start local server
```bash
# Start local server (automatically points NEXT_PUBLIC_DCAPI_ENDPOINT to the test data API)
npm run dev:test-env

# Start Playwright test runner
# If in AWS Dev Environment, set a BASE_URL environment variable in a .env.local file
BASE_URL="[YOUR_DEV_ID].dev.rdc.library.northwestern.edu"

# Start Playwright tests in headless mode
npm run test:playwright
```

To run more visual tests, try experimenting with:

```bash
# Run in watch mode with traces in a browser
npx playwright test --headed

# Run once in UI mode with a visual browser
npm playwright test --ui
```

For more info, view the docs: [Playwright](https://playwright.dev/).

### Unit tests
Expand Down
1 change: 1 addition & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const BASE_URL =
export default defineConfig({
testDir: "./tests",
fullyParallel: true,

/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
Expand Down

0 comments on commit adfa1a2

Please sign in to comment.