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
feat: E2E test suite with puppeteer+ipfsd-ctl (#1353)
This adds end to end tests against real HTTP API.
Uses jest-puppeteer and ipfsd-ctl for orchestration.
By default it runs headless chromium against go-ipfs,
but can be made to run test matrix against js-ipfs with
E2E_IPFSD_TYPE=js or arbitrary HTTP API via E2E_API_URL
Copy file name to clipboardexpand all lines: README.md
+70-9
Original file line number
Diff line number
Diff line change
@@ -105,29 +105,90 @@ The WebUI uses Jest to run the isolated unit tests. Unit test files are located
105
105
106
106
## End-to-end tests
107
107
108
-
The end-to-end tests (e2e) test the full app in a headless Chromium browser. They require an http server to be running to serve the app.
108
+
The end-to-end tests (e2e) test the full app in a headless Chromium browser. They spawn real IPFS node for HTTP API and a static HTTP server to serve the app.
109
+
The purpose of those tests is not being comprehensible, but act as a quick regression and integration suite.
109
110
110
-
In dev, run `npm start` in another shell before starting the tests
111
+
Make sure `npm run build` is run before starting E2E tests:
111
112
113
+
```console
114
+
$ npm run build
115
+
$ npm run test:e2e # end-to-end smoke tests (fast, headless, use go-ipfs)
112
116
```
113
-
# Run the end-to-end tests
114
-
> npm run test:e2e
117
+
118
+
### Customizing E2E Tests
119
+
120
+
Default behavior can be tweaked via env variables below.
121
+
122
+
#### `E2E_IPFSD_TYPE`
123
+
124
+
Variable named `E2E_IPFSD_TYPE` defines which IPFS backend should be used for end-to-end tests.
125
+
126
+
CI setup of ipfs-webui repo runs tests against both JS and GO implementations:
127
+
128
+
```console
129
+
$ E2E_IPFSD_TYPE=go npm run test:e2e # 'go' is the default if missing
130
+
$ E2E_IPFSD_TYPE=js npm run test:e2e
131
+
```
132
+
133
+
It is possible to test against arbitrary versions by tweaking `ipfs` (js-ipfs)
134
+
and `go-ipfs-dep` (go-ipfs) in `devDependencies` section of `package.json` and applying the change via `npm i`
135
+
136
+
#### `E2E_API_URL`
137
+
138
+
Instead of spawning a disposable node and repo for tests, one can point the E2E test suite at arbitrary HTTP API running on localhost:
139
+
140
+
```console
141
+
$ E2E_API_URL=http://127.0.0.1:5001 npm run test:e2e
115
142
```
116
143
117
-
By default the test run headless, so you won't see the the browser. To debug test errors, it can be helpful to see the robot clicking around the site. To disable headless mode and see the browser, set the environment variable `DEBUG=true`
144
+
**Caveat 1:** HTTP API used in tests needs to run on the local machine for Peers screen to pass (they test manual swarm connect to ephemeral `/ip4/120.0.0.1/..` multiaddr)
118
145
146
+
**Caveat 2:** CORS requests from `http://localhost:3001` (static server hosting dev version of webui) need to be added to `Access-Control-Allow-Origin` whitelist array in node's config:
0 commit comments