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
`utils/` contains helpers such as the wizard runner, assertion tools and file modifiers that can be used in (`*.test.ts`).
19
+
20
+
#### Helpers
21
+
22
+
-`startWizardInstance` - Starts a new instance of `WizardTestEnv`.
23
+
24
+
-`initGit` - Initializes a temporary git repository in the test project.
25
+
-`cleanupGit` - Cleans up the temporary git repository in the test project.
26
+
-`revertLocalChanges` - Reverts local changes (git tracked or untracked) in the test project.
27
+
28
+
-`createFile` - Creates a file (optionally with content) in the test project.
29
+
-`modifyFile` - Modifies a file in the test project.
30
+
31
+
-`checkFileExists` - Checks if a file exists in the test project.
32
+
-`checkPackageJson` - Checks if the `@sentry/[integration]` package exists in the dependencies of the test project's `package.json`.
33
+
-`checkSentryCliConfig` - Checks if the `.sentryclirc` file contains the Sentry auth token.
34
+
-`checkEnvBuildPlugin` - Cheks if `.env.sentry-build-plugin` contains the Sentry auth token.
35
+
36
+
-`checkIfBuilds` - Checks if the test project builds successfully.
37
+
-`checkIfRunsOnDevMode` - Checks if the test project runs on dev mode successfully.
38
+
-`checkIfRunsOnProdMode` - Checks if the test project runs on prod mode successfully.
39
+
40
+
41
+
#### `WizardTestEnv`
42
+
43
+
`WizardTestEnv` is a class that can be used to run the Sentry Wizard in a test environment. It provides methods to run the wizard with specific arguments and stdio.
44
+
45
+
## Running Tests Locally
46
+
47
+
First, you need to create a `.env` file set the environment variables from the `.env.example` file in the root of the project.
48
+
49
+
Tests can be run locally from the root of the project with:
50
+
51
+
`yarn test:e2e`
52
+
53
+
To run a specific test application
54
+
55
+
`yarn test:e2e [Remix | NextJS | SvelteKit]`
56
+
57
+
## Writing Tests
58
+
59
+
Each test file should contain a single test suite that tests the Sentry Wizard for a specific framework. The test suite should contain a `beforeAll` and `afterAll` function that starts and stops the test application respectively.
0 commit comments