@interopio/iocd-cli 0.0.92 → 1.0.1
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 +23 -0
- package/dist/commands/test.command.js +47 -0
- package/dist/commands/test.command.js.map +1 -1
- package/dist/services/template.service.js +15 -4
- package/dist/services/template.service.js.map +1 -1
- package/dist/services/test-infrastructure.service.js +113 -0
- package/dist/services/test-infrastructure.service.js.map +1 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/SKILL.md +71 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/authoring.md +243 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/commands.md +24 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/configuration.md +30 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/models.md +52 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/setup.md +62 -0
- package/dist/templates/tests/.agents/skills/iocd-wdio-testing/references/troubleshooting.md +66 -0
- package/dist/templates/tests/tests/README.md +79 -0
- package/dist/templates/tests/tests/config/system.json +36 -0
- package/dist/templates/tests/tests/package-lock.json +3425 -2274
- package/dist/templates/tests/tests/package.json +19 -11
- package/dist/templates/tests/tests/tests/assets/applications/channel-client/index.html +31 -0
- package/dist/templates/tests/tests/tests/assets/applications/interop-responder/index.html +25 -0
- package/dist/templates/tests/tests/tests/assets/applications/people-list/index.html +59 -0
- package/dist/templates/tests/tests/tests/assets/applications/person-details/index.html +26 -0
- package/dist/templates/tests/tests/tests/assets/applications/shared-context-client/index.html +37 -0
- package/dist/templates/tests/tests/tests/assets/applications/web/index.html +31 -0
- package/dist/templates/tests/tests/tests/assets/applications/workspace-widget/index.html +14 -0
- package/dist/templates/tests/tests/tests/channel-selector.spec.ts +80 -0
- package/dist/templates/tests/tests/tests/common/iocd.ts +125 -0
- package/dist/templates/tests/tests/tests/config/apps.json +96 -0
- package/dist/templates/tests/tests/tests/interop.spec.ts +37 -0
- package/dist/templates/tests/tests/tests/notifications.spec.ts +37 -0
- package/dist/templates/tests/tests/tests/shared-contexts.spec.ts +71 -0
- package/dist/templates/tests/tests/tests/single-app.spec.ts +39 -0
- package/dist/templates/tests/tests/tests/workspace-add-app.spec.ts +85 -0
- package/dist/templates/tests/tests/tests/workspace-interop.spec.ts +99 -0
- package/dist/templates/tests/tests/tsconfig.json +7 -5
- package/dist/templates/tests/tests/wdio.config.ts +29 -25
- package/package.json +3 -2
- package/dist/templates/tests/tests/tests/sample.spec.ts +0 -73
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Read `tests/wdio.config.ts` — it composes `IOCDBaseConfiguration` + `IOCDService()`, defines one
|
|
4
|
+
`platform-wdio` capability, and sets these values:
|
|
5
|
+
|
|
6
|
+
| Value | Meaning |
|
|
7
|
+
|-------|---------|
|
|
8
|
+
| `BINARY_PATH` | Executable from the `iocd` component; supplied by `iocd test`. Keep it. |
|
|
9
|
+
| `WDIO_ROOT_DIR` / `WDIO_TESTS_ROOT` | Absolute paths to the test package and to `tests/tests/`. |
|
|
10
|
+
| `iocd:options.configOverrides` | Extra platform config (absolute paths) applied only to tests. |
|
|
11
|
+
| `iocd:options.ioInitOptions` | APIs + optional `libraries` used to build the test API. |
|
|
12
|
+
|
|
13
|
+
`config/system.json` registers `tests/tests/config/apps.json` as a path app store and isolates
|
|
14
|
+
`folders.userData` to `tests/user-data` (disposable — never commit it or reuse its state).
|
|
15
|
+
|
|
16
|
+
## Add an optional IO library
|
|
17
|
+
|
|
18
|
+
1. Add the package to `tests/package.json`.
|
|
19
|
+
2. Add its module specifier to `iocd:options.ioInitOptions.libraries` in `tests/wdio.config.ts`.
|
|
20
|
+
3. Use it via `browser.io()` (optional sub-APIs need `!`).
|
|
21
|
+
|
|
22
|
+
## Runners
|
|
23
|
+
|
|
24
|
+
`platform-wdio` is the default (specs run Node-side and drive the app remotely). `platform-window`,
|
|
25
|
+
`platform-node`, and `standalone` are specialized — use only when asked, and read the service README.
|
|
26
|
+
|
|
27
|
+
## CI
|
|
28
|
+
|
|
29
|
+
Add an explicit `npm test` step on a Windows/macOS runner with the seed dependencies and the `iocd`
|
|
30
|
+
component installed and the license from CI secrets. Never publish the license or `user-data`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Built-in IOCD UI Models
|
|
2
|
+
|
|
3
|
+
`@interopio/wdio-iocd-service/models` exports page objects for built-in web UI owned by IOCD. Use
|
|
4
|
+
them for Web Groups, captions, tabs, Channel Selectors, and similar platform surfaces. Use normal
|
|
5
|
+
WebdriverIO selectors for UI owned by the client app.
|
|
6
|
+
|
|
7
|
+
Models hide generated element IDs and DOM structure behind semantic operations such as
|
|
8
|
+
`group.switchTo()`, `group.frames.waitForCount()`, `tab.close()`, and `waitForDisplayed()`. They also
|
|
9
|
+
handle the WebDriver context and waits expected by the built-in surface. Prefer an available model
|
|
10
|
+
over copying internal IOCD selectors into a spec.
|
|
11
|
+
|
|
12
|
+
## Current Generated Version
|
|
13
|
+
|
|
14
|
+
The generated test package currently pins `@interopio/wdio-iocd-service@1.0.0-next.2`. Its
|
|
15
|
+
`@interopio/wdio-iocd-service/models` subpath exports:
|
|
16
|
+
|
|
17
|
+
| Area | Models and types |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Group and frames | `Group`, `Frame`, `WebGroupElement` |
|
|
20
|
+
| Captions and tabs | `CaptionBar`, `Caption`, `Editor`, `MoveArea`, `TabBar`, `TabHeader`, `Tab`, `Tabs`, `PinnedTabs` |
|
|
21
|
+
| Caption controls | `ChannelSelector`, `CloseButton`, `HtmlButtons`, `ButtonsContainer`, `StandardButton`, `StandardButtons`, `CustomButton`, `CustomButtons` |
|
|
22
|
+
| Sizing and snapping | `SizingBorderGroup`, `SizingBorderOrientation`, `SizingBorder`, `SizingBorderType`, `ApproachingMarker`, and the `NeighborFrames` type |
|
|
23
|
+
|
|
24
|
+
For example:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { Group } from "@interopio/wdio-iocd-service/models";
|
|
28
|
+
|
|
29
|
+
const group = new Group(window.groupId!);
|
|
30
|
+
const [frame] = await group.frames.waitForCount(1);
|
|
31
|
+
|
|
32
|
+
await group.switchTo();
|
|
33
|
+
await frame.captionBar.channelSelector.waitForDisplayed();
|
|
34
|
+
await frame.captionBar.channelSelector.click();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Version Rule
|
|
38
|
+
|
|
39
|
+
The installed package is the source of truth. Before using a model, read:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
tests/node_modules/@interopio/wdio-iocd-service/dist/models/index.d.ts
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Do not copy a model import from another repository or a newer service release without checking that
|
|
46
|
+
it exists locally. Newer versions may add models such as `ChannelSelectorPopup`, `PlatformDialog`,
|
|
47
|
+
`ModalsDialog`, or `Alert`; those names aren't exported by the version currently generated in the
|
|
48
|
+
seed.
|
|
49
|
+
|
|
50
|
+
Models reduce direct coupling to built-in markup, but remain coupled to the matching Desktop and
|
|
51
|
+
service versions. If no suitable model is exported, prefer a stable `data-testid`, role, or other
|
|
52
|
+
semantic selector and keep the version-sensitive selector in one local page object.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
Run all setup commands from the seed root.
|
|
4
|
+
|
|
5
|
+
## New seed project
|
|
6
|
+
|
|
7
|
+
Tests are included automatically. Complete the seed setup, then run the suite:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
npm run setup
|
|
12
|
+
npm test
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
On the first run the CLI installs the nested test package's dependencies, resolves the executable
|
|
16
|
+
from the configured `iocd` component, and passes its path to WebdriverIO via `BINARY_PATH`. If the
|
|
17
|
+
executable isn't available yet, start the seed once with `npm run dev`, close it, then run `npm test`
|
|
18
|
+
(the service launches and manages its own platform instance). The CLI also makes
|
|
19
|
+
`config/iocd.license.key` available to the test platform — keep the license out of specs, config,
|
|
20
|
+
logs, and source control.
|
|
21
|
+
|
|
22
|
+
## Missing test infrastructure
|
|
23
|
+
|
|
24
|
+
If the test package is absent, scaffold it:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx iocd test setup
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This runs the seed's own `@interopio/iocd-cli` dependency, so the scaffold matches the installed CLI
|
|
31
|
+
version. Fall back to `npx @interopio/iocd-cli@latest test setup` only when the seed doesn't depend
|
|
32
|
+
on the CLI. Setup creates the test package and the agent skill, installs the test dependencies, and validates the
|
|
33
|
+
setup with the TypeScript compiler. On failure it removes the files it created.
|
|
34
|
+
|
|
35
|
+
## Replacing an existing test package
|
|
36
|
+
|
|
37
|
+
The CLI never overwrites or migrates an existing test directory. To replace one:
|
|
38
|
+
|
|
39
|
+
1. Inspect it for specs, assets, app definitions, config, scripts, or dependencies to keep.
|
|
40
|
+
2. Get explicit user approval, then back up or remove the directory.
|
|
41
|
+
3. Run `test setup` from the seed root.
|
|
42
|
+
4. Transfer the required user-authored files and adapt them to the current configuration.
|
|
43
|
+
5. Type-check the package and run the transferred specs one at a time.
|
|
44
|
+
|
|
45
|
+
## Layout
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
tests/ # test package (Node.js)
|
|
49
|
+
├── package.json
|
|
50
|
+
├── tsconfig.json
|
|
51
|
+
├── wdio.config.ts # WebdriverIO + IOCDService config (platform-wdio runner)
|
|
52
|
+
├── config/system.json # platform overrides used only by tests
|
|
53
|
+
└── tests/
|
|
54
|
+
├── assets/applications/ # static fixture app HTML
|
|
55
|
+
├── common/iocd.ts # waitFor helper
|
|
56
|
+
├── config/apps.json # fixture app definitions (registered as a path app store)
|
|
57
|
+
└── *.spec.ts # specifications
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Specs are resolved from the test package, so `npm test -- --spec ./tests/x.spec.ts` runs
|
|
61
|
+
`tests/tests/x.spec.ts`. `system.json` also points `folders.userData` at a disposable
|
|
62
|
+
`tests/user-data`, so test runs never touch the developer's normal platform profile.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Missing platform executable
|
|
4
|
+
|
|
5
|
+
Ensure the configured `iocd` component is installed: run `npm run setup`, or start the seed once with
|
|
6
|
+
`npm run dev` and close it before `npm test` (the service starts its own instance).
|
|
7
|
+
|
|
8
|
+
If `iocd test` searches for an executable named after the seed's `productName`, but the installed
|
|
9
|
+
component still has its default `io.Connect Desktop` name, run `npm run dev` once. Development
|
|
10
|
+
preparation applies the seed branding and creates the executable path that the test command expects;
|
|
11
|
+
close that development instance before rerunning the tests.
|
|
12
|
+
|
|
13
|
+
## License prompt or failure
|
|
14
|
+
|
|
15
|
+
Run from the seed root through `npm test` so the CLI can use `config/iocd.license.key`. In CI, supply
|
|
16
|
+
the license via secrets. Never hard-code a license in a spec or fixture.
|
|
17
|
+
|
|
18
|
+
## Startup timeout
|
|
19
|
+
|
|
20
|
+
Temporarily set `iocd:options.enableLogging: true` in `tests/wdio.config.ts` and read the platform
|
|
21
|
+
output. Check for invalid config/app paths, license failures, gateway port conflicts (the generated
|
|
22
|
+
`config/system.json` pins the test gateway to port 8385), and stale test user-data before raising
|
|
23
|
+
`startupTimeoutMs`.
|
|
24
|
+
|
|
25
|
+
## Missing IO API
|
|
26
|
+
|
|
27
|
+
If `browser.io()` reports the API is unavailable, ensure it's called inside a runtime hook or test,
|
|
28
|
+
not at module or `describe` scope. If an optional API such as `io.workspaces` is missing, verify its
|
|
29
|
+
package is in `tests/package.json` and its module specifier is in `ioInitOptions.libraries`.
|
|
30
|
+
|
|
31
|
+
## `no such window` after closing UI
|
|
32
|
+
|
|
33
|
+
Closing the popup, dialog, preview, or utility window that currently owns the WebDriver context can
|
|
34
|
+
leave the session attached to a dead handle. Later commands — including commands in the next test —
|
|
35
|
+
then fail with `no such window` even though other windows are still open.
|
|
36
|
+
|
|
37
|
+
After closing the active temporary window, switch to a known live IOCD window with
|
|
38
|
+
`browser.switchById()` when its ID is available. Otherwise, park the session on any surviving raw
|
|
39
|
+
WebDriver handle:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { browser } from "@wdio/globals";
|
|
43
|
+
|
|
44
|
+
async function parkOnAnyWindow(): Promise<void> {
|
|
45
|
+
for (const handle of await browser.getWindowHandles()) {
|
|
46
|
+
try {
|
|
47
|
+
await browser.switchToWindow(handle);
|
|
48
|
+
return;
|
|
49
|
+
} catch {
|
|
50
|
+
// The handle may have disappeared while the list was being inspected.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
throw new Error("No open WebDriver windows remain.");
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Call the recovery in `finally` or cleanup immediately after dismissing the temporary window. Keep it
|
|
59
|
+
local to tests that own such windows; don't add it to every generated spec preemptively.
|
|
60
|
+
|
|
61
|
+
## Flaky UI test
|
|
62
|
+
|
|
63
|
+
Run only the failing spec, replace fixed delays with observable waits, subscribe before actions, and
|
|
64
|
+
await cleanup. Use a descriptive `timeoutMsg`. Enable video with
|
|
65
|
+
`IOCDService({ videoRecording: { ... } })` — videos are kept for failed specs and help diagnose
|
|
66
|
+
failures that don't reproduce locally.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# io.Connect Desktop seed tests
|
|
2
|
+
|
|
3
|
+
End-to-end tests for the seed's **io.Connect Desktop** platform and the apps that run in it, built
|
|
4
|
+
on [WebdriverIO 9](https://webdriver.io/) and `@interopio/wdio-iocd-service`. Specifications run in
|
|
5
|
+
the WebdriverIO worker through the `platform-wdio` runner: the service starts a dedicated platform
|
|
6
|
+
instance and lets a test start apps, call io.Connect APIs, switch the browser context into an app
|
|
7
|
+
window, and drive its UI.
|
|
8
|
+
|
|
9
|
+
## Running
|
|
10
|
+
|
|
11
|
+
Run from the **seed root** (not this folder) so the CLI can resolve the platform executable and the
|
|
12
|
+
license:
|
|
13
|
+
|
|
14
|
+
```cmd
|
|
15
|
+
# All specifications.
|
|
16
|
+
npm test
|
|
17
|
+
|
|
18
|
+
# One specification.
|
|
19
|
+
npm test -- --spec ./tests/single-app.spec.ts
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Type-check the specifications without starting the platform:
|
|
23
|
+
|
|
24
|
+
```cmd
|
|
25
|
+
cd tests
|
|
26
|
+
npm run typecheck
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Layout
|
|
30
|
+
|
|
31
|
+
- `wdio.config.ts` — WebdriverIO + `IOCDService` configuration (the `platform-wdio` runner).
|
|
32
|
+
- `config/system.json` — platform overrides applied only to the test process.
|
|
33
|
+
- `tests/common/iocd.ts` — polling, event-waiting, and cleanup-registry helpers.
|
|
34
|
+
- `tests/config/apps.json` — fixture app definitions.
|
|
35
|
+
- `tests/assets/applications/` — static fixture app HTML.
|
|
36
|
+
- `tests/*.spec.ts` — the specifications below.
|
|
37
|
+
|
|
38
|
+
## Sample specifications
|
|
39
|
+
|
|
40
|
+
| Specification | What it demonstrates |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `single-app.spec.ts` | Start one app, switch to its window, click a button, and assert its DOM. |
|
|
43
|
+
| `channel-selector.spec.ts` | Select a Channel from the app's Web Group caption and verify that the client app observes its new membership. |
|
|
44
|
+
| `shared-contexts.spec.ts` | Subscribe before a UI action, publish a Shared Context update from one app instance, verify the API event and receiving app DOM, and clean the subscription. |
|
|
45
|
+
| `workspace-interop.spec.ts` | Restore a Workspace with two apps; select a person in one app and verify the other receives the Interop call. |
|
|
46
|
+
| `interop.spec.ts` | Call an Interop method from the test itself: start an app that registers `IOCD.Sample.Add`, then `invoke` it and assert the result. |
|
|
47
|
+
| `notifications.spec.ts` | Raise a notification, open the Notification Panel (`browser.switchToNotificationPanel()`), and assert it with `waitForChildrenCount()`. |
|
|
48
|
+
| `workspace-add-app.spec.ts` | Add an app to a Workspace by clicking the frame's add button and the add-application popup with WebdriverIO, instead of the `addWindow()` API. |
|
|
49
|
+
|
|
50
|
+
## Fixture apps
|
|
51
|
+
|
|
52
|
+
`tests/config/apps.json` registers the fixture apps and points at `tests/assets/applications/`:
|
|
53
|
+
|
|
54
|
+
- `web` — counter button (`single-app.spec.ts`).
|
|
55
|
+
- `channel-client` — enables the caption Channel Selector and renders its current Channel
|
|
56
|
+
(`channel-selector.spec.ts`).
|
|
57
|
+
- `shared-context-client` — publishes and subscribes to a named Shared Context
|
|
58
|
+
(`shared-contexts.spec.ts`).
|
|
59
|
+
- `people-list` / `person-details` — Interop peers (`workspace-interop.spec.ts`).
|
|
60
|
+
- `interop-responder` — registers the `IOCD.Sample.Add` Interop method (`interop.spec.ts`).
|
|
61
|
+
- `workspace-widget` — marked `customProperties.includeInWorkspaces`, so it appears in the
|
|
62
|
+
add-application popup (`workspace-add-app.spec.ts`).
|
|
63
|
+
|
|
64
|
+
## Built-in IOCD UI models
|
|
65
|
+
|
|
66
|
+
Import page objects from `@interopio/wdio-iocd-service/models` when a test drives UI owned by IOCD,
|
|
67
|
+
such as Web Groups, caption bars, tabs, and Channel Selectors. The generated service version exports
|
|
68
|
+
the `Group`, `Frame`, caption/tab, button, Channel Selector, sizing-border, and approaching-marker
|
|
69
|
+
models. `channel-selector.spec.ts` demonstrates the `Group` hierarchy.
|
|
70
|
+
|
|
71
|
+
Available exports vary by service version. Check
|
|
72
|
+
`node_modules/@interopio/wdio-iocd-service/dist/models/index.d.ts` before using a model; don't copy
|
|
73
|
+
an import from a newer repository version without verifying that it exists in the generated test
|
|
74
|
+
package. Use ordinary WebdriverIO selectors for UI owned by your app.
|
|
75
|
+
|
|
76
|
+
## More
|
|
77
|
+
|
|
78
|
+
- Full guide: the **Testing** section of the io.Connect Desktop seed-project documentation.
|
|
79
|
+
- Coding-agent guidance: `.agents/skills/iocd-wdio-testing/` at the seed root.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"advancedMode": false,
|
|
3
|
+
"channels": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"definitions": [
|
|
6
|
+
{ "name": "Red", "meta": { "color": "red" } },
|
|
7
|
+
{ "name": "Green", "meta": { "color": "green" } }
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"appStores": [
|
|
11
|
+
{
|
|
12
|
+
"type": "path",
|
|
13
|
+
"details": {
|
|
14
|
+
"path": "%WDIO_TESTS_ROOT%/config/apps.json"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"gw": {
|
|
19
|
+
"configuration": {
|
|
20
|
+
"port": 8385,
|
|
21
|
+
"ip": "127.0.0.1",
|
|
22
|
+
"authentication": {
|
|
23
|
+
"available": ["basic"],
|
|
24
|
+
"default": "basic"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"windowManagement": {
|
|
29
|
+
"group": {
|
|
30
|
+
"type": "Web"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"folders": {
|
|
34
|
+
"userData": "%WDIO_ROOT_DIR%/user-data"
|
|
35
|
+
}
|
|
36
|
+
}
|