You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(e2e): add dataset setup and teardown functions for use in CI (#561)
### Description
Added dataset setup and teardown functionality for E2E tests, with utilities for managing test datasets. This PR:
- Creates a dataset setup script that creates primary and secondary datasets if they don't exist
- Adds a dataset teardown script that cleans up test datasets in CI environments (users may want to have their datasets stick around for debugging purposes. we can enforce this differently if things get messy)
- Implements helper utilities like `sanityIdify` to create valid Sanity dataset names
- Adds a timer utility with visual feedback for long-running operations
- Fixes the CI environment variable type to be a boolean instead of string
- Normalizes some naming of setup / teardown functions
### What to review
- The dataset setup and teardown scripts in `packages/@repo/e2e/src/setup/datasets.setup.ts` and `packages/@repo/e2e/src/teardown/datasets.teardown.ts`
- The helper utilities for sanitizing dataset names and timing operations
- The type change for the CI environment variable from string to boolean
- The dependency changes in package.json files
### Testing
You can test this locally by pulling down the branch and updating the following CI variables (please look in 1pass if there's some you don't have):
```
SDK_E2E_DATASET_0=whatever-name
SDK_E2E_DATASET_1=whatever-name-2
CI=true
SDK_E2E_USER_ID=
SDK_E2E_USER_PASSWORD=
RECAPTCHA_E2E_STAGING_KEY=
```
and then running `pnpm test:e2e`
You should see console logging about creating and destroying datasets. When you go to https://www.sanity.work/organizations/oFvj4MZWQ/project/3j6vt2rg/datasets
You shouldn't see the datasets after the tests have run.
### Fun gif

0 commit comments