@testchimp/playwright 0.1.27 → 0.1.29

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 CHANGED
@@ -21,9 +21,9 @@ You run tests with the normal Playwright CLI or via your CI (GitHub Actions etc.
21
21
 
22
22
  The reporter plugin pipes AI-native step calls (`ai.act`, `ai.verify`, etc.) via TestChimp backends, so that those steps work seamlessly—wherever you run your tests (local, CI, or any environment).
23
23
 
24
- ### 3. Augment @testchimp/rum-js events for TrueCoverage (test ↔ real user alignment)
24
+ ### 3. Augment RUM events for TrueCoverage (test ↔ real user alignment)
25
25
 
26
- [@testchimp/rum-js](https://www.npmjs.com/package/@testchimp/rum-js) emits real user events from the browser to TestChimp. When the same app is exercised **in CI by Playwright**, you want those events to be tagged with **which test** produced them so TestChimp can:
26
+ [@testchimp/rum-js](https://www.npmjs.com/package/@testchimp/rum-js) (web), **TestChimpRum** (iOS — Swift package [testchimp-rum-ios](https://github.com/testchimphq/testchimp-rum-ios)), and **TestChimpRum** (Android — [testchimp-rum-android](https://github.com/testchimphq/testchimp-rum-android), typically via JitPack: `com.github.testchimphq:testchimp-rum-android:<tag>` per [JitPack](https://jitpack.io/#testchimphq/testchimp-rum-android)) emit real user events to TestChimp. When the same app is exercised **in CI** (Playwright or Mobilewright), you want those events tagged with **which test** produced them so TestChimp can:
27
27
 
28
28
  - Align test runs with real user sessions (TrueCoverage)
29
29
  - See which tests generated which events
@@ -72,18 +72,26 @@ export default defineConfig({
72
72
  });
73
73
  ```
74
74
 
75
- For TrueCoverage, add the following import in your tests:
75
+ For TrueCoverage, **wrap and re-export** `test` from your fixtures entry (recommended):
76
76
 
77
+ ```ts
78
+ import { test as base } from '@playwright/test'; // or '@mobilewright/test'
79
+ import { installTestChimp } from '@testchimp/playwright/runtime';
80
+ export const test = installTestChimp(base);
77
81
  ```
78
- import '@testchimp/playwright/runtime';
79
- ```
80
82
 
81
- For mobile projects, also set:
83
+ A side-effect-only `import '@testchimp/playwright/runtime'` does not apply extended fixtures or mobile hooks; the returned `TestType` from `installTestChimp` must be what your specs import.
84
+
85
+ **Web:** the runtime injects `__TC_CI_TEST_INFO` on the `page` fixture for `@testchimp/rum-js`.
86
+
87
+ **Mobile (iOS/Android):** set `TESTCHIMP_PROJECT_TYPE=ios` or `android`. The runtime always registers `beforeEach`/`afterEach` hooks that call `device.openUrl` to push CI metadata into the app. Integrate **TestChimpRum** for that platform (see `testchimp-rum-ios` / `testchimp-rum-android` READMEs): URL scheme / intent filter for `testchimp-rum://truecoverage/...`.
82
88
 
83
89
  ```bash
84
90
  export TESTCHIMP_PROJECT_TYPE=ios # or android
85
91
  ```
86
92
 
93
+ Optional URL overrides: `TESTCHIMP_RUM_AUTOMATION_SET_PREFIX`, `TESTCHIMP_RUM_AUTOMATION_CLEAR_URL` (defaults match the native SDKs).
94
+
87
95
  ### 2. Environment variables
88
96
 
89
97
  Set these so the reporter can talk to TestChimp (env vars override programmatic options):
@@ -95,7 +103,9 @@ Set these so the reporter can talk to TestChimp (env vars override programmatic
95
103
  | `TESTCHIMP_TESTS_FOLDER` | No | Base folder for relative paths (default: `tests`). |
96
104
  | `TESTCHIMP_RELEASE` | No | Release/version identifier. |
97
105
  | `TESTCHIMP_ENV` | No | Environment (e.g. `staging`, `prod`). |
98
- | `TESTCHIMP_PROJECT_TYPE` | No | Fixture/runtime switch: `web` (default) or mobile values (`ios`/`android`). |
106
+ | `TESTCHIMP_PROJECT_TYPE` | No | Fixture/runtime switch: `web` (default) or mobile (`ios`/`android`). Mobile mode always pushes CI JSON via `device.openUrl` (TrueCoverage). |
107
+ | `TESTCHIMP_RUM_AUTOMATION_SET_PREFIX` | No | Override set-URL prefix (default `testchimp-rum://truecoverage/v1/set?p=` + base64url JSON). |
108
+ | `TESTCHIMP_RUM_AUTOMATION_CLEAR_URL` | No | Override clear URL (default `testchimp-rum://truecoverage/v1/clear`). |
99
109
 
100
110
  If `TESTCHIMP_API_KEY` is missing, the reporter logs a warning and disables reporting (no request is sent).
101
111
 
@@ -153,9 +163,10 @@ Retries are tracked; with `reportOnlyFinalAttempt: true` only the last attempt i
153
163
 
154
164
  - **Subpath**: `@testchimp/playwright/reporter` — explicit reporter entry for Playwright `reporter` config.
155
165
  - **Named**: `TestChimpReporter`, `TestChimpApiClient`, and types/utilities from `./types` and `./utils`.
156
- - **Subpath**: `@testchimp/playwright/runtime` — side-effect import only; registers `test.beforeEach` to inject CI test info.
157
- - TrueCoverage CI metadata injection is currently web-only (`page` fixture).
158
- - When `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`, TrueCoverage injection is skipped and runtime fixtures focus on mobile marker behavior.
166
+ - **Subpath**: `@testchimp/playwright/runtime` — use `installTestChimp(test)` on your runner’s `test` object (see Quick start).
167
+ - **Web:** extends `page` to set `__TC_CI_TEST_INFO` for `@testchimp/rum-js`.
168
+ - **Mobile:** when `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`, registers hooks that call `device.openUrl` for the iOS Swift SDK and Android Kotlin SDK (same URL contract).
169
+ - **Named**: `buildCiTestInfoJson`, `attachMobileRumAutomationHooks`, etc., for advanced wiring.
159
170
 
160
171
  ---
161
172
 
@@ -171,7 +182,7 @@ Retries are tracked; with `reportOnlyFinalAttempt: true` only the last attempt i
171
182
  Enable screenshot capture in Playwright (e.g. `use: { screenshot: 'only-on-failure' }`). The reporter only attaches existing attachments to failing steps.
172
183
 
173
184
  - **RUM events not linked to tests**
174
- Ensure you `import '@testchimp/playwright/runtime'` in the test files.
185
+ Use `export const test = installTestChimp(...)` from a fixtures barrel and import `test` from there. On mobile, set `TESTCHIMP_PROJECT_TYPE` and handle `testchimp-rum://` URLs in the app (`TestChimpRum.handleAutomationURL` on iOS, `TestChimpRum.handleAutomationIntent` on Android).
175
186
 
176
187
  - **Verbose logging**
177
188
  Set `verbose: true` in reporter options or use it during setup to see which steps are captured and when reports are sent.
@@ -0,0 +1,11 @@
1
+ import { type TestInfoLike } from './utils';
2
+ /** Payload embedded in `ci-test-info` header and `__TC_CI_TEST_INFO` (mirrors web runtime). */
3
+ export type CiTestInfo = Record<string, unknown>;
4
+ export type TestInfoForCi = TestInfoLike & {
5
+ retry?: number;
6
+ workerIndex?: number;
7
+ testId?: string | number;
8
+ };
9
+ export declare function buildCiTestInfoObject(testInfo: TestInfoForCi, projectRootDir: string): CiTestInfo;
10
+ export declare function buildCiTestInfoJson(testInfo: TestInfoForCi, projectRootDir: string): string;
11
+ //# sourceMappingURL=ci-test-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-test-info.d.ts","sourceRoot":"","sources":["../src/ci-test-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB,+FAA+F;AAC/F,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,MAAM,GACrB,UAAU,CAmCZ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE3F"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCiTestInfoObject = buildCiTestInfoObject;
4
+ exports.buildCiTestInfoJson = buildCiTestInfoJson;
5
+ const utils_1 = require("./utils");
6
+ function buildCiTestInfoObject(testInfo, projectRootDir) {
7
+ const testsFolder = (0, utils_1.deriveTestsFolder)(projectRootDir);
8
+ const paths = (0, utils_1.derivePathsFromTestInfo)(testInfo, testsFolder, projectRootDir, false);
9
+ const ciTestInfo = {
10
+ folderPath: paths.folderPath,
11
+ fileName: paths.fileName,
12
+ suitePath: paths.suitePath,
13
+ testName: paths.testName,
14
+ };
15
+ const branchName = (0, utils_1.getBranchName)();
16
+ if (branchName)
17
+ ciTestInfo.branchName = branchName;
18
+ const env = process.env.TESTCHIMP_ENV || process.env.TESTCHIMP_ENVIRONMENT;
19
+ if (env)
20
+ ciTestInfo.environment = String(env).trim();
21
+ const release = process.env.TESTCHIMP_RELEASE || process.env.TESTCHIMP_RELEASE_NAME;
22
+ if (release)
23
+ ciTestInfo.release = release;
24
+ const batchInvocationId = (0, utils_1.readTestChimpBatchInvocationId)(projectRootDir);
25
+ if (batchInvocationId)
26
+ ciTestInfo.batchInvocationId = batchInvocationId;
27
+ if (typeof testInfo.retry === 'number')
28
+ ciTestInfo.retry = testInfo.retry;
29
+ if (typeof testInfo.workerIndex === 'number')
30
+ ciTestInfo.workerIndex = testInfo.workerIndex;
31
+ if (testInfo.testId != null && String(testInfo.testId).length > 0) {
32
+ ciTestInfo.testId = String(testInfo.testId);
33
+ }
34
+ return ciTestInfo;
35
+ }
36
+ function buildCiTestInfoJson(testInfo, projectRootDir) {
37
+ return JSON.stringify(buildCiTestInfoObject(testInfo, projectRootDir));
38
+ }
39
+ //# sourceMappingURL=ci-test-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-test-info.js","sourceRoot":"","sources":["../src/ci-test-info.ts"],"names":[],"mappings":";;AAiBA,sDAsCC;AAED,kDAEC;AA3DD,mCAMiB;AAWjB,SAAgB,qBAAqB,CACnC,QAAuB,EACvB,cAAsB;IAEtB,MAAM,WAAW,GAAG,IAAA,yBAAiB,EAAC,cAAc,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,IAAA,+BAAuB,EACnC,QAAQ,EACR,WAAW,EACX,cAAc,EACd,KAAK,CACN,CAAC;IAEF,MAAM,UAAU,GAAe;QAC7B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,QAAQ,EAAE,KAAK,CA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AS,CAAC,qBAAqB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;AACzE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -28,12 +28,15 @@
28
28
  * Runtime (`@testchimp/playwright/runtime`): use `installTrueCoverage` or `installTestChimp` (same behavior).
29
29
  * Fixture/runtime switching: default web mode uses `page`; set `TESTCHIMP_PROJECT_TYPE=ios|android`
30
30
  * (case-insensitive) to switch runtime fixture wiring to `screen`.
31
+ * Mobile TrueCoverage: `TESTCHIMP_PROJECT_TYPE=ios|android` + TestChimpRum URL handler; see README.
31
32
  * ExploreChimp: set `EXPLORECHIMP_ENABLED=true`, use `test('…', async ({ markScreenState }) => …)`; `TESTCHIMP_BATCH_INVOCATION_ID`, sources/regex envs as documented in the runtime module. Set **`TESTCHIMP_BRANCH_NAME`** (or `TESTCHIMP_BRANCH`) locally so analyze requests send `branchName` and the server can persist `branch_id`.
32
33
  */
33
34
  export { TestChimpReporter } from './testchimp-reporter';
34
35
  export { TestChimpApiClient } from './api-client';
35
36
  export * from './types';
36
37
  export * from './utils';
38
+ export { buildCiTestInfoJson, buildCiTestInfoObject, type CiTestInfo, type TestInfoForCi } from './ci-test-info';
39
+ export { attachMobileRumAutomationHooks, buildAutomationSetOpenUrl, getMobileRumAutomationUrls, } from './rum-automation-mobile';
37
40
  /** ExploreChimp / agents.proto JSON mirrors (camelCase). */
38
41
  export type * from './explorechimp/agents-explorechimp-json';
39
42
  export { DataSourceEnum } from './explorechimp/agents-explorechimp-json';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,4DAA4D;AAC5D,mBAAmB,yCAAyC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjH,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,4DAA4D;AAC5D,mBAAmB,yCAAyC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,eAAe,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@
29
29
  * Runtime (`@testchimp/playwright/runtime`): use `installTrueCoverage` or `installTestChimp` (same behavior).
30
30
  * Fixture/runtime switching: default web mode uses `page`; set `TESTCHIMP_PROJECT_TYPE=ios|android`
31
31
  * (case-insensitive) to switch runtime fixture wiring to `screen`.
32
+ * Mobile TrueCoverage: `TESTCHIMP_PROJECT_TYPE=ios|android` + TestChimpRum URL handler; see README.
32
33
  * ExploreChimp: set `EXPLORECHIMP_ENABLED=true`, use `test('…', async ({ markScreenState }) => …)`; `TESTCHIMP_BATCH_INVOCATION_ID`, sources/regex envs as documented in the runtime module. Set **`TESTCHIMP_BRANCH_NAME`** (or `TESTCHIMP_BRANCH`) locally so analyze requests send `branchName` and the server can persist `branch_id`.
33
34
  */
34
35
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -46,13 +47,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
46
47
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
47
48
  };
48
49
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.DataSourceEnum = exports.TestChimpApiClient = exports.TestChimpReporter = void 0;
50
+ exports.DataSourceEnum = exports.getMobileRumAutomationUrls = exports.buildAutomationSetOpenUrl = exports.attachMobileRumAutomationHooks = exports.buildCiTestInfoObject = exports.buildCiTestInfoJson = exports.TestChimpApiClient = exports.TestChimpReporter = void 0;
50
51
  var testchimp_reporter_1 = require("./testchimp-reporter");
51
52
  Object.defineProperty(exports, "TestChimpReporter", { enumerable: true, get: function () { return testchimp_reporter_1.TestChimpReporter; } });
52
53
  var api_client_1 = require("./api-client");
53
54
  Object.defineProperty(exports, "TestChimpApiClient", { enumerable: true, get: function () { return api_client_1.TestChimpApiClient; } });
54
55
  __exportStar(require("./types"), exports);
55
56
  __exportStar(require("./utils"), exports);
57
+ var ci_test_info_1 = require("./ci-test-info");
58
+ Object.defineProperty(exports, "buildCiTestInfoJson", { enumerable: true, get: function () { return ci_test_info_1.buildCiTestInfoJson; } });
59
+ Object.defineProperty(exports, "buildCiTestInfoObject", { enumerable: true, get: function () { return ci_test_info_1.buildCiTestInfoObject; } });
60
+ var rum_automation_mobile_1 = require("./rum-automation-mobile");
61
+ Object.defineProperty(exports, "attachMobileRumAutomationHooks", { enumerable: true, get: function () { return rum_automation_mobile_1.attachMobileRumAutomationHooks; } });
62
+ Object.defineProperty(exports, "buildAutomationSetOpenUrl", { enumerable: true, get: function () { return rum_automation_mobile_1.buildAutomationSetOpenUrl; } });
63
+ Object.defineProperty(exports, "getMobileRumAutomationUrls", { enumerable: true, get: function () { return rum_automation_mobile_1.getMobileRumAutomationUrls; } });
56
64
  var agents_explorechimp_json_1 = require("./explorechimp/agents-explorechimp-json");
57
65
  Object.defineProperty(exports, "DataSourceEnum", { enumerable: true, get: function () { return agents_explorechimp_json_1.DataSourceEnum; } });
58
66
  // Default export for Playwright reporter configuration
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;;;;;;;;;;;;;;;AAEH,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,2CAAkD;AAAzC,gHAAA,kBAAkB,OAAA;AAC3B,0CAAwB;AACxB,0CAAwB;AAGxB,oFAAyE;AAAhE,0HAAA,cAAc,OAAA;AAEvB,uDAAuD;AACvD,6DAAyD;AACzD,kBAAe,sCAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;;;;;;;;;;;;;;;AAEH,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,2CAAkD;AAAzC,gHAAA,kBAAkB,OAAA;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,+CAAiH;AAAxG,mHAAA,mBAAmB,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AACnD,iEAIiC;AAH/B,uIAAA,8BAA8B,OAAA;AAC9B,kIAAA,yBAAyB,OAAA;AACzB,mIAAA,0BAA0B,OAAA;AAI5B,oFAAyE;AAAhE,0HAAA,cAAc,OAAA;AAEvB,uDAAuD;AACvD,6DAAyD;AACzD,kBAAe,sCAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"project-type.d.ts","sourceRoot":"","sources":["../src/project-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAY3C,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAMjD"}
1
+ {"version":3,"file":"project-type.d.ts","sourceRoot":"","sources":["../src/project-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAa3C,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAIjD"}
@@ -5,7 +5,8 @@ exports.getFixtureKey = getFixtureKey;
5
5
  exports.getTestRuntimeModuleName = getTestRuntimeModuleName;
6
6
  const MOBILE_TYPES = new Set(['ios', 'android']);
7
7
  const DEFAULT_WEB_RUNTIME_MODULE = '@playwright/test';
8
- const DEFAULT_MOBILE_RUNTIME_MODULE = 'mobilewright';
8
+ /** Mobilewright exposes `test` / `expect` from `@mobilewright/test`, not the `mobilewright` CLI package. */
9
+ const DEFAULT_MOBILE_RUNTIME_MODULE = '@mobilewright/test';
9
10
  function normalizedProjectType() {
10
11
  return String(process.env.TESTCHIMP_PROJECT_TYPE ?? '')
11
12
  .trim()
@@ -18,10 +19,8 @@ function getFixtureKey() {
18
19
  return isMobileProjectType() ? 'screen' : 'page';
19
20
  }
20
21
  function getTestRuntimeModuleName() {
21
- if (!isMobileProjectType()) {
22
- return DEFAULT_WEB_RUNTIME_MODULE;
23
- }
24
- const configured = process.env.TESTCHIMP_MOBILE_TEST_MODULE?.trim();
25
- return configured || DEFAULT_MOBILE_RUNTIME_MODULE;
22
+ return isMobileProjectType()
23
+ ? DEFAULT_MOBILE_RUNTIME_MODULE
24
+ : DEFAULT_WEB_RUNTIME_MODULE;
26
25
  }
27
26
  //# sourceMappingURL=project-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-type.js","sourceRoot":"","sources":["../src/project-type.ts"],"names":[],"mappings":";;AAYA,kDA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AgB,mBAAmB;IACjC,OAAO,YAAY,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,mBAAmB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,mBAAmB,EAAE;QAC1B,CAAC,CAAC,6BAA6B;QAC/B,CAAC,CAAC,0BAA0B,CAAC;AACjC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface MobileRumAutomationUrls {
2
+ setUrlPrefix: string;
3
+ clearUrl: string;
4
+ }
5
+ /**
6
+ * URL prefix and clear URL for Mobilewright TrueCoverage (`device.openUrl`).
7
+ * Optional overrides: `TESTCHIMP_RUM_AUTOMATION_SET_PREFIX`, `TESTCHIMP_RUM_AUTOMATION_CLEAR_URL`.
8
+ */
9
+ export declare function getMobileRumAutomationUrls(): MobileRumAutomationUrls;
10
+ export declare function buildAutomationSetOpenUrl(setUrlPrefix: string, ciJson: string): string | {
11
+ error: string;
12
+ };
13
+ /**
14
+ * Register `beforeEach` / `afterEach` on the given Playwright `TestType` to push CI JSON into the app via
15
+ * `device.openUrl` (mobilecli `device.url`). Used when `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`.
16
+ */
17
+ export declare function attachMobileRumAutomationHooks(testType: any): any;
18
+ //# sourceMappingURL=rum-automation-mobile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rum-automation-mobile.d.ts","sourceRoot":"","sources":["../src/rum-automation-mobile.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,uBAAuB,CAKpE;AAED,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAS1G;AAID;;;GAGG;AAEH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CA2CjE"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMobileRumAutomationUrls = getMobileRumAutomationUrls;
4
+ exports.buildAutomationSetOpenUrl = buildAutomationSetOpenUrl;
5
+ exports.attachMobileRumAutomationHooks = attachMobileRumAutomationHooks;
6
+ const ci_test_info_1 = require("./ci-test-info");
7
+ const DEFAULT_SET_PREFIX = 'testchimp-rum://truecoverage/v1/set?p=';
8
+ const DEFAULT_CLEAR_URL = 'testchimp-rum://truecoverage/v1/clear';
9
+ /** Max length for the full openUrl string (conservative for iOS). */
10
+ const MAX_OPEN_URL_CHARS = 8000;
11
+ /**
12
+ * URL prefix and clear URL for Mobilewright TrueCoverage (`device.openUrl`).
13
+ * Optional overrides: `TESTCHIMP_RUM_AUTOMATION_SET_PREFIX`, `TESTCHIMP_RUM_AUTOMATION_CLEAR_URL`.
14
+ */
15
+ function getMobileRumAutomationUrls() {
16
+ return {
17
+ setUrlPrefix: process.env.TESTCHIMP_RUM_AUTOMATION_SET_PREFIX?.trim() || DEFAULT_SET_PREFIX,
18
+ clearUrl: process.env.TESTCHIMP_RUM_AUTOMATION_CLEAR_URL?.trim() || DEFAULT_CLEAR_URL,
19
+ };
20
+ }
21
+ function buildAutomationSetOpenUrl(setUrlPrefix, ciJson) {
22
+ const payload = Buffer.from(ciJson, 'utf8').toString('base64url');
23
+ const url = `${setUrlPrefix}${payload}`;
24
+ if (url.length > MAX_OPEN_URL_CHARS) {
25
+ return {
26
+ error: `[TestChimp] TrueCoverage automation URL exceeds ${MAX_OPEN_URL_CHARS} chars (${url.length}); shorten CI metadata paths or raise the limit in the plugin.`,
27
+ };
28
+ }
29
+ return url;
30
+ }
31
+ let warnedMobileAutomationOnce = false;
32
+ /**
33
+ * Register `beforeEach` / `afterEach` on the given Playwright `TestType` to push CI JSON into the app via
34
+ * `device.openUrl` (mobilecli `device.url`). Used when `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`.
35
+ */
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ function attachMobileRumAutomationHooks(testType) {
38
+ const { setUrlPrefix, clearUrl } = getMobileRumAutomationUrls();
39
+ testType.beforeEach(async ({ device }, testInfo) => {
40
+ const project = testInfo.project;
41
+ const projectRootDir = project?.rootDir ?? process.cwd();
42
+ const ciJson = (0, ci_test_info_1.buildCiTestInfoJson)(testInfo, projectRootDir);
43
+ const built = buildAutomationSetOpenUrl(setUrlPrefix, ciJson);
44
+ if (typeof built === 'object' && 'error' in built) {
45
+ if (!warnedMobileAutomationOnce) {
46
+ warnedMobileAutomationOnce = true;
47
+ // eslint-disable-next-line no-console
48
+ console.warn(built.error);
49
+ }
50
+ return;
51
+ }
52
+ try {
53
+ await device.openUrl(built);
54
+ }
55
+ catch (err) {
56
+ const msg = err instanceof Error ? err.message : String(err);
57
+ // eslint-disable-next-line no-console
58
+ console.warn(`[TestChimp] TrueCoverage device.openUrl(set) failed (non-fatal): ${msg}`);
59
+ }
60
+ });
61
+ testType.afterEach(async ({ device }) => {
62
+ try {
63
+ await device.openUrl(clearUrl);
64
+ }
65
+ catch (err) {
66
+ const msg = err instanceof Error ? err.message : String(err);
67
+ // eslint-disable-next-line no-console
68
+ console.warn(`[TestChimp] TrueCoverage device.openUrl(clear) failed (non-fatal): ${msg}`);
69
+ }
70
+ });
71
+ return testType;
72
+ }
73
+ //# sourceMappingURL=rum-automation-mobile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rum-automation-mobile.js","sourceRoot":"","sources":["../src/rum-automation-mobile.ts"],"names":[],"mappings":";;AAiBA,gEAKC;AAED,8DASC;AASD,wEA2CC;AArFD,iDAAyE;AAEzE,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AACpE,MAAM,iBAAiB,G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AE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YAClD,IAAI,CAAC,0BAA0B,EAAE,CAAC;gBAChC,0BAA0B,GAAG,IAAI,CAAC;gBAClC,sCAAsC;gBACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,oEAAoE,GAAG,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC,CACF,CAAC;IAEF,QAAQ,CAAC,SAAS,CAChB,KAAK,EAAE,EAAE,MAAM,EAA2D,EAAE,EAAE;QAC5E,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,sEAAsE,GAAG,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/dist/runtime.d.ts CHANGED
@@ -6,7 +6,9 @@
6
6
  * Screen/state markers: `test('…', async ({ markScreenState }) => { await markScreenState('Screen', 'state'); })`.
7
7
  * The same `markScreenState` fixture records a runner `test.step` when ExploreChimp is off, and runs ExploreChimp analytics when it is on.
8
8
  * Side-effect `import '@testchimp/playwright/runtime'` registers on the active test runtime:
9
- * default `@playwright/test`, or `mobilewright` when `TESTCHIMP_PROJECT_TYPE=ios|android`.
9
+ * default `@playwright/test`, or `@mobilewright/test` when `TESTCHIMP_PROJECT_TYPE=ios|android`.
10
+ *
11
+ * Mobile TrueCoverage: when `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`, hooks call `device.openUrl` to push CI JSON; integrate TestChimpRum (iOS/Android) URL handling in the app.
10
12
  */
11
13
  import { isExploreChimpEnabled } from './explorechimp';
12
14
  /** Bound screen/state marker from the `markScreenState` Playwright fixture. */
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,EAGL,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAUxB,+EAA+E;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AA4C/F;;;GAGG;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CA8DlD;AAED,8GAA8G;AAC9G,eAAO,MAAM,gBAAgB,4BAAsB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAGL,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAUxB,+EAA+E;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AA4C/F;;;GAGG;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAsClD;AAED,8GAA8G;AAC9G,eAAO,MAAM,gBAAgB,4BAAsB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
package/dist/runtime.js CHANGED
@@ -7,7 +7,9 @@
7
7
  * Screen/state markers: `test('…', async ({ markScreenState }) => { await markScreenState('Screen', 'state'); })`.
8
8
  * The same `markScreenState` fixture records a runner `test.step` when ExploreChimp is off, and runs ExploreChimp analytics when it is on.
9
9
  * Side-effect `import '@testchimp/playwright/runtime'` registers on the active test runtime:
10
- * default `@playwright/test`, or `mobilewright` when `TESTCHIMP_PROJECT_TYPE=ios|android`.
10
+ * default `@playwright/test`, or `@mobilewright/test` when `TESTCHIMP_PROJECT_TYPE=ios|android`.
11
+ *
12
+ * Mobile TrueCoverage: when `TESTCHIMP_PROJECT_TYPE` is `ios`/`android`, hooks call `device.openUrl` to push CI JSON; integrate TestChimpRum (iOS/Android) URL handling in the app.
11
13
  */
12
14
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
15
  if (k2 === undefined) k2 = k;
@@ -47,16 +49,16 @@ exports.isExploreChimpEnabled = exports.installTestChimp = void 0;
47
49
  exports.installTrueCoverage = installTrueCoverage;
48
50
  const path = __importStar(require("path"));
49
51
  const module_1 = require("module");
50
- const utils_1 = require("./utils");
52
+ const ci_test_info_1 = require("./ci-test-info");
51
53
  const explorechimp_1 = require("./explorechimp");
52
54
  Object.defineProperty(exports, "isExploreChimpEnabled", { enumerable: true, get: function () { return explorechimp_1.isExploreChimpEnabled; } });
53
55
  const project_type_1 = require("./project-type");
56
+ const rum_automation_mobile_1 = require("./rum-automation-mobile");
54
57
  /** Resolve test runtime module from the consumer project (web: Playwright, mobile: Mobilewright). */
55
58
  const pwRequire = (0, module_1.createRequire)(path.join(process.cwd(), 'package.json'));
56
59
  const fixtureKey = (0, project_type_1.getFixtureKey)();
57
60
  const mobileProject = (0, project_type_1.isMobileProjectType)();
58
61
  const runtimeModuleName = (0, project_type_1.getTestRuntimeModuleName)();
59
- let warnedTrueCoverageMobileSkip = false;
60
62
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
63
  function addMarkScreenStateFixture(test) {
62
64
  // Playwright 1.59+ requires the fixture worker's first parameter to use object destructuring
@@ -108,30 +110,11 @@ function installTrueCoverage(test) {
108
110
  const withCi = mobileProject
109
111
  ? test
110
112
  : test.extend({
113
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
114
  page: async ({ page }, use, testInfo) => {
112
115
  const project = testInfo.project;
113
116
  const projectRootDir = project.rootDir ?? process.cwd();
114
- const testsFolder = (0, utils_1.deriveTestsFolder)(projectRootDir);
115
- const paths = (0, utils_1.derivePathsFromTestInfo)(testInfo, testsFolder, projectRootDir, false);
116
- const ciTestInfo = {
117
- folderPath: paths.folderPath,
118
- fileName: paths.fileName,
119
- suitePath: paths.suitePath,
120
- testName: paths.testName,
121
- };
122
- const branchName = (0, utils_1.getBranchName)();
123
- if (branchName)
124
- ciTestInfo.branchName = branchName;
125
- const env = process.env.TESTCHIMP_ENV || process.env.TESTCHIMP_ENVIRONMENT;
126
- if (env)
127
- ciTestInfo.environment = String(env).trim();
128
- const release = process.env.TESTCHIMP_RELEASE || process.env.TESTCHIMP_RELEASE_NAME;
129
- if (release)
130
- ciTestInfo.release = release;
131
- const batchInvocationId = (0, utils_1.readTestChimpBatchInvocationId)(projectRootDir);
132
- if (batchInvocationId)
133
- ciTestInfo.batchInvocationId = batchInvocationId;
134
- const jsonString = JSON.stringify(ciTestInfo);
117
+ const jsonString = (0, ci_test_info_1.buildCiTestInfoJson)(testInfo, projectRootDir);
135
118
  await page.addInitScript((info) => {
136
119
  globalThis.__TC_CI_TEST_INFO = info;
137
120
  }, jsonString);
@@ -146,17 +129,15 @@ function installTrueCoverage(test) {
146
129
  await use(page);
147
130
  },
148
131
  });
149
- if (mobileProject && !warnedTrueCoverageMobileSkip) {
150
- // TrueCoverage CI metadata injection currently relies on Playwright page semantics.
151
- // eslint-disable-next-line no-console
152
- console.warn('[TestChimp] TrueCoverage instrumentation is web-only for now; skipping on mobile.');
153
- warnedTrueCoverageMobileSkip = true;
154
- }
155
132
  const withMark = addMarkScreenStateFixture(withCi);
156
- if (!(0, explorechimp_1.isExploreChimpEnabled)()) {
157
- return withMark;
133
+ let chain = withMark;
134
+ if ((0, explorechimp_1.isExploreChimpEnabled)()) {
135
+ chain = (0, explorechimp_1.applyExploreChimpFixture)(withMark);
136
+ }
137
+ if (mobileProject) {
138
+ chain = (0, rum_automation_mobile_1.attachMobileRumAutomationHooks)(chain);
158
139
  }
159
- return (0, explorechimp_1.applyExploreChimpFixture)(withMark);
140
+ return chain;
160
141
  }
161
142
  /** Same behavior as {@link installTrueCoverage} — umbrella name for TrueCoverage + ExploreChimp (via env). */
162
143
  exports.installTestChimp = installTrueCoverage;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EH,kDA8DC;AAtID,2CAA6B;AAC7B,mCAAuC;AACvC,mCAKiB;AACjB,iDAIwB;AA+Hf,sGAhIP,oCAAqB,OAgIO;AA9H9B,iDAA8F;AAE9F,qGAAqG;AACrG,MAAM,SAAS,GAAG,IAAA,sBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;AAC1E,MAAM,UAAU,GAAG,IAAA,4BAAa,GAAE,CAAC;AACnC,MAAM,aAAa,GAAG,IAAA,kCAAmB,GAAE,CAAC;AAC5C,MAAM,iBAAiB,GAAG,IAAA,uCAAwB,GAAE,CAAC;AACrD,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAKzC,8DAA8D;AAC9D,SAAS,yBAAyB,CAAC,IAAS;IAC1C,6FAA6F;IAC7F,gEAAgE;IAChE,MAAM,WAA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C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testchimp/playwright",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Playwright/Mobilewright reporter and runtime for TestChimp tracking and coverage reporting",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",