@supatest/wdio-appium-reporter 0.0.1 → 0.0.2

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/README.md ADDED
@@ -0,0 +1,234 @@
1
+ # @supatest/wdio-appium-reporter
2
+
3
+ WebdriverIO reporter for Appium that streams mobile test results to the Supatest dashboard in real-time. Captures device metadata, screenshots, screen recordings, and CI/Git context for iOS and Android runs.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js >= 18.0.0
8
+ - WebdriverIO >= 8.0.0
9
+ - Appium >= 2.0.0
10
+ - `@wdio/appium-service`
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @supatest/wdio-appium-reporter --save-dev
16
+ # or
17
+ pnpm add @supatest/wdio-appium-reporter --save-dev
18
+ ```
19
+
20
+ ## Configuration
21
+
22
+ Add to your `wdio.conf.ts`:
23
+
24
+ ```typescript
25
+ import type { Options } from '@wdio/types';
26
+
27
+ export const config: Options.Testrunner = {
28
+ services: [
29
+ ['appium', {
30
+ command: 'appium',
31
+ args: { relaxedSecurity: true },
32
+ }],
33
+ ],
34
+
35
+ reporters: [
36
+ 'spec',
37
+ ['@supatest/wdio-appium-reporter', {
38
+ projectId: process.env.SUPATEST_PROJECT_ID,
39
+ apiKey: process.env.SUPATEST_API_KEY,
40
+ }],
41
+ ],
42
+ };
43
+ ```
44
+
45
+ ### iOS example
46
+
47
+ ```typescript
48
+ const iosCapabilities = {
49
+ platformName: 'iOS',
50
+ 'appium:deviceName': 'iPhone 15 Pro',
51
+ 'appium:platformVersion': '17.2',
52
+ 'appium:automationName': 'XCUITest',
53
+ 'appium:app': '/path/to/MyApp.app',
54
+ 'appium:bundleId': 'com.example.myapp',
55
+ };
56
+ ```
57
+
58
+ ### Android example
59
+
60
+ ```typescript
61
+ const androidCapabilities = {
62
+ platformName: 'Android',
63
+ 'appium:deviceName': 'emulator-5554',
64
+ 'appium:platformVersion': '13',
65
+ 'appium:automationName': 'UiAutomator2',
66
+ 'appium:app': '/path/to/MyApp.apk',
67
+ 'appium:appPackage': 'com.example.myapp',
68
+ 'appium:appActivity': 'com.example.myapp.MainActivity',
69
+ };
70
+ ```
71
+
72
+ ## Environment Variables
73
+
74
+ | Variable | Description |
75
+ |----------|-------------|
76
+ | `SUPATEST_API_KEY` | **Required.** Your Supatest API key |
77
+ | `SUPATEST_PROJECT_ID` | **Required.** Your project identifier for organizing test runs |
78
+ | `SUPATEST_API_URL` | Optional. Custom API endpoint (default: `https://code-api.supatest.ai`) |
79
+ | `SUPATEST_DRY_RUN` | Optional. Set to `true` to log payloads instead of sending |
80
+
81
+ ## Configuration Options
82
+
83
+ | Option | Type | Default | Description |
84
+ |--------|------|---------|-------------|
85
+ | `projectId` | `string` | — | **Required.** Your Supatest project ID |
86
+ | `apiKey` | `string` | — | **Required.** Your Supatest API key |
87
+ | `apiUrl` | `string` | `https://code-api.supatest.ai` | API endpoint URL |
88
+ | `uploadAssets` | `boolean` | `true` | Upload screenshots and screen recordings |
89
+ | `screenshotDir` | `string` | — | Watch this directory for screenshots saved via `browser.saveScreenshot()` |
90
+ | `maxConcurrentUploads` | `number` | `5` | Maximum concurrent asset uploads |
91
+ | `retryAttempts` | `number` | `3` | Retry attempts for failed API calls |
92
+ | `timeoutMs` | `number` | `30000` | Timeout for API calls in milliseconds |
93
+ | `dryRun` | `boolean` | `false` | Log payloads without sending to API |
94
+
95
+ ## Features
96
+
97
+ ### Mobile Metadata
98
+ Automatically captured from Appium capabilities:
99
+ - `platformName`, `deviceName`, `platformVersion`
100
+ - `automationName` (XCUITest / UiAutomator2)
101
+ - `udid`, `bundleId`, `appPackage`, `appActivity`
102
+ - Appium version and session ID
103
+
104
+ ### Screenshot Capture
105
+ Screenshots are automatically captured and uploaded when you call:
106
+ ```typescript
107
+ await browser.saveScreenshot('./screenshots/my-screen.png');
108
+ ```
109
+ The reporter intercepts the `saveScreenshot` and `takeScreenshot` commands and uploads the images as test attachments.
110
+
111
+ ### Screen Recording
112
+ Screen recordings are captured when you use Appium's recording API:
113
+ ```typescript
114
+ await driver.startRecordingScreen({ videoType: 'mp4', videoQuality: 'low' });
115
+ // ... run your test steps ...
116
+ const video = await driver.stopRecordingScreen();
117
+ ```
118
+ The reporter intercepts `stopRecordingScreen` and uploads the MP4 as a test attachment.
119
+
120
+ ### Stable Test IDs
121
+ Assign stable IDs in test titles for consistent tracking across runs:
122
+ ```typescript
123
+ it('should login with valid credentials @id:TC-M-001 @priority:critical', async () => {
124
+ // ...
125
+ });
126
+ ```
127
+
128
+ Supported tags: `@id:`, `@priority:`, `@owner:`, `@feature:`
129
+
130
+ ## CI/CD Integration
131
+
132
+ Automatically detects and captures context from:
133
+ - GitHub Actions, GitLab CI, Jenkins, CircleCI, Travis CI, Buildkite, Azure Pipelines
134
+
135
+ Git information (branch, commit, author) is extracted from CI environment variables and the local git repository.
136
+
137
+ ## Example `wdio.conf.ts`
138
+
139
+ ```typescript
140
+ import { existsSync, mkdirSync } from 'node:fs';
141
+ import type { Options } from '@wdio/types';
142
+
143
+ export const config: Options.Testrunner = {
144
+ runner: 'local',
145
+ specs: [['./test/specs/**/*.ts']], // grouped = one Appium session
146
+ maxInstances: 1,
147
+
148
+ capabilities: [{
149
+ platformName: 'iOS',
150
+ 'appium:deviceName': 'iPhone 15 Pro',
151
+ 'appium:platformVersion': '17.2',
152
+ 'appium:automationName': 'XCUITest',
153
+ 'appium:app': '/path/to/MyApp.app',
154
+ 'appium:bundleId': 'com.example.myapp',
155
+ 'appium:newCommandTimeout': 240,
156
+ }],
157
+
158
+ services: [
159
+ ['appium', {
160
+ command: 'appium',
161
+ args: { relaxedSecurity: true, log: './logs/appium.log' },
162
+ }],
163
+ ],
164
+
165
+ framework: 'mocha',
166
+ reporters: [
167
+ 'spec',
168
+ ['@supatest/wdio-appium-reporter', {
169
+ projectId: process.env.SUPATEST_PROJECT_ID,
170
+ apiKey: process.env.SUPATEST_API_KEY,
171
+ apiUrl: process.env.SUPATEST_API_URL,
172
+ uploadAssets: true,
173
+ screenshotDir: './screenshots',
174
+ dryRun: process.env.SUPATEST_DRY_RUN === 'true',
175
+ }],
176
+ ],
177
+
178
+ mochaOpts: { ui: 'bdd', timeout: 180000 },
179
+
180
+ onPrepare() {
181
+ if (!existsSync('./screenshots')) mkdirSync('./screenshots', { recursive: true });
182
+ if (!existsSync('./logs')) mkdirSync('./logs', { recursive: true });
183
+ },
184
+ };
185
+ ```
186
+
187
+ ## Development
188
+
189
+ ### Running Tests
190
+
191
+ ```bash
192
+ pnpm test:run # Unit tests (Vitest)
193
+ pnpm test:coverage # Unit tests with coverage
194
+ ```
195
+
196
+ ### Integration Tests
197
+
198
+ ```bash
199
+ pnpm test:integration # Build + run full E2E against a real device/emulator
200
+ ```
201
+
202
+ Requires:
203
+ - A running iOS Simulator or Android emulator
204
+ - The target app installed
205
+ - Local API running on `http://localhost:9090`
206
+
207
+ ### Dry-Run Verification
208
+
209
+ To verify the reporter data flow without a real device:
210
+
211
+ ```bash
212
+ npx tsx scripts/dry-run-verify.ts
213
+ ```
214
+
215
+ This exercises the full reporter lifecycle with synthetic Android and iOS data — no device or API key required.
216
+
217
+ ### Test Suite Configuration
218
+
219
+ ```bash
220
+ # reporter-test-suites/appium-saucedemo/.env
221
+ SUPATEST_API_URL=http://localhost:9090
222
+ SUPATEST_API_KEY=sk_test_...
223
+ SUPATEST_PROJECT_ID=proj_local_appium
224
+ SUPATEST_DRY_RUN=false
225
+
226
+ # Platform (ios | android)
227
+ PLATFORM=ios
228
+ IOS_UDID=<simulator-udid>
229
+ IOS_APP_PATH=/path/to/MyApp.app
230
+ ```
231
+
232
+ ## License
233
+
234
+ ISC