@trackunit/iris-app-e2e 1.11.25-alpha-27ad777c16e.0 → 1.11.27
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/CHANGELOG.md +22 -0
- package/MIGRATION.md +207 -0
- package/README.md +16 -0
- package/package.json +4 -4
- package/src/index.d.ts +7 -0
- package/src/index.js +7 -0
- package/src/support.d.ts +5 -0
- package/src/support.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 1.11.27 (2026-06-10)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **e2e:** update deprecation message for iris-app-e2e ([e5cd2ad7539](https://github.com/Trackunit/manager/commit/e5cd2ad7539))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Mikkel Thorbjørn Andersen
|
|
10
|
+
|
|
11
|
+
## 1.11.26 (2026-06-10)
|
|
12
|
+
|
|
13
|
+
### 🧱 Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated react-vite-test-setup to 0.0.27
|
|
16
|
+
|
|
17
|
+
## 1.11.25 (2026-06-10)
|
|
18
|
+
|
|
19
|
+
### 🧱 Updated Dependencies
|
|
20
|
+
|
|
21
|
+
- Updated react-vite-test-setup to 0.0.26
|
|
22
|
+
|
|
1
23
|
## 1.11.24 (2026-06-10)
|
|
2
24
|
|
|
3
25
|
### 🧱 Updated Dependencies
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Migrating a Cypress E2E suite to Playwright
|
|
2
|
+
|
|
3
|
+
`@trackunit/iris-app-e2e` (Cypress) is **deprecated** in favour of
|
|
4
|
+
[`@trackunit/iris-app-playwright`](../iris-app-playwright/README.md) (Playwright).
|
|
5
|
+
This guide shows how to move an existing project's Cypress suite to Playwright
|
|
6
|
+
1:1. It is the recipe used to migrate the Trackunit-internal suites.
|
|
7
|
+
|
|
8
|
+
> The shared Cypress plumbing stays in place during a grace period, so a project
|
|
9
|
+
> can migrate at any time. Migrate the **project's own** Cypress files only; do
|
|
10
|
+
> not remove the shared libraries, generator, or root `cypress` / `@nx/cypress`
|
|
11
|
+
> dependencies.
|
|
12
|
+
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> **Import paths.** The examples below use the Trackunit-internal
|
|
15
|
+
> `@trackunit/nx-playwright-support` wrapper, which is only resolvable inside this
|
|
16
|
+
> monorepo. **External IrisX-app SDK consumers** should import the equivalent
|
|
17
|
+
> `test` / `expect` / fixtures from the public **`@trackunit/iris-app-playwright`**
|
|
18
|
+
> package instead (see its README); the fixture APIs (`login`, `irisApp`,
|
|
19
|
+
> `configCat`, `getValidateFeatureFlags`, `LoginOptions`, …) are the same.
|
|
20
|
+
|
|
21
|
+
## 1. Scaffold the Playwright config
|
|
22
|
+
|
|
23
|
+
From the workspace root, run the generator for your project:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
nx g @trackunit/iris-app-playwright:playwright-configuration <project-name>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This adds a `playwright.config.ts` wired to the shared preset. A minimal config
|
|
30
|
+
looks like:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createNxPreset, defaultPlaywrightConfig, setupPlugins } from "@trackunit/iris-app-playwright";
|
|
34
|
+
import { format, resolveConfig } from "prettier";
|
|
35
|
+
|
|
36
|
+
const nxPreset = createNxPreset(__filename);
|
|
37
|
+
const config = defaultPlaywrightConfig({ configDir: __dirname, projectConfig: { testDir: "./playwright/tests" } });
|
|
38
|
+
|
|
39
|
+
export default setupPlugins({ ...nxPreset, ...config }, { format, resolveConfig });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 2. Create the `playwright/` directory
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
playwright/
|
|
46
|
+
tsconfig.json # extends ../tsconfig.json, types: ["node"]
|
|
47
|
+
support/fixtures.ts # re-exports test/describe/expect + a flexible login
|
|
48
|
+
tests/<name>.spec.ts # the ported specs
|
|
49
|
+
fixtures/<name>.json # auth fixtures moved from cypress/fixtures/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`playwright/tsconfig.json`:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"extends": "../tsconfig.json",
|
|
57
|
+
"compilerOptions": { "types": ["node"], "sourceMap": false },
|
|
58
|
+
"include": ["**/*.ts", "**/*.js", "../playwright.config.ts", "./**/*.spec.ts", "./**/*.spec.tsx", "./**/*.d.ts"]
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`playwright/support/fixtures.ts` — a flexible `login` that mirrors `cy.login()`
|
|
63
|
+
(bare = `auth.json`) and `cy.login("name")` (named fixture):
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { describe, expect, type LoginOptions, test as baseTest } from "@trackunit/nx-playwright-support";
|
|
67
|
+
import * as path from "path";
|
|
68
|
+
|
|
69
|
+
const FIXTURES_DIR = path.resolve(__dirname, "..", "fixtures");
|
|
70
|
+
|
|
71
|
+
export type LoginFn = (fixture?: string | LoginOptions) => Promise<void>;
|
|
72
|
+
|
|
73
|
+
export const test = baseTest.extend<{ login: LoginFn }>({
|
|
74
|
+
login: async ({ login: baseLogin }, provide) => {
|
|
75
|
+
await provide(async (fixture?: string | LoginOptions) => {
|
|
76
|
+
if (typeof fixture === "string") {
|
|
77
|
+
await baseLogin({ fixturePath: path.join(FIXTURES_DIR, `${fixture}.json`) });
|
|
78
|
+
} else {
|
|
79
|
+
await baseLogin({ fixturePath: path.join(FIXTURES_DIR, "auth.json"), ...fixture });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export { describe, expect };
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Suites that interact with the Iris app iframe should also override `irisApp` in
|
|
89
|
+
this same `extend` block — see [Iframes](#iframes-cyenteririsapp) below.
|
|
90
|
+
|
|
91
|
+
## 3. Port the specs (`*.cy.ts` -> `*.spec.ts`)
|
|
92
|
+
|
|
93
|
+
Import `test` / `describe` / `expect` from your `support/fixtures`, and write
|
|
94
|
+
async tests. Common command mappings:
|
|
95
|
+
|
|
96
|
+
| Cypress | Playwright |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `cy.login()` / `cy.login("name")` | `await login()` / `await login("name")` |
|
|
99
|
+
| `cy.visit("/path")` | `await page.goto("/path")` |
|
|
100
|
+
| `cy.getByTestId("x")` | `page.getByTestId("x")` |
|
|
101
|
+
| `cy.get("[data-testid^=card]")` | `page.locator("[data-testid^=card]")` |
|
|
102
|
+
| `.should("exist")` | `await expect(locator).toBeAttached()` |
|
|
103
|
+
| `.should("be.visible")` | `await expect(locator).toBeVisible()` |
|
|
104
|
+
| `.should("not.exist")` | `await expect(locator).toHaveCount(0)` |
|
|
105
|
+
| `.should("have.length", n)` | `await expect(locator).toHaveCount(n)` |
|
|
106
|
+
| `.should("have.length.greaterThan", 0)` | `await expect(locator.first()).toBeAttached()` |
|
|
107
|
+
| `.should("contain"/"not.contain", t)` | `await expect(locator).toContainText(t)` / `.not.toContainText(t)` |
|
|
108
|
+
| `.should("be.disabled")` | `await expect(locator).toBeDisabled()` |
|
|
109
|
+
| `cy.get(input).clear().type(t)` | `await locator.fill(t)` (or `pressSequentially(t)` for autocompletes) |
|
|
110
|
+
| `cy.get(input).type("{enter}")` | `await locator.press("Enter")` |
|
|
111
|
+
| `cy.url().should("contain", "/x/")` | `await expect(page).toHaveURL(/\/x\//)` |
|
|
112
|
+
| `cy.wait(1000)` | `await page.waitForTimeout(1000)` (avoid where possible) |
|
|
113
|
+
|
|
114
|
+
### Network interception
|
|
115
|
+
|
|
116
|
+
`cy.intercept({ url: "**/Op" }).as("op")` + `cy.wait("@op")` becomes a
|
|
117
|
+
`page.waitForResponse(...)` **armed immediately before the action that triggers
|
|
118
|
+
the request**:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
const op = page.waitForResponse(response => response.url().includes("Op"));
|
|
122
|
+
await page.getByTestId("trigger").click();
|
|
123
|
+
await op;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
To modify a response (e.g. force a feature flag), use `page.route(...)`.
|
|
127
|
+
|
|
128
|
+
### Iframes (`cy.enterIrisApp()`)
|
|
129
|
+
|
|
130
|
+
`cy.enterIrisApp()` resolves `iframe[data-testid="app-iframe"]` and `.first()`.
|
|
131
|
+
The base `irisApp` fixture returns a bare `page.frameLocator(...)`, so on pages
|
|
132
|
+
that mount more than one `iframe[data-testid="app-iframe"]` Playwright strict mode
|
|
133
|
+
throws. For parity, **also** override `irisApp` to add `.first()` in the same
|
|
134
|
+
`support/fixtures.ts` `extend` block as `login`:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { type FrameLocator } from "@playwright/test";
|
|
138
|
+
// ...inside the same baseTest.extend<{ login: LoginFn; irisApp: () => FrameLocator }>({ ... })
|
|
139
|
+
irisApp: async ({ page }, provide) => {
|
|
140
|
+
await provide(() => page.frameLocator('iframe[data-testid="app-iframe"]').first());
|
|
141
|
+
},
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Then use the returned `FrameLocator`:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const app = irisApp();
|
|
148
|
+
await expect(app.getByTestId("page")).toBeAttached();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Feature flags (`cy.getValidateFeatureFlags()` / `cy.configCat()`)
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
test.beforeEach(async ({ getValidateFeatureFlags }) => {
|
|
155
|
+
getValidateFeatureFlags(); // arm BEFORE login navigates
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("...", async ({ page, login, configCat }) => {
|
|
159
|
+
await login();
|
|
160
|
+
const enabled = await configCat("my-flag");
|
|
161
|
+
// ...
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Note: `configCat` throws if the flag is missing in the `ValidateFeatureFlags`
|
|
166
|
+
response. The shared Cypress `configCat` behaves the same (`find(...).state`), so
|
|
167
|
+
await it directly; only wrap in `try/catch` if your Cypress original used
|
|
168
|
+
optional chaining (`find(...)?.state`) to treat a missing flag as `false`.
|
|
169
|
+
|
|
170
|
+
## 4. Wire up the project
|
|
171
|
+
|
|
172
|
+
- `project.json`: switch the `e2e` / `e2e-ui` targets to the Playwright runner:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
"e2e": {
|
|
176
|
+
"executor": "nx:run-commands",
|
|
177
|
+
"dependsOn": ["iris-app-playwright:ensure-playwright"],
|
|
178
|
+
"options": {
|
|
179
|
+
"command": "codeowner=<team> yarn playwright test --config=<path>/playwright.config.ts",
|
|
180
|
+
"forwardAllArgs": false
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- `eslint.config.cjs`: repoint `parserOptions.project` at `./playwright/tsconfig.json`
|
|
186
|
+
(the shared e2e preset hardcodes `./cypress/tsconfig.json`, which no longer
|
|
187
|
+
exists) and disable the `testing-library/*` rules for `playwright/**` (they
|
|
188
|
+
false-positive on Playwright's `getByTestId` API).
|
|
189
|
+
- `vitest.config.ts`: add `**/playwright/**` to `test.exclude`.
|
|
190
|
+
- `tsconfig.json`: replace the `./cypress/tsconfig.json` reference with
|
|
191
|
+
`./playwright/tsconfig.json`.
|
|
192
|
+
|
|
193
|
+
## 5. Validate, then remove the project's Cypress files
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
yarn playwright test --config=<path>/playwright.config.ts --list # spec parity
|
|
197
|
+
nx run <project>:tsc-validate
|
|
198
|
+
nx run <project>:lint
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Once green, delete the project's own `cypress.config.ts` and `cypress/`
|
|
202
|
+
directory. **Do not** touch the shared plumbing.
|
|
203
|
+
|
|
204
|
+
## 6. Ship it
|
|
205
|
+
|
|
206
|
+
Open a PR for the owning team to review. Keep the conversion strictly 1:1 — same
|
|
207
|
+
flows and assertions, preserve skips, add no new tests.
|
package/README.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @trackunit/iris-app-e2e
|
|
2
2
|
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> **Deprecated — Cypress E2E is being replaced by Playwright.**
|
|
5
|
+
>
|
|
6
|
+
> `@trackunit/iris-app-e2e` (Cypress) is **deprecated** in favour of
|
|
7
|
+
> [`@trackunit/iris-app-playwright`](../iris-app-playwright/README.md) (Playwright).
|
|
8
|
+
> All Trackunit-internal suites have been migrated. The package **remains fully
|
|
9
|
+
> functional during a grace period** so external IrisX-app developers can migrate
|
|
10
|
+
> on their own schedule — nothing has been removed.
|
|
11
|
+
>
|
|
12
|
+
> - **New projects:** use `@trackunit/iris-app-playwright` and the
|
|
13
|
+
> `@trackunit/iris-app-playwright:playwright-configuration` generator.
|
|
14
|
+
> - **Existing Cypress suites:** see the [migration guide](./MIGRATION.md).
|
|
15
|
+
> - **Removal:** the shared Cypress plumbing will only be removed in a separate,
|
|
16
|
+
> future issue after the grace period ends. Watch this README and the external
|
|
17
|
+
> developer channels for the grace-period end date.
|
|
18
|
+
|
|
3
19
|
A comprehensive E2E testing utilities library for Trackunit's Iris platform. This package provides reusable Cypress commands, setup utilities, and configuration helpers to streamline E2E testing for both internal and external developers.
|
|
4
20
|
|
|
5
21
|
This library is exposed publicly for use in the Trackunit [Iris App SDK](https://www.npmjs.com/package/@trackunit/iris-app).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-e2e",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.27",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"generators": "./generators.json",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@neuralegion/cypress-har-generator": "^5.17.0",
|
|
40
|
-
"@nx/cypress": "22.
|
|
41
|
-
"@nx/devkit": "22.
|
|
42
|
-
"@nx/vite": "22.
|
|
40
|
+
"@nx/cypress": "22.6.5",
|
|
41
|
+
"@nx/devkit": "22.6.5",
|
|
42
|
+
"@nx/vite": "22.6.5",
|
|
43
43
|
"cypress-terminal-report": "7.0.3",
|
|
44
44
|
"node-xlsx": "^0.23.0",
|
|
45
45
|
"prettier": "^3.4.2",
|
package/src/index.d.ts
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* For browser-only exports (commands, setup functions that use Cypress global),
|
|
6
6
|
* import from "@trackunit/iris-app-e2e-support" instead.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Use `@trackunit/iris-app-playwright` (Playwright) instead. This
|
|
9
|
+
* Cypress library is kept functional during a grace period for external IrisX-app
|
|
10
|
+
* developers but is no longer the recommended path. New projects should use the
|
|
11
|
+
* `@trackunit/iris-app-playwright:playwright-configuration` generator; existing
|
|
12
|
+
* suites should follow the migration guide at
|
|
13
|
+
* libs/iris-app-sdk/iris-app-e2e/MIGRATION.md.
|
|
7
14
|
*/
|
|
8
15
|
export * from "./plugins/createLogFile";
|
|
9
16
|
export * from "./plugins/defaultPlugins";
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,13 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
*
|
|
9
9
|
* For browser-only exports (commands, setup functions that use Cypress global),
|
|
10
10
|
* import from "@trackunit/iris-app-e2e-support" instead.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Use `@trackunit/iris-app-playwright` (Playwright) instead. This
|
|
13
|
+
* Cypress library is kept functional during a grace period for external IrisX-app
|
|
14
|
+
* developers but is no longer the recommended path. New projects should use the
|
|
15
|
+
* `@trackunit/iris-app-playwright:playwright-configuration` generator; existing
|
|
16
|
+
* suites should follow the migration guide at
|
|
17
|
+
* libs/iris-app-sdk/iris-app-e2e/MIGRATION.md.
|
|
11
18
|
*/
|
|
12
19
|
tslib_1.__exportStar(require("./plugins/createLogFile"), exports);
|
|
13
20
|
tslib_1.__exportStar(require("./plugins/defaultPlugins"), exports);
|
package/src/support.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Browser-only exports for Cypress support files.
|
|
3
3
|
* These modules depend on the Cypress global and must only be imported
|
|
4
4
|
* in Cypress support files, NOT in cypress.config.ts or other Node.js contexts.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `@trackunit/iris-app-playwright` (Playwright) instead. This
|
|
7
|
+
* Cypress library is kept functional during a grace period for external IrisX-app
|
|
8
|
+
* developers but is no longer the recommended path. See the migration guide at
|
|
9
|
+
* libs/iris-app-sdk/iris-app-e2e/MIGRATION.md.
|
|
5
10
|
*/
|
|
6
11
|
export * from "./commands/defaultCommands";
|
|
7
12
|
export * from "./setup/defaultE2ESetup";
|
package/src/support.js
CHANGED
|
@@ -7,6 +7,11 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
* Browser-only exports for Cypress support files.
|
|
8
8
|
* These modules depend on the Cypress global and must only be imported
|
|
9
9
|
* in Cypress support files, NOT in cypress.config.ts or other Node.js contexts.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Use `@trackunit/iris-app-playwright` (Playwright) instead. This
|
|
12
|
+
* Cypress library is kept functional during a grace period for external IrisX-app
|
|
13
|
+
* developers but is no longer the recommended path. See the migration guide at
|
|
14
|
+
* libs/iris-app-sdk/iris-app-e2e/MIGRATION.md.
|
|
10
15
|
*/
|
|
11
16
|
tslib_1.__exportStar(require("./commands/defaultCommands"), exports);
|
|
12
17
|
tslib_1.__exportStar(require("./setup/defaultE2ESetup"), exports);
|