|
1 | 1 | # E2E tests |
2 | 2 |
|
3 | | -This folder contains e2e tests for Wrangler. The tests run in CI against a specific Cloudflare account. |
| 3 | +This folder contains e2e tests for Wrangler. |
4 | 4 |
|
5 | | -You can also run these tests locally, but you'll need access to the `8d783f274e1f82dc46744c297b015a2f` (DevProd Testing) Cloudflare account. Once you have access, generate an API token for the account with the same scopes Wrangler requests. |
| 5 | +## Run the tests |
6 | 6 |
|
7 | | -You can then run the e2e test suite with the following commands (run them in root of the repo): |
| 7 | +Run each of the test files as a separately cached turbo task. |
8 | 8 |
|
9 | 9 | ```zsh |
10 | | -CLOUDFLARE_ACCOUNT_ID=8d783f274e1f82dc46744c297b015a2f CLOUDFLARE_API_TOKEN=<cloudflare-testing-api-token> WRANGLER="node --no-warnings $PWD/packages/wrangler/bin/wrangler.js" WRANGLER_IMPORT="$PWD/packages/wrangler/wrangler-dist/cli.js" pnpm test:e2e -F wrangler |
| 10 | +pnpm test:e2e:wrangler |
11 | 11 | ``` |
12 | 12 |
|
13 | | -> Make sure you have run `pnpm i` since any changes to package dependencies - common when switching git branches or pulling updates from GitHub. |
14 | | -> Also, remember to replace `<cloudflare-testing-api-token>` with the actual API token you generated. |
| 13 | +## Configuration |
15 | 14 |
|
16 | | -If you want to run a subset of tests (e.g. just one) while retaining the turborepo cache for the builds of the dependencies, you can provide the list of test files via the `WRANGLER_E2E_TEST_FILE` environment variable. For example (eliding the other env vars for clarity): |
| 15 | +You can configure how these e2e tests are run, in terms of the backend Cloudflare account, Wrangler and Miniflare distributable binaries and libraries, and which test file to run. |
| 16 | + |
| 17 | +### Cloudflare Credentials |
| 18 | + |
| 19 | +Cloudflare credentials are provided to the tests by setting `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN`. |
| 20 | + |
| 21 | +- If you don't provide these then only the local e2e tests are executed. |
| 22 | +- If you don't provide the "DevProd Testing" Cloudflare account (as `CLOUDFLARE_ACCOUNT_ID=8d783f274e1f82dc46744c297b015a2f`), tests that require that specific account are not executed. |
| 23 | + |
| 24 | +To fully run the tests you should generate an API token for the "DevProd Testing" account: |
| 25 | + |
| 26 | +```zsh |
| 27 | +CLOUDFLARE_ACCOUNT_ID=8d783f274e1f82dc46744c297b015a2f CLOUDFLARE_API_TOKEN=<cloudflare-testing-api-token> pnpm test:e2e:wrangler |
| 28 | +``` |
| 29 | + |
| 30 | +### Focusing on a single e2e test file |
| 31 | + |
| 32 | +If you want to run a subset of tests (e.g. just one) while retaining the turborepo cache for the builds of the dependencies, you can provide the list of test files via the `WRANGLER_E2E_TEST_FILE` environment variable. |
| 33 | +For example to run the C3 integration test file only: |
17 | 34 |
|
18 | 35 | ```zsh |
19 | | -CLOUDFLARE_ACCOUNT_ID=... CLOUDFLARE_API_TOKEN=... WRANGLER=... WRANGLER_IMPORT=... WRANGLER_E2E_TEST_FILE=c3-integration.test pnpm test:e2e -F wrangler |
| 36 | +WRANGLER_E2E_TEST_FILE=c3-integration.test pnpm test:e2e:wrangler |
20 | 37 | ``` |
21 | 38 |
|
22 | 39 | ## How tests are written |
|
0 commit comments