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
Copy file name to clipboardExpand all lines: packages/tests-e2e/README.md
+53-42Lines changed: 53 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,63 +1,74 @@
1
-
# `tests-e2e`
1
+
# tests-e2e
2
2
3
-
This package currently contains all the end-to-end tests for testing the React package. We plan to extend the tests for other packages of Corbado JavaScript Library.
3
+
End-to-end tests for the Corbado JavaScript SDK, using Playwright.
4
4
5
-
## Running Tests Locally
5
+
## Overview
6
6
7
-
Playground is locally run within Playwright for both Complete and Connect tests. For reference look at `utils/playground.ts`.
7
+
### Playground applications
8
8
9
-
This means that tests can simply be run with a single command. The command depends on whether you want to run it headless or with UI.
9
+
Each SDK has a corresponding **playground application** in `playground/`:
1.**Manual testing** — each playground can be started locally (`npm run dev`) and is deployed automatically to Vercel on every push. This gives a quick way to verify SDK behaviour in a real browser without writing tests.
21
+
2.**Automated testing** — Playwright tests run _on top of_ these playgrounds. The `globalSetup` in each test suite installs dependencies, builds the playground, and spawns it on a random port before tests start. No manual playground setup is needed.
20
22
21
-
```
23
+
### Test suites
24
+
25
+
Because multiple playgrounds can expose the same SDK surface, a single Playwright suite can be **reused across different playground apps**. For example, the three Complete playgrounds (`react`, `web-js`, `web-js-script`) all render the same auth UI component, so they share the same test suite — only the playground that gets spawned changes.
26
+
27
+
There are two test suites:
28
+
29
+
-**Complete** — tests the full Corbado auth UI component (signup, login, passkey list, social login, observe). By default runs against the React playground; in the nightly workflow it also runs against `web-js` and `web-js-script`.
30
+
-**Connect** — tests the Corbado Connect passkey integration (login, append, network blocking). Runs against the Next.js playground that talks to AWS Cognito.
31
+
32
+
Each suite has its own Playwright config (`playwright.config.complete.ts` / `playwright.config.connect.ts`) and env files.
33
+
34
+
## Running locally
35
+
36
+
### 1. Set up env files
37
+
38
+
Copy the example files and fill in the secrets:
39
+
40
+
```bash
22
41
cd packages/tests-e2e
23
-
npm run e2e:complete:ui
24
-
npm run e2e:connect:ui
42
+
cp .env.complete.example .env.complete.local
43
+
cp .env.connect.example .env.connect.local
25
44
```
26
45
27
-
## Generating JWT Token
46
+
Edit `.env.complete.local` and `.env.connect.local` with the required values. See the [Environment variables](#environment-variables) section below.
28
47
29
-
The following is the script used to generate the JWT token.
The first segment of the script contains all the information that must be extracted from the backend deployment.
62
+
## Running in CI
63
+
64
+
### Workflows
57
65
58
-
As evident in the script, the token is valid for around 34 days. The token is intended to be renewed monthly using this script. For rewnewal, it is not necessary to extract all the information in the first segment.
0 commit comments