@wopee-io/wopee.pw 4.24.0 → 4.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci_cd.yaml +30 -12
- package/README.md +13 -0
- package/build/core/ports/configPort/configPort.js +2 -0
- package/build/core/ports/configPort/configPort.js.map +1 -1
- package/build/core/ports/configPort/configValidation.d.ts +2 -0
- package/build/core/ports/configPort/configValidation.js +49 -0
- package/build/core/ports/configPort/configValidation.js.map +1 -0
- package/build/core/services/wopeeService/wopee.js +7 -0
- package/build/core/services/wopeeService/wopee.js.map +1 -1
- package/build/shared/metadata/versionMetadata.js +15 -6
- package/build/shared/metadata/versionMetadata.js.map +1 -1
- package/build/tools/wopee-reporter/wopeeReporter.d.ts +6 -0
- package/build/tools/wopee-reporter/wopeeReporter.js +73 -11
- package/build/tools/wopee-reporter/wopeeReporter.js.map +1 -1
- package/docs/configuration.md +39 -15
- package/docs/troubleshooting.md +59 -0
- package/node_modules/@autonomous-testing/sdk/.github/workflows/ci_cd.yaml +47 -20
- package/node_modules/@autonomous-testing/sdk/README.md +129 -36
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/adapter.js +4 -8
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/axios-config.d.ts +12 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/axios-config.js +5 -4
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/errors.d.ts +20 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/errors.js +178 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.d.ts +1 -1
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.js +13 -3
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloAdapterService/apolloAdapterService.js +6 -2
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.js +2 -2
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/error.interface.d.ts +13 -1
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/error.interface.js +8 -1
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/index.d.ts +2 -2
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/README.md +145 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/package.json +64 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/@autonomous-testing/sdk/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/@autonomous-testing/sdk/package.json +18 -6
- package/node_modules/agent-base/LICENSE +22 -0
- package/node_modules/agent-base/README.md +69 -0
- package/node_modules/agent-base/dist/helpers.d.ts +15 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
- package/node_modules/agent-base/dist/helpers.js +66 -0
- package/node_modules/agent-base/dist/helpers.js.map +1 -0
- package/node_modules/agent-base/dist/index.d.ts +41 -0
- package/node_modules/agent-base/dist/index.d.ts.map +1 -0
- package/node_modules/agent-base/dist/index.js +178 -0
- package/node_modules/agent-base/dist/index.js.map +1 -0
- package/node_modules/agent-base/package.json +46 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/http-proxy-agent/LICENSE +22 -0
- package/node_modules/http-proxy-agent/README.md +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/http-proxy-agent/dist/index.js +148 -0
- package/node_modules/http-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/http-proxy-agent/package.json +47 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/package.json +3 -3
- package/tsconfig.build.json +4 -0
- package/.github/actions/npm_clean_install/action.yaml +0 -35
- package/node_modules/@autonomous-testing/sdk/.github/actions/npm_clean_install/action.yaml +0 -35
package/docs/configuration.md
CHANGED
|
@@ -2,20 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Each configuration option is provided by environment variable given as
|
|
4
4
|
|
|
5
|
-
| Configuration option | Environmental variable |
|
|
6
|
-
| ------------------------------------------------ | ----------------------------------- |
|
|
7
|
-
| screenshotValidation.
|
|
8
|
-
| screenshotValidation.
|
|
9
|
-
| screenshotValidation.
|
|
10
|
-
| screenshotValidation.
|
|
11
|
-
| screenshotValidation.branchName | WOPEE_BRANCH_NAME |
|
|
12
|
-
| screenshotValidation.
|
|
13
|
-
| screenshotValidation.
|
|
14
|
-
| screenshotValidation.
|
|
15
|
-
| screenshotValidation.
|
|
16
|
-
| screenshotValidation.
|
|
17
|
-
| screenshotValidation.
|
|
18
|
-
| screenshotValidation.
|
|
19
|
-
| screenshotValidation.
|
|
5
|
+
| Configuration option | Environmental variable | Required |
|
|
6
|
+
| ------------------------------------------------ | ----------------------------------- | -------- |
|
|
7
|
+
| screenshotValidation.apiKey | WOPEE_API_KEY | yes |
|
|
8
|
+
| screenshotValidation.projectUuid | WOPEE_PROJECT_UUID | yes |
|
|
9
|
+
| screenshotValidation.screenshotValidationEnabled | WOPEE_SCREENSHOT_VALIDATION_ENABLED | no |
|
|
10
|
+
| screenshotValidation.apiUrl | WOPEE_API_URL | no |
|
|
11
|
+
| screenshotValidation.branchName | WOPEE_BRANCH_NAME | no |
|
|
12
|
+
| screenshotValidation.baselineBranchName | WOPEE_BASELINE_BRANCH_NAME | no |
|
|
13
|
+
| screenshotValidation.suiteUuid | WOPEE_SUITE_UUID | no |
|
|
14
|
+
| screenshotValidation.enableSoftAssert | WOPEE_ENABLE_SOFT_ASSERT | no |
|
|
15
|
+
| screenshotValidation.collectPageContent | WOPEE_COLLECT_PAGE_CONTENT | no |
|
|
16
|
+
| screenshotValidation.browser | WOPEE_BROWSER | no |
|
|
17
|
+
| screenshotValidation.comment | WOPEE_COMMENT | no |
|
|
18
|
+
| screenshotValidation.device | WOPEE_DEVICE | no |
|
|
19
|
+
| screenshotValidation.os | WOPEE_OS | no |
|
|
20
|
+
| screenshotValidation.pixelToPixelDiffTolerance | WOPEE_PIXEL_TO_PIXEL_DIFF_TOLERANCE | no |
|
|
21
|
+
| screenshotValidation.viewport | WOPEE_VIEWPORT | no |
|
|
22
|
+
| screenshotValidation.customTags | WOPEE_CUSTOM_TAGS | no |
|
|
20
23
|
|
|
21
24
|
where separate values are described in `WopeeOptions` and `ScreenshotValidationOptions` interfaces with default values defined in `DEFAULT_SCREENSHOT_VALIDATION_OPTIONS`,
|
|
25
|
+
|
|
26
|
+
### Required values
|
|
27
|
+
|
|
28
|
+
`WOPEE_API_KEY` and `WOPEE_PROJECT_UUID` come from your project at [cmd.wopee.io](https://cmd.wopee.io) — the key from Project Settings → API Keys, the UUID from Project Settings. If either is missing, `new Wopee()` fails immediately with a message naming the variable, rather than failing later inside a test.
|
|
29
|
+
|
|
30
|
+
`WOPEE_API_URL` is optional and defaults to the SaaS endpoint `https://api.wopee.io`. Set it only for self-hosted instances.
|
|
31
|
+
|
|
32
|
+
### Self-hosted instances and proxies
|
|
33
|
+
|
|
34
|
+
If your organisation runs its own Wopee instance, `WOPEE_API_URL` points at a host inside the customer network (for example `https://api.acme.wopee.io`). That host is usually **not reachable from a laptop on the public internet** — you need to be on the corporate VPN, behind the corporate proxy, or running the tests from a CI runner inside that network.
|
|
35
|
+
|
|
36
|
+
Wopee honours the standard proxy variables:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
export HTTPS_PROXY=http://proxy.corp:8080
|
|
40
|
+
export NO_PROXY=localhost,127.0.0.1,.internal
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`NO_PROXY` supports exact hosts, leading-dot suffixes (`.acme.io`), `host:port` entries, CIDR ranges (`10.0.0.0/8`) and `*`.
|
|
44
|
+
|
|
45
|
+
See [troubleshooting.md](./troubleshooting.md) if a run cannot reach the API.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## `Wopee is not configured — missing required environment variables.`
|
|
4
|
+
|
|
5
|
+
**Symptom.** `new Wopee()` throws before any test runs. Because the template constructs `Wopee` at module scope, Playwright reports this during collection and the whole run stops.
|
|
6
|
+
|
|
7
|
+
**Cause.** `WOPEE_API_KEY` and/or `WOPEE_PROJECT_UUID` is unset or empty. An empty value (`WOPEE_API_KEY=` with nothing after it in a `.env`) counts as missing.
|
|
8
|
+
|
|
9
|
+
**Fix.** Get the values from your project at [cmd.wopee.io](https://cmd.wopee.io) — the key from Project Settings → API Keys, the UUID from Project Settings — and set them in your shell, in a `.env` file next to your Playwright config, or as CI secrets:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
export WOPEE_API_KEY=<your api key>
|
|
13
|
+
export WOPEE_PROJECT_UUID=<your project uuid>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Note that Wopee has always required these to construct — previously it failed with a validation dump instead of the message above. There is currently no supported way to run a suite that constructs `Wopee` without credentials.
|
|
17
|
+
|
|
18
|
+
## `Cannot reach the Wopee API at <url>.`
|
|
19
|
+
|
|
20
|
+
**Symptom.** Tests start, then fail on the first Wopee call. The message reports the URL that was attempted, the underlying failure, and whether a proxy was in effect.
|
|
21
|
+
|
|
22
|
+
**Cause.** The request never got a response — DNS, TCP, TLS or proxy failure. For self-hosted instances this is almost always a network reachability problem rather than a Wopee problem.
|
|
23
|
+
|
|
24
|
+
**Fix**, in the order the message lists them:
|
|
25
|
+
|
|
26
|
+
1. **The instance is only reachable from the customer network.** `WOPEE_API_URL` may resolve to a private address (for example `10.120.0.187`) that a laptop on the public internet cannot route to. Connect to the corporate VPN, or run the tests from a CI runner inside that network.
|
|
27
|
+
2. **A corporate proxy is required.** Set `HTTPS_PROXY` (and `HTTP_PROXY` for plain-HTTP endpoints) and retry.
|
|
28
|
+
- If the message says the proxy was **bypassed**, the host matched `NO_PROXY`. Remove the matching entry if the proxy is how you reach it.
|
|
29
|
+
- If a proxy **was** in use and the failure names the proxy host, the proxy itself is unreachable or is refusing the host.
|
|
30
|
+
3. **`WOPEE_API_URL` points at the wrong host.** Confirm the value with your Wopee administrator. The default SaaS endpoint is `https://api.wopee.io`.
|
|
31
|
+
|
|
32
|
+
Credentials embedded in a proxy URL are redacted before the message is printed, so it is safe to paste into an issue.
|
|
33
|
+
|
|
34
|
+
## `Wopee API rejected the request: 401 Unauthorized.`
|
|
35
|
+
|
|
36
|
+
**Symptom.** The API is reachable but refuses the request.
|
|
37
|
+
|
|
38
|
+
**Cause.** `WOPEE_API_KEY` was not accepted, or it belongs to a different project than `WOPEE_PROJECT_UUID`.
|
|
39
|
+
|
|
40
|
+
**Fix.** View or regenerate the key under Project Settings → API Keys at [cmd.wopee.io](https://cmd.wopee.io), and check it belongs to the project UUID shown in the message.
|
|
41
|
+
|
|
42
|
+
## `[WOPEE_REPORTER_ERROR]: Wopee reporter is disabled`
|
|
43
|
+
|
|
44
|
+
**Symptom.** Tests run and visual checks work, but results never appear in the dashboard.
|
|
45
|
+
|
|
46
|
+
**Cause.** The reporter reads `WOPEE_API_KEY` and `WOPEE_PROJECT_UUID` independently of the fixture. If they are not visible to the reporter process, it skips uploading rather than sending unauthenticated requests.
|
|
47
|
+
|
|
48
|
+
**Fix.** Ensure the variables are set in the environment Playwright itself runs in. Assigning them inside `playwright.config.ts` works; assigning them inside a test file does not, because the reporter is constructed first.
|
|
49
|
+
|
|
50
|
+
## Programmatic handling
|
|
51
|
+
|
|
52
|
+
Errors are `WopeeError` instances carrying a stable `code`. Branch on that rather than on message text:
|
|
53
|
+
|
|
54
|
+
| Code | Meaning |
|
|
55
|
+
| ------------------------ | ------------------------------------------- |
|
|
56
|
+
| `WOPEE_CONFIG_INVALID` | Required configuration missing or malformed |
|
|
57
|
+
| `WOPEE_API_UNREACHABLE` | No response — network, DNS, TLS or proxy |
|
|
58
|
+
| `WOPEE_API_UNAUTHORIZED` | API key rejected (401/403) |
|
|
59
|
+
| `WOPEE_API_ERROR` | Any other API failure |
|
|
@@ -8,36 +8,46 @@ on:
|
|
|
8
8
|
branches:
|
|
9
9
|
- 'dev'
|
|
10
10
|
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
packages: read
|
|
14
|
+
|
|
11
15
|
jobs:
|
|
12
16
|
npm-clean-install:
|
|
13
17
|
runs-on: builder
|
|
18
|
+
container:
|
|
19
|
+
image: node:24
|
|
20
|
+
options: --user 1000
|
|
14
21
|
|
|
15
22
|
steps:
|
|
16
23
|
- name: Check-out
|
|
17
|
-
uses: actions/checkout@
|
|
24
|
+
uses: actions/checkout@v7
|
|
18
25
|
with:
|
|
19
26
|
fetch-depth: 1
|
|
20
27
|
|
|
21
28
|
- name: Install
|
|
22
|
-
uses:
|
|
29
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
23
30
|
with:
|
|
24
|
-
npm-token: ${{
|
|
31
|
+
npm-token: ${{ github.token }}
|
|
25
32
|
|
|
26
33
|
static-check:
|
|
27
34
|
needs: [npm-clean-install]
|
|
28
35
|
if: github.event_name == 'pull_request'
|
|
29
36
|
runs-on: builder
|
|
37
|
+
container:
|
|
38
|
+
image: node:24
|
|
39
|
+
options: --user 1000
|
|
30
40
|
|
|
31
41
|
steps:
|
|
32
42
|
- name: Check-out
|
|
33
|
-
uses: actions/checkout@
|
|
43
|
+
uses: actions/checkout@v7
|
|
34
44
|
with:
|
|
35
45
|
fetch-depth: 0
|
|
36
46
|
|
|
37
47
|
- name: Install
|
|
38
|
-
uses:
|
|
48
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
39
49
|
with:
|
|
40
|
-
npm-token: ${{
|
|
50
|
+
npm-token: ${{ github.token }}
|
|
41
51
|
|
|
42
52
|
- name: Commitlint
|
|
43
53
|
if: ${{ always() }}
|
|
@@ -61,17 +71,20 @@ jobs:
|
|
|
61
71
|
before-build-test:
|
|
62
72
|
needs: [npm-clean-install]
|
|
63
73
|
runs-on: builder
|
|
74
|
+
container:
|
|
75
|
+
image: node:24
|
|
76
|
+
options: --user 1000
|
|
64
77
|
|
|
65
78
|
steps:
|
|
66
79
|
- name: Check-out
|
|
67
|
-
uses: actions/checkout@
|
|
80
|
+
uses: actions/checkout@v7
|
|
68
81
|
with:
|
|
69
82
|
fetch-depth: 1
|
|
70
83
|
|
|
71
84
|
- name: Install
|
|
72
|
-
uses:
|
|
85
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
73
86
|
with:
|
|
74
|
-
npm-token: ${{
|
|
87
|
+
npm-token: ${{ github.token }}
|
|
75
88
|
|
|
76
89
|
- name: Prepare .env
|
|
77
90
|
shell: bash
|
|
@@ -94,17 +107,20 @@ jobs:
|
|
|
94
107
|
build:
|
|
95
108
|
needs: [npm-clean-install]
|
|
96
109
|
runs-on: builder
|
|
110
|
+
container:
|
|
111
|
+
image: node:24
|
|
112
|
+
options: --user 1000
|
|
97
113
|
|
|
98
114
|
steps:
|
|
99
115
|
- name: Check-out
|
|
100
|
-
uses: actions/checkout@
|
|
116
|
+
uses: actions/checkout@v7
|
|
101
117
|
with:
|
|
102
118
|
fetch-depth: 1
|
|
103
119
|
|
|
104
120
|
- name: Install
|
|
105
|
-
uses:
|
|
121
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
106
122
|
with:
|
|
107
|
-
npm-token: ${{
|
|
123
|
+
npm-token: ${{ github.token }}
|
|
108
124
|
|
|
109
125
|
- name: Build
|
|
110
126
|
run: make build
|
|
@@ -112,17 +128,20 @@ jobs:
|
|
|
112
128
|
after-build-test:
|
|
113
129
|
needs: [build]
|
|
114
130
|
runs-on: builder
|
|
131
|
+
container:
|
|
132
|
+
image: node:24
|
|
133
|
+
options: --user 1000
|
|
115
134
|
|
|
116
135
|
steps:
|
|
117
136
|
- name: Check-out
|
|
118
|
-
uses: actions/checkout@
|
|
137
|
+
uses: actions/checkout@v7
|
|
119
138
|
with:
|
|
120
139
|
fetch-depth: 1
|
|
121
140
|
|
|
122
141
|
- name: Install
|
|
123
|
-
uses:
|
|
142
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
124
143
|
with:
|
|
125
|
-
npm-token: ${{
|
|
144
|
+
npm-token: ${{ github.token }}
|
|
126
145
|
|
|
127
146
|
- name: E2E test
|
|
128
147
|
run: echo no-test
|
|
@@ -131,21 +150,29 @@ jobs:
|
|
|
131
150
|
needs: [before-build-test, after-build-test]
|
|
132
151
|
if: github.event_name == 'push'
|
|
133
152
|
runs-on: builder
|
|
153
|
+
permissions:
|
|
154
|
+
contents: write
|
|
155
|
+
issues: write
|
|
156
|
+
pull-requests: write
|
|
157
|
+
packages: write
|
|
158
|
+
container:
|
|
159
|
+
image: node:24
|
|
160
|
+
options: --user 1000
|
|
134
161
|
|
|
135
162
|
steps:
|
|
136
163
|
- name: Check-out
|
|
137
|
-
uses: actions/checkout@
|
|
164
|
+
uses: actions/checkout@v7
|
|
138
165
|
with:
|
|
139
166
|
fetch-depth: 1
|
|
140
167
|
|
|
141
168
|
- name: Install
|
|
142
|
-
uses:
|
|
169
|
+
uses: autonomous-testing/npm-install-action@v3
|
|
143
170
|
with:
|
|
144
|
-
npm-token: ${{
|
|
171
|
+
npm-token: ${{ github.token }}
|
|
145
172
|
|
|
146
173
|
- name: Release
|
|
147
174
|
shell: bash
|
|
148
175
|
env:
|
|
149
|
-
GH_TOKEN: ${{
|
|
150
|
-
NPM_TOKEN: ${{
|
|
176
|
+
GH_TOKEN: ${{ github.token }}
|
|
177
|
+
NPM_TOKEN: ${{ github.token }}
|
|
151
178
|
run: make release
|
|
@@ -1,57 +1,150 @@
|
|
|
1
|
-
# Wopee SDK
|
|
1
|
+
# Wopee.io JavaScript SDK for Autonomous Testing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@wopee-io/sdk)
|
|
4
|
+
[](https://www.npmjs.com/package/@wopee-io/sdk)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Connect any JavaScript or TypeScript test framework to [Wopee.io](https://wopee.io) for visual regression testing. Capture screenshots from your tests and let Wopee.io compare them against baselines — with AI-powered autonomous maintenance.
|
|
6
7
|
|
|
8
|
+
## When to use this SDK
|
|
9
|
+
|
|
10
|
+
Use `@wopee-io/sdk` when you want to add visual testing to a framework that doesn't have a dedicated Wopee.io plugin. If you use Playwright, Cypress, or WebdriverIO, use the dedicated packages instead:
|
|
11
|
+
|
|
12
|
+
- **Playwright** → [`@wopee-io/wopee.pw`](https://www.npmjs.com/package/@wopee-io/wopee.pw)
|
|
13
|
+
- **Cypress** → [`@wopee-io/wopee.cy`](https://www.npmjs.com/package/@wopee-io/wopee.cy)
|
|
14
|
+
- **WebdriverIO** → [`@wopee-io/wopee.wdio`](https://www.npmjs.com/package/@wopee-io/wopee.wdio)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @wopee-io/sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### 1. Get your credentials
|
|
25
|
+
|
|
26
|
+
Sign up at [cmd.wopee.io](https://cmd.wopee.io) and create a project. You'll need:
|
|
27
|
+
|
|
28
|
+
- **API Key** — from Project Settings → API Keys
|
|
29
|
+
- **Project UUID** — from Project Settings
|
|
30
|
+
|
|
31
|
+
### 2. Set environment variables
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
export WOPEE_API_URL=https://api.wopee.io
|
|
35
|
+
export WOPEE_API_KEY=your-api-key
|
|
36
|
+
export WOPEE_PROJECT_UUID=your-project-uuid
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`WOPEE_API_KEY` and `WOPEE_PROJECT_UUID` are required. `WOPEE_API_URL` is optional and defaults to the SaaS endpoint `https://api.wopee.io`.
|
|
40
|
+
|
|
41
|
+
#### Self-hosted instances
|
|
42
|
+
|
|
43
|
+
If your organisation runs its own Wopee instance, `WOPEE_API_URL` points at a host inside the customer network (for example `https://api.acme.wopee.io`). That host is usually **not reachable from a laptop on the public internet** — you need to be on the corporate VPN, behind the corporate proxy, or running the tests from a CI runner inside that network.
|
|
44
|
+
|
|
45
|
+
The SDK honours the standard proxy variables:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export HTTPS_PROXY=http://proxy.corp:8080
|
|
49
|
+
export NO_PROXY=localhost,127.0.0.1,.internal
|
|
7
50
|
```
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
51
|
+
|
|
52
|
+
`NO_PROXY` supports exact hosts, leading-dot suffixes (`.acme.io`), `host:port` entries, CIDR ranges (`10.0.0.0/8`) and `*`.
|
|
53
|
+
|
|
54
|
+
### 3. Capture and track screenshots
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { ApolloTrackAdapterService } from '@wopee-io/sdk';
|
|
58
|
+
|
|
59
|
+
// Create a tracker instance
|
|
60
|
+
const tracker = ApolloTrackAdapterService.create({
|
|
61
|
+
apiUrl: process.env.WOPEE_API_URL,
|
|
62
|
+
apiKey: process.env.WOPEE_API_KEY,
|
|
63
|
+
projectId: process.env.WOPEE_PROJECT_UUID,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Start a test suite
|
|
67
|
+
await tracker.startSuite('My Test Suite');
|
|
68
|
+
|
|
69
|
+
// Track a screenshot (pass a base64-encoded image)
|
|
70
|
+
await tracker.track({
|
|
71
|
+
stepName: 'Homepage',
|
|
72
|
+
imageBase64: screenshotData,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Track another step
|
|
76
|
+
await tracker.track({
|
|
77
|
+
stepName: 'After Login',
|
|
78
|
+
imageBase64: anotherScreenshot,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// End the suite
|
|
82
|
+
await tracker.stopSuite();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Example: Integration with Puppeteer
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { ApolloTrackAdapterService } from '@wopee-io/sdk';
|
|
89
|
+
import puppeteer from 'puppeteer';
|
|
90
|
+
|
|
91
|
+
const browser = await puppeteer.launch();
|
|
92
|
+
const page = await browser.newPage();
|
|
93
|
+
|
|
94
|
+
const tracker = ApolloTrackAdapterService.create({
|
|
95
|
+
apiUrl: process.env.WOPEE_API_URL,
|
|
96
|
+
apiKey: process.env.WOPEE_API_KEY,
|
|
97
|
+
projectId: process.env.WOPEE_PROJECT_UUID,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
await tracker.startSuite('Puppeteer Visual Tests');
|
|
101
|
+
|
|
102
|
+
await page.goto('https://example.com');
|
|
103
|
+
const screenshot = await page.screenshot({ encoding: 'base64' });
|
|
104
|
+
await tracker.track({ stepName: 'Homepage', imageBase64: screenshot });
|
|
105
|
+
|
|
106
|
+
await tracker.stopSuite();
|
|
107
|
+
await browser.close();
|
|
25
108
|
```
|
|
26
109
|
|
|
27
|
-
##
|
|
110
|
+
## How it works
|
|
28
111
|
|
|
29
|
-
|
|
112
|
+
1. Your test captures a screenshot (any method — Puppeteer, Selenium, custom)
|
|
113
|
+
2. The SDK sends the base64 image to the Wopee.io API
|
|
114
|
+
3. Wopee.io compares it against the stored baseline
|
|
115
|
+
4. Results are available in the [Wopee.io dashboard](https://cmd.wopee.io)
|
|
116
|
+
5. AI-powered maintenance automatically handles expected UI changes
|
|
30
117
|
|
|
31
|
-
|
|
118
|
+
## Troubleshooting
|
|
32
119
|
|
|
33
|
-
|
|
120
|
+
The SDK throws `WopeeError`. Branch on `error.code` rather than matching the message text — messages are written for humans and may be reworded.
|
|
34
121
|
|
|
35
|
-
|
|
122
|
+
### `Wopee SDK configuration is invalid — cannot initialize.`
|
|
36
123
|
|
|
37
|
-
|
|
124
|
+
Code: `WOPEE_CONFIG_INVALID`. A required value was missing or malformed. The error lists each offending field and where to get the value:
|
|
38
125
|
|
|
39
|
-
-
|
|
126
|
+
- `apiKey` — Project Settings → API Keys at [cmd.wopee.io](https://cmd.wopee.io), usually supplied as `WOPEE_API_KEY`.
|
|
127
|
+
- `projectUuid` — Project Settings, usually supplied as `WOPEE_PROJECT_UUID`.
|
|
128
|
+
- `apiUrl` — must include the scheme. `api.acme.wopee.io` is rejected; `https://api.acme.wopee.io` is accepted.
|
|
40
129
|
|
|
41
|
-
|
|
130
|
+
An empty string counts as missing, so a stray `WOPEE_API_KEY=` in a `.env` file is reported here rather than failing later as a `401`.
|
|
42
131
|
|
|
43
|
-
|
|
132
|
+
### `Cannot reach the Wopee API at <url>.`
|
|
44
133
|
|
|
45
|
-
|
|
134
|
+
Code: `WOPEE_API_UNREACHABLE`. The request never got a response — DNS, TCP, TLS or proxy failure. The message reports the URL that was attempted, the underlying failure, and whether a proxy was in effect. Common causes:
|
|
46
135
|
|
|
47
|
-
|
|
136
|
+
1. The instance is self-hosted and only reachable from the customer network — connect to the VPN or run the tests from a CI runner inside it.
|
|
137
|
+
2. A corporate proxy is required — set `HTTPS_PROXY`. If the message says the host was **bypassed**, it matched `NO_PROXY`; remove the matching entry if the proxy is how you reach it.
|
|
138
|
+
3. `WOPEE_API_URL` points at the wrong host — confirm it with your Wopee administrator.
|
|
48
139
|
|
|
49
|
-
|
|
140
|
+
Credentials embedded in a proxy URL are redacted before the message is printed.
|
|
50
141
|
|
|
51
|
-
|
|
142
|
+
### `Wopee API rejected the request: 401 Unauthorized.`
|
|
52
143
|
|
|
53
|
-
|
|
144
|
+
Code: `WOPEE_API_UNAUTHORIZED`. The API key was not accepted. View or regenerate it under Project Settings → API Keys at [cmd.wopee.io](https://cmd.wopee.io), and check that the key belongs to the project shown in the message.
|
|
54
145
|
|
|
55
|
-
|
|
146
|
+
## Links
|
|
56
147
|
|
|
57
|
-
|
|
148
|
+
- [Documentation](https://docs.wopee.io/) — setup guides and API reference
|
|
149
|
+
- [Wopee.io Platform](https://cmd.wopee.io) — manage baselines, review results
|
|
150
|
+
- [Wopee.io Website](https://wopee.io) — learn more about autonomous testing
|
package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/adapter.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.ApolloAdapter = void 0;
|
|
|
7
7
|
const core_1 = require("../../../core");
|
|
8
8
|
const shared_1 = require("../../../shared");
|
|
9
9
|
const axios_config_1 = require("./axios-config");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
10
11
|
const factories_1 = require("./factories");
|
|
11
12
|
const interface_1 = require("./interface");
|
|
12
13
|
const mutations_1 = require("./mutations");
|
|
@@ -22,18 +23,13 @@ class ApolloAdapter extends core_1.ApiPort {
|
|
|
22
23
|
this._config = config;
|
|
23
24
|
}
|
|
24
25
|
async _post(query, variables) {
|
|
26
|
+
const apiUrl = this._config.apiUrl;
|
|
25
27
|
try {
|
|
26
28
|
const headers = { api_key: this._config.apiKey };
|
|
27
|
-
|
|
28
|
-
return await axios_1.default.post(this._config.apiUrl, { query, variables }, config);
|
|
29
|
+
return await axios_1.default.post(apiUrl, { query, variables }, (0, axios_config_1.buildAxiosConfig)(apiUrl, headers));
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
|
-
|
|
32
|
-
const status = error.response?.status;
|
|
33
|
-
const errorMessage = error.message;
|
|
34
|
-
throw new shared_1.WopeeError(`API request failed with status code: ${status}. ${errorMessage}`);
|
|
35
|
-
}
|
|
36
|
-
throw new Error('Unexpected error occurred during API call.');
|
|
32
|
+
throw (0, errors_1.toApiRequestError)(error, { apiUrl, projectUuid: this._config.projectUuid });
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
get suite() {
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import 'dotenv/config';
|
|
3
|
+
export type ProxyDecision = {
|
|
4
|
+
proxyUrl: string | null;
|
|
5
|
+
noProxy: string;
|
|
6
|
+
/**
|
|
7
|
+
* True when a proxy was skipped *because the host matched NO_PROXY*, as
|
|
8
|
+
* opposed to no proxy being configured at all. The two look identical from
|
|
9
|
+
* `proxyUrl` alone but have very different fixes, so error reporting needs
|
|
10
|
+
* to tell them apart.
|
|
11
|
+
*/
|
|
12
|
+
bypassedByNoProxy: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function getProxyDecision(url: string): ProxyDecision;
|
|
3
15
|
export declare function buildAxiosConfig(url: string, headers: Record<string, string>): AxiosRequestConfig;
|
|
4
16
|
//# sourceMappingURL=axios-config.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProxyDecision = getProxyDecision;
|
|
3
4
|
exports.buildAxiosConfig = buildAxiosConfig;
|
|
4
5
|
require("dotenv/config");
|
|
5
6
|
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
@@ -87,17 +88,17 @@ function isNoProxyMatch(url, noProxy) {
|
|
|
87
88
|
function getProxyDecision(url) {
|
|
88
89
|
const noProxy = process.env['NO_PROXY'] || process.env['no_proxy'] || '';
|
|
89
90
|
if (!url) {
|
|
90
|
-
return { proxyUrl: null, noProxy };
|
|
91
|
+
return { proxyUrl: null, noProxy, bypassedByNoProxy: false };
|
|
91
92
|
}
|
|
92
93
|
if (isNoProxyMatch(url, noProxy)) {
|
|
93
|
-
return { proxyUrl: null, noProxy };
|
|
94
|
+
return { proxyUrl: null, noProxy, bypassedByNoProxy: true };
|
|
94
95
|
}
|
|
95
96
|
try {
|
|
96
97
|
const proxyUrl = (0, proxy_from_env_1.getProxyForUrl)(url);
|
|
97
|
-
return { proxyUrl: proxyUrl || null, noProxy };
|
|
98
|
+
return { proxyUrl: proxyUrl || null, noProxy, bypassedByNoProxy: false };
|
|
98
99
|
}
|
|
99
100
|
catch {
|
|
100
|
-
return { proxyUrl: null, noProxy };
|
|
101
|
+
return { proxyUrl: null, noProxy, bypassedByNoProxy: false };
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
function buildAxiosConfig(url, headers) {
|
package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/errors.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WopeeError } from '../../../shared';
|
|
2
|
+
import { ZodError } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Turns a zod validation failure into readable prose. Fields without a hint fall
|
|
5
|
+
* back to the bare zod message, so every config failure reads as a sentence
|
|
6
|
+
* rather than a ZodError dump.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toConfigError(error: ZodError): WopeeError;
|
|
9
|
+
/**
|
|
10
|
+
* Wraps a failed API call in a `WopeeError` that says what to do about it.
|
|
11
|
+
*
|
|
12
|
+
* The discriminator for "unreachable" is the absence of a response rather than
|
|
13
|
+
* an errno allowlist — that covers DNS, TCP, TLS and proxy-tunnel failures
|
|
14
|
+
* without going stale.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toApiRequestError(error: unknown, context: {
|
|
17
|
+
apiUrl: string;
|
|
18
|
+
projectUuid?: string;
|
|
19
|
+
}): WopeeError;
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|