@interopio/iocd-cli 0.0.91 → 1.0.0
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 +64 -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 +4 -3
- package/dist/templates/tests/tests/tests/sample.spec.ts +0 -73
package/changelog.md
CHANGED
|
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.0](https://github.com/InteropIO/iocd-cli/compare/iocd-cli-v0.0.92...iocd-cli-v1.0.0) (2026-08-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* seed projects now generate a WebdriverIO 9 test package and expose the `iocd test` and `iocd test setup` commands. Existing seeds with an older test setup must back up or remove their tests directory and run `iocd test setup` to regenerate it.
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add WebdriverIO test infrastructure and iocd test commands ([#87](https://github.com/InteropIO/iocd-cli/issues/87)) ([282eedb](https://github.com/InteropIO/iocd-cli/commit/282eedb74fb289ce310cb1e1911cfbae14cb40d4))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* prepare 1.0.0 release ([#92](https://github.com/InteropIO/iocd-cli/issues/92)) ([5f7df23](https://github.com/InteropIO/iocd-cli/commit/5f7df23b32e20eac7602aac9783c4790546c589f))
|
|
23
|
+
|
|
24
|
+
## [0.0.92](https://github.com/InteropIO/iocd-cli/compare/iocd-cli-v0.0.91...iocd-cli-v0.0.92) (2026-08-11)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* resolve dependency vulnerabilities ([#88](https://github.com/InteropIO/iocd-cli/issues/88)) ([e66d36a](https://github.com/InteropIO/iocd-cli/commit/e66d36a12066f2e2b9e7e6a3e2e62d14240b8444))
|
|
30
|
+
|
|
8
31
|
## [0.0.91](https://github.com/InteropIO/iocd-cli/compare/iocd-cli-v0.0.90...iocd-cli-v0.0.91) (2026-08-11)
|
|
9
32
|
|
|
10
33
|
|
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.testCommand = void 0;
|
|
4
37
|
const commander_1 = require("commander");
|
|
5
38
|
const test_service_1 = require("../services/test.service");
|
|
6
39
|
const error_handler_1 = require("../utils/error.handler");
|
|
40
|
+
const test_infrastructure_service_1 = require("../services/test-infrastructure.service");
|
|
41
|
+
const clack = __importStar(require("@clack/prompts"));
|
|
7
42
|
exports.testCommand = new commander_1.Command("test")
|
|
8
43
|
.description("Run the test suite")
|
|
9
44
|
.allowExcessArguments()
|
|
@@ -17,4 +52,16 @@ exports.testCommand = new commander_1.Command("test")
|
|
|
17
52
|
error_handler_1.ErrorHandler.handle(error);
|
|
18
53
|
}
|
|
19
54
|
});
|
|
55
|
+
exports.testCommand
|
|
56
|
+
.command("setup")
|
|
57
|
+
.description("Create the current IOCD automated test infrastructure")
|
|
58
|
+
.action(async () => {
|
|
59
|
+
try {
|
|
60
|
+
await new test_infrastructure_service_1.TestInfrastructureService().setup();
|
|
61
|
+
clack.note("Test infrastructure created and validated.", "IOCD Tests");
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
error_handler_1.ErrorHandler.handle(error);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
20
67
|
//# sourceMappingURL=test.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.command.js","sourceRoot":"","sources":["../../src/commands/test.command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.command.js","sourceRoot":"","sources":["../../src/commands/test.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,2DAAuD;AACvD,0DAAsD;AACtD,yFAAoF;AACpF,sDAAwC;AAE3B,QAAA,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,oBAAoB,CAAC;KACjC,oBAAoB,EAAE;KACtB,kBAAkB,EAAE;KACpB,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;IAC3B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAC;QACtC,MAAM,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4BAAY,CAAC,MAAM,CAAC,KAAc,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,mBAAW;KACR,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,IAAI,uDAAyB,EAAE,CAAC,KAAK,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,4CAA4C,EAAE,YAAY,CAAC,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4BAAY,CAAC,MAAM,CAAC,KAAc,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -124,20 +124,31 @@ class TemplateService {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
const templatePath = (0, node_path_1.join)(this.templatesPath, templateName);
|
|
127
|
+
const autoIncludedApplications = this.getAvailableApplicationTemplates()
|
|
128
|
+
.filter(template => template.autoInclude === true)
|
|
129
|
+
.map(template => template.name);
|
|
130
|
+
const templateApplications = [
|
|
131
|
+
...new Set([
|
|
132
|
+
...autoIncludedApplications,
|
|
133
|
+
...(options.templateApplications ?? []),
|
|
134
|
+
]),
|
|
135
|
+
];
|
|
127
136
|
try {
|
|
128
137
|
// Create target directory
|
|
129
138
|
(0, node_fs_1.mkdirSync)(options.targetDirectory, { recursive: true });
|
|
130
139
|
this.logger.debug(`Created target directory: ${options.targetDirectory}`);
|
|
131
140
|
// Prepare template variables
|
|
132
|
-
const variables = this.prepareTemplateVariables(
|
|
141
|
+
const variables = this.prepareTemplateVariables({
|
|
142
|
+
...options,
|
|
143
|
+
templateApplications,
|
|
144
|
+
});
|
|
133
145
|
// Copy base template files with variable replacement
|
|
134
146
|
await this.copyTemplateFiles(templatePath, options.targetDirectory, variables);
|
|
135
147
|
// add components configuration to package.json
|
|
136
148
|
await this.updateComponentsConfig(options.targetDirectory, options.initialComponents, options.componentSource);
|
|
137
149
|
// Process template application files if selected
|
|
138
|
-
if (
|
|
139
|
-
options.
|
|
140
|
-
await this.processApplicationsTemplates(options.targetDirectory, variables, options.templateApplications);
|
|
150
|
+
if (templateApplications.length > 0) {
|
|
151
|
+
await this.processApplicationsTemplates(options.targetDirectory, variables, templateApplications);
|
|
141
152
|
}
|
|
142
153
|
this.logger.info(`Project generated successfully at: ${options.targetDirectory}`);
|
|
143
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../src/services/template.service.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoD;AACpD,qCAOiB;AACjB,4CAAyC;AACzC,0DAA6D;AAC7D,wDAA0B;AAC1B,4DAAwD;AACxD,wCAA0C;AAoC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,eAAe;IAClB,MAAM,GAAG,eAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAChD,aAAa,CAAS;IAE9B;QACE,IAAI,CAAC,aAAa,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IA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,0CA2bC"}
|
|
1
|
+
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../src/services/template.service.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoD;AACpD,qCAOiB;AACjB,4CAAyC;AACzC,0DAA6D;AAC7D,wDAA0B;AAC1B,4DAAwD;AACxD,wCAA0C;AAoC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,eAAe;IAClB,MAAM,GAAG,eAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAChD,aAAa,CAAS;IAE9B;QACE,IAAI,CAAC,aAAa,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,qBAAqB;QAC1B,IAAI,CAAC;YACH,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,qCAAqC,EACrC,IAAI,CAAC,aAAa,CACnB,CAAC;gBACF,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,IAAA,qBAAW,EAAC,IAAI,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBAC5D,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;iBACtC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YACtD,MAAM,IAAI,wBAAQ,CAAC,oCAAoC,EAAE;gBACvD,IAAI,EAAE,yBAAS,CAAC,iBAAiB;gBACjC,KAAK,EAAE,KAAc;gBACrB,WA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AC,KAAK,CACf,IAAA,sBAAY,EAAC,gBAAgB,EAAE,OAAO,CAAC,CACpB,CAAC;YACxB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,qCAAqC,YAAY,GAAG,EACpD,KAAK,CACN,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,GAAG,YAAY,WAAW;YACvC,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,MAAM,EAAE,mBAAmB;SAClC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,gCAAgC;QACrC,MAAM,YAAY,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAClD,MAAM,oBAAoB,GAAuB,EAAE,CAAC;QAEpD,KAAK,MAAM,YAAY,IAAI,YAAY,EAAE,CAAC;YACxC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YACxD,IAAI,YAAY,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBACxC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,OAAO,oBAAoB,CAAC;IAC9B,CAAC;CACF;AApcD,0CAocC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestInfrastructureService = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const path_2 = require("../utils/path");
|
|
8
|
+
class TestInfrastructureService {
|
|
9
|
+
rootDir;
|
|
10
|
+
testsDir;
|
|
11
|
+
templateDir;
|
|
12
|
+
runNpm;
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.rootDir = options.rootDir ?? path_2.PathUtils.getRootDir();
|
|
15
|
+
this.testsDir = options.testsDir ?? path_2.PathUtils.getTestsDir();
|
|
16
|
+
this.templateDir =
|
|
17
|
+
options.templateDir ?? (0, path_1.join)(__dirname, "../templates/tests");
|
|
18
|
+
this.runNpm = options.runNpm ?? this.runNpmCommand.bind(this);
|
|
19
|
+
}
|
|
20
|
+
async setup() {
|
|
21
|
+
this.assertTestsDirWithinRoot();
|
|
22
|
+
if ((0, fs_1.existsSync)(this.testsDir)) {
|
|
23
|
+
throw new Error(`The tests directory already exists at '${this.testsDir}'. Back up or remove it, then run 'iocd test setup' again.`);
|
|
24
|
+
}
|
|
25
|
+
const skillDir = this.getSkillDir();
|
|
26
|
+
const skillAlreadyExists = (0, fs_1.existsSync)(skillDir);
|
|
27
|
+
try {
|
|
28
|
+
(0, fs_1.mkdirSync)(this.testsDir, { recursive: true });
|
|
29
|
+
this.copyDirectory((0, path_1.join)(this.templateDir, "tests"), this.testsDir, true);
|
|
30
|
+
this.copySkill(false);
|
|
31
|
+
await this.validateInstallation();
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
(0, fs_1.rmSync)(this.testsDir, { recursive: true, force: true });
|
|
35
|
+
if (!skillAlreadyExists) {
|
|
36
|
+
(0, fs_1.rmSync)(skillDir, { recursive: true, force: true });
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Test infrastructure setup failed and the created files were removed: ${error.message}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Blocks a '..' or symlinked testsDirectory from writing to and recursively
|
|
42
|
+
// deleting a path outside the seed, comparing real (symlink-resolved) paths.
|
|
43
|
+
assertTestsDirWithinRoot() {
|
|
44
|
+
const realRoot = (0, fs_1.realpathSync)((0, path_1.resolve)(this.rootDir));
|
|
45
|
+
const target = (0, path_1.resolve)(this.testsDir);
|
|
46
|
+
// testsDir usually doesn't exist yet; resolve symlinks on its nearest
|
|
47
|
+
// existing ancestor, then re-append the not-yet-created suffix.
|
|
48
|
+
let existingAncestor = target;
|
|
49
|
+
while (!(0, fs_1.existsSync)(existingAncestor)) {
|
|
50
|
+
const parent = (0, path_1.dirname)(existingAncestor);
|
|
51
|
+
if (parent === existingAncestor) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
existingAncestor = parent;
|
|
55
|
+
}
|
|
56
|
+
const suffix = (0, path_1.relative)(existingAncestor, target);
|
|
57
|
+
const realTarget = suffix
|
|
58
|
+
? (0, path_1.join)((0, fs_1.realpathSync)(existingAncestor), suffix)
|
|
59
|
+
: (0, fs_1.realpathSync)(existingAncestor);
|
|
60
|
+
if (!realTarget.startsWith(realRoot + path_1.sep)) {
|
|
61
|
+
throw new Error(`The tests directory must resolve inside the seed root. '${this.testsDir}' escapes '${this.rootDir}'. Set 'testsDirectory' to a path within the project.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
getSkillDir() {
|
|
65
|
+
return (0, path_1.join)(this.rootDir, ".agents", "skills", "iocd-wdio-testing");
|
|
66
|
+
}
|
|
67
|
+
copySkill(overwrite) {
|
|
68
|
+
const source = (0, path_1.join)(this.templateDir, ".agents", "skills", "iocd-wdio-testing");
|
|
69
|
+
const destination = this.getSkillDir();
|
|
70
|
+
if (!(0, fs_1.existsSync)(source) || (!overwrite && (0, fs_1.existsSync)(destination))) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.copyDirectory(source, destination, overwrite);
|
|
74
|
+
}
|
|
75
|
+
copyDirectory(source, destination, overwrite) {
|
|
76
|
+
(0, fs_1.mkdirSync)(destination, { recursive: true });
|
|
77
|
+
for (const entry of (0, fs_1.readdirSync)(source, { withFileTypes: true })) {
|
|
78
|
+
const sourcePath = (0, path_1.join)(source, entry.name);
|
|
79
|
+
const destinationPath = (0, path_1.join)(destination, entry.name);
|
|
80
|
+
if (entry.isDirectory()) {
|
|
81
|
+
this.copyDirectory(sourcePath, destinationPath, overwrite);
|
|
82
|
+
}
|
|
83
|
+
else if (overwrite || !(0, fs_1.existsSync)(destinationPath)) {
|
|
84
|
+
(0, fs_1.cpSync)(sourcePath, destinationPath);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async validateInstallation() {
|
|
89
|
+
await this.runNpm(["install"], this.testsDir);
|
|
90
|
+
await this.runNpm(["run", "typecheck"], this.testsDir);
|
|
91
|
+
}
|
|
92
|
+
runNpmCommand(args, cwd) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
95
|
+
const child = (0, child_process_1.spawn)(npmCommand, args, {
|
|
96
|
+
cwd,
|
|
97
|
+
stdio: "inherit",
|
|
98
|
+
shell: true,
|
|
99
|
+
});
|
|
100
|
+
child.on("close", code => {
|
|
101
|
+
if (code === 0) {
|
|
102
|
+
resolve();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
reject(new Error(`npm ${args.join(" ")} failed with code ${code}`));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
child.on("error", reject);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.TestInfrastructureService = TestInfrastructureService;
|
|
113
|
+
//# sourceMappingURL=test-infrastructure.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-infrastructure.service.js","sourceRoot":"","sources":["../../src/services/test-infrastructure.service.ts"],"names":[],"mappings":";;;AAAA,2BAOY;AACZ,+BAA6D;AAC7D,iDAAsC;AACtC,wCAA0C;AAS1C,MAAa,yBAAyB;IAC5B,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,MAAM,CAAiD;IAE/D,YAAY,UAA4C,EAAE;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAS,CAAC,UAAU,EAAE,CAAC;QACzD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,gBAAS,CAAC,WAAW,EAAE,CAAC;QAC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C,KAAK,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;IAEO,aAAa,CAAC,IAAc,EAAE,GAAW;QAC/C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;YACpE,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,UAAU,EAAE,IAAI,EAAE;gBACpC,GAAG;gBACH,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;YACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;gBACvB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,OAAO,EAAE,CAAC;gBACZ,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;gBACtE,CAAC;YACH,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,8DAgIC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: iocd-wdio-testing
|
|
3
|
+
description: 'Set up, write, run, and debug end-to-end WebdriverIO tests for an io.Connect Desktop (IOCD) seed project with @interopio/wdio-iocd-service. Use when adding or running IOCD/seed E2E tests, or testing apps, windows, Web Groups, Workspaces, Interop, Channels, Shared Contexts, Layouts, or Notifications in a running io.Connect Desktop platform.'
|
|
4
|
+
argument-hint: 'Describe the IOCD behavior to test, or ask to set up tests'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# io.Connect Desktop WebdriverIO Testing
|
|
8
|
+
|
|
9
|
+
End-to-end tests for an io.Connect Desktop (IOCD) seed: WebdriverIO 9 + Mocha + Chai +
|
|
10
|
+
`@interopio/wdio-iocd-service` on the `platform-wdio` runner. Run everything from the **seed root**
|
|
11
|
+
(the folder with `config/iocd.cli.config.json`). The test package lives in the directory named by
|
|
12
|
+
`testsDirectory` in that config — this skill assumes the default, `tests`; substitute if the seed
|
|
13
|
+
overrides it. Each spec runs in the WebdriverIO worker (Node) and drives the app windows remotely
|
|
14
|
+
over ChromeDriver.
|
|
15
|
+
|
|
16
|
+
## First, pick the job
|
|
17
|
+
|
|
18
|
+
**Setting up the test package?** → [setup](./references/setup.md). The one hard rule: `iocd test
|
|
19
|
+
setup` refuses to overwrite an existing test directory — **never replace one without explicit user
|
|
20
|
+
approval**.
|
|
21
|
+
|
|
22
|
+
**Writing a test?** → [authoring](./references/authoring.md). Before writing anything, read the
|
|
23
|
+
nearest existing `tests/tests/*.spec.ts`, `tests/tests/config/apps.json`, and `tests/tests/common/`.
|
|
24
|
+
Match what's there — it reflects the installed version, which this skill may not.
|
|
25
|
+
|
|
26
|
+
**Driving built-in IOCD UI?** → [models](./references/models.md). Use the installed service's
|
|
27
|
+
semantic models for Web Groups and their controls before reaching for internal CSS selectors.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm test # run all specs
|
|
31
|
+
npm test -- --spec ./tests/<name>.spec.ts # run one spec (path is relative to the test package)
|
|
32
|
+
cd tests && npm run typecheck # type-check without launching the platform
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Rules (the things that are easy to get wrong)
|
|
36
|
+
|
|
37
|
+
- **Get the API in a hook, not at load time.** `const io = await browser.io()` only inside
|
|
38
|
+
`it`/`beforeEach`/`afterEach`. At `describe` time, only `globalThis.ioCDPlatformConfig` is available.
|
|
39
|
+
- **Don't initialize io.Connect** in a spec; the service connects the platform and provides the API.
|
|
40
|
+
- **Wait for state, never sleep.** Use `browser.waitUntil`, element waits, or the `waitFor` helper in
|
|
41
|
+
`tests/tests/common/`. For events, create the `waitForEvent` waiter before triggering the action,
|
|
42
|
+
track its unsubscribe with `createCleanupRegistry`, and run cleanup in `afterEach`.
|
|
43
|
+
- **A window isn't an app-ready signal.** `instance.getWindow()` only means the window exists. Wait
|
|
44
|
+
for an app-owned DOM state, enabled control, Interop method, or other observable signal proving
|
|
45
|
+
that initialization and subscriptions are complete before acting.
|
|
46
|
+
- **Know which process owns the API.** `browser.io()` is the worker's test API. Client-window
|
|
47
|
+
libraries must be initialized and called in a real app window. If a call resolves only after user
|
|
48
|
+
input, start it without awaiting, perform the UI action, then collect its stored outcome.
|
|
49
|
+
- **Arrange with API, act through UI, assert through API.** Use io.Connect APIs to create controlled
|
|
50
|
+
state, WebdriverIO to perform the user action, then an io.Connect API to verify the real platform
|
|
51
|
+
effect. Add a DOM assertion when the visible result also matters.
|
|
52
|
+
- **Clean up in `afterEach`** — apps, windows, Workspaces, Layouts, Interop registrations, Contexts,
|
|
53
|
+
subscriptions, travelled time — even after failure.
|
|
54
|
+
- **Keep the test client out of Global Layouts.** Save an explicit `instances` list. When restoring
|
|
55
|
+
with `closeRunningInstances: true`, set `closeMe: false` so the test session isn't closed too.
|
|
56
|
+
- **Use the right Workspace context.** Use `workspace.frameId` for frame UI, but force-load an app
|
|
57
|
+
window and switch by `workspaceWindow.getGdWindow().id` for its DOM. Refresh the Workspace
|
|
58
|
+
reference after structural changes before reading its updated tree.
|
|
59
|
+
- **Keep the seed's config**: the `platform-wdio` runner and `binary: process.env.BINARY_PATH`.
|
|
60
|
+
- **Prefer service models for built-in UI.** Check the installed `models/index.d.ts`; model exports
|
|
61
|
+
vary by `@interopio/wdio-iocd-service` version. Use ordinary WebdriverIO selectors for app UI.
|
|
62
|
+
- **Preserve user files.** Never put the license (or `user-data`) in specs, logs, or CI artifacts.
|
|
63
|
+
|
|
64
|
+
## References
|
|
65
|
+
|
|
66
|
+
- [setup](./references/setup.md) — scaffold, add to, or replace the test package.
|
|
67
|
+
- [authoring](./references/authoring.md) — spec shape, fixtures, synchronization, isolation.
|
|
68
|
+
- [commands](./references/commands.md) — the IOCD-specific WebdriverIO commands (for the rest, read the service `.d.ts`).
|
|
69
|
+
- [models](./references/models.md) — built-in IOCD UI page objects, current exports, and version rules.
|
|
70
|
+
- [configuration](./references/configuration.md) — env vars, overrides, optional libraries, runners, CI.
|
|
71
|
+
- [troubleshooting](./references/troubleshooting.md) — executable, license, startup, IO API, dead window handles, flaky tests.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Authoring
|
|
2
|
+
|
|
3
|
+
**Read before writing.** Open the nearest `tests/tests/*.spec.ts` and copy its shape; read
|
|
4
|
+
`tests/tests/config/apps.json` (fixture apps) and `tests/tests/common/` (helpers). These reflect the
|
|
5
|
+
installed version — trust them over this file.
|
|
6
|
+
|
|
7
|
+
## Canonical shape
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { expect } from "chai";
|
|
11
|
+
import type { IOConnectDesktop } from "@interopio/desktop";
|
|
12
|
+
import { $, browser } from "@wdio/globals";
|
|
13
|
+
|
|
14
|
+
describe("behavior under test", () => {
|
|
15
|
+
let instance: IOConnectDesktop.AppManager.Instance | undefined;
|
|
16
|
+
|
|
17
|
+
afterEach(async () => {
|
|
18
|
+
await instance?.stop().catch(() => undefined);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("does one thing", async () => {
|
|
22
|
+
const io = await browser.io(); // API only inside a test/hook
|
|
23
|
+
|
|
24
|
+
instance = await io.appManager.application("web")!.start();
|
|
25
|
+
const window = await instance.getWindow();
|
|
26
|
+
|
|
27
|
+
await browser.switchById(window.id); // enter the app window before touching its DOM
|
|
28
|
+
await $("#increment-counter").waitAndClick();
|
|
29
|
+
|
|
30
|
+
expect(await $("#counter").getText()).to.equal("1");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Arrange platform state with the io.Connect API (`io`); exercise and assert user-visible behavior with
|
|
36
|
+
WebdriverIO (`$`, `browser`). For config-dependent suites, read `globalThis.ioCDPlatformConfig` at
|
|
37
|
+
describe time (the API isn't available then).
|
|
38
|
+
|
|
39
|
+
## The generated specs are your templates
|
|
40
|
+
|
|
41
|
+
Each demonstrates a pattern worth copying — read the one closest to your goal:
|
|
42
|
+
|
|
43
|
+
- `single-app.spec.ts` — start one app, drive its DOM, assert the result.
|
|
44
|
+
- `channel-selector.spec.ts` — use the Web Group model to open the built-in Channel Selector, pick
|
|
45
|
+
a Channel, and verify the client app observes the new membership.
|
|
46
|
+
- `shared-contexts.spec.ts` — publish a Shared Context update from one app instance and verify that
|
|
47
|
+
another subscribed instance renders it.
|
|
48
|
+
- `interop.spec.ts` — an app registers an Interop method; the test invokes it and asserts the
|
|
49
|
+
response.
|
|
50
|
+
- `workspace-interop.spec.ts` — restore a Workspace Layout, drive one app with WebdriverIO, verify a
|
|
51
|
+
second app received an Interop invocation.
|
|
52
|
+
- `notifications.spec.ts` — raise a notification and assert it in the Notification Panel.
|
|
53
|
+
- `workspace-add-app.spec.ts` — add an app through the Workspaces add-application popup (UI clicks).
|
|
54
|
+
The popup flow assumes universal mode (`config/system.json` sets `"advancedMode": false`).
|
|
55
|
+
|
|
56
|
+
## Fixtures
|
|
57
|
+
|
|
58
|
+
Add test apps to `tests/tests/config/apps.json` (match the existing entries), with HTML under
|
|
59
|
+
`tests/tests/assets/applications/`. An app needs `customProperties.includeInWorkspaces: true` to
|
|
60
|
+
appear in the Workspaces add-application popup. Keep production app definitions separate from
|
|
61
|
+
fixtures unless the test targets the real app package.
|
|
62
|
+
|
|
63
|
+
## Channels and Shared Contexts
|
|
64
|
+
|
|
65
|
+
For a Channel-enabled fixture, initialize the client API with `IODesktop({ channels: true })` and
|
|
66
|
+
enable `details.channelSelector` in its app definition. The built-in selector belongs to the Web
|
|
67
|
+
Group, not the client app DOM: use `Group` and its frame caption model from
|
|
68
|
+
`@interopio/wdio-iocd-service/models`, then switch to the selector popup before querying its DOM.
|
|
69
|
+
See [models](./models.md), `channel-selector.spec.ts`, and the deterministic Channel definitions in
|
|
70
|
+
`config/system.json`.
|
|
71
|
+
Register membership changes with `io.channels.onChannelsChanged()` — it isn't a window API. Expose
|
|
72
|
+
an app readiness signal and wait for it before changing the Channel through the UI, so the test
|
|
73
|
+
can't act before the app has initialized Channels and registered its listener.
|
|
74
|
+
|
|
75
|
+
For Shared Contexts, wait until the receiving app has subscribed before triggering the publisher.
|
|
76
|
+
Destroy named test contexts before and after a test because they are persistent platform state, and
|
|
77
|
+
stop every publisher/subscriber instance in `afterEach`. When the test also observes the update,
|
|
78
|
+
create a `waitForEvent` waiter before the UI action and register its unsubscribe with
|
|
79
|
+
`createCleanupRegistry`. See `shared-contexts.spec.ts`.
|
|
80
|
+
|
|
81
|
+
## Global Layouts
|
|
82
|
+
|
|
83
|
+
Global Layout save and restore defaults are broad. Save only the app instances owned by the test;
|
|
84
|
+
omitting `instances` may capture other running instances, including the WDIO test client. A Global
|
|
85
|
+
restore closes visible running instances by default, and `closeMe` also defaults to `true`, so set it
|
|
86
|
+
to `false` when the test must survive a restore that closes other apps:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const layoutName = `test-orders-${Date.now()}`;
|
|
90
|
+
|
|
91
|
+
await io.layouts.save({
|
|
92
|
+
name: layoutName,
|
|
93
|
+
type: "Global",
|
|
94
|
+
instances: [ordersInstance.id, detailsInstance.id],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
await io.layouts.restore({
|
|
98
|
+
name: layoutName,
|
|
99
|
+
type: "Global",
|
|
100
|
+
closeRunningInstances: true,
|
|
101
|
+
closeMe: false,
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Use a unique, descriptive name per test and remove only the Layouts that test created in `afterEach`.
|
|
106
|
+
Track the name as soon as it is allocated so cleanup still runs if save or restore fails. Don't clear
|
|
107
|
+
all user Layouts; the generated isolated user-data directory limits cross-run state, but cleanup is
|
|
108
|
+
still required within a run.
|
|
109
|
+
|
|
110
|
+
## Workspaces
|
|
111
|
+
|
|
112
|
+
Distinguish the Workspaces frame from the client apps inside it:
|
|
113
|
+
|
|
114
|
+
- Use `browser.switchById(workspace.frameId)` only for frame-owned UI such as empty-state controls,
|
|
115
|
+
tab strips, or the add-application popup. See `workspace-add-app.spec.ts`.
|
|
116
|
+
- To drive a client app, find its `WorkspaceWindow`, call `forceLoad()`, then switch with
|
|
117
|
+
`browser.switchById(workspaceWindow.getGdWindow().id)`. See `workspace-interop.spec.ts`.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
await browser.switchById(workspace.frameId); // Workspaces frame DOM.
|
|
121
|
+
|
|
122
|
+
const ordersWindow = workspace
|
|
123
|
+
.getAllWindows()
|
|
124
|
+
.find(window => window.appName === "orders")!;
|
|
125
|
+
|
|
126
|
+
await ordersWindow.forceLoad();
|
|
127
|
+
await browser.switchById(ordersWindow.getGdWindow().id); // Orders app DOM.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
A `Workspace` object represents a local reference to platform state. After a structural mutation,
|
|
131
|
+
call `await workspace.refreshReference()` before reading the updated tree when the next assertion
|
|
132
|
+
depends on current children, constraints, or window membership. Re-find the target from the
|
|
133
|
+
refreshed Workspace instead of continuing with an object obtained before the mutation:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
await workspace.addColumn({
|
|
137
|
+
children: [{ type: "window", appName: "orders", context: { orderId: "42" } }],
|
|
138
|
+
});
|
|
139
|
+
await workspace.refreshReference();
|
|
140
|
+
|
|
141
|
+
const ordersWindow = workspace
|
|
142
|
+
.getAllWindows()
|
|
143
|
+
.find(window => window.appName === "orders")!;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Loading and context propagation are asynchronous. After `forceLoad()`, wait for the app-owned ready
|
|
147
|
+
signal before driving its DOM. If the test asserts startup context, wait until the underlying window
|
|
148
|
+
exposes the expected value rather than reading it immediately after the structural mutation.
|
|
149
|
+
|
|
150
|
+
## Worker API vs App-Window APIs
|
|
151
|
+
|
|
152
|
+
`await browser.io()` returns the io.Connect API created for the WebdriverIO worker. It is suitable
|
|
153
|
+
for platform operations such as starting apps, arranging Workspaces, invoking Interop, and observing
|
|
154
|
+
Shared Contexts. It isn't automatically the same API surface as `window.io` inside a client app.
|
|
155
|
+
|
|
156
|
+
Some optional client libraries are renderer-scoped. For example, a Modals API can require a real app
|
|
157
|
+
window that initialized its client with the Modals library. For such an API:
|
|
158
|
+
|
|
159
|
+
1. Register and start a real fixture or application window with the required library.
|
|
160
|
+
2. Wait for an app-owned signal proving that library initialization completed.
|
|
161
|
+
3. Switch to that app window before using its UI or renderer API.
|
|
162
|
+
4. Keep the renderer-specific interaction in a small fixture/page-object helper.
|
|
163
|
+
|
|
164
|
+
Don't initialize a second io.Connect client inside the test worker, and don't assume that adding a
|
|
165
|
+
library to the worker's `ioInitOptions.libraries` makes a window-scoped client API usable there.
|
|
166
|
+
Prefer driving the fixture UI when that is the behavior under test. Use renderer evaluation only for
|
|
167
|
+
test setup or observation that cannot be expressed through a public platform API or user action, and
|
|
168
|
+
only when the target app permits it.
|
|
169
|
+
|
|
170
|
+
### Promises that settle after user input
|
|
171
|
+
|
|
172
|
+
Some renderer calls return a promise that settles only after the user answers a dialog or completes
|
|
173
|
+
another UI workflow. Awaiting that promise while issuing the request blocks the test before it can
|
|
174
|
+
perform the action that resolves the promise. Split the workflow into **start**, **interact**, and
|
|
175
|
+
**collect** phases:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
// In the app-window helper: start the request and return immediately.
|
|
179
|
+
await browser.execute((requestConfig) => {
|
|
180
|
+
const appWindow = window as typeof window & {
|
|
181
|
+
io: { modals: { dialogs: { request(config: unknown): Promise<unknown> } } };
|
|
182
|
+
__modalOutcome?: { settled: boolean; response?: unknown; error?: string };
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
appWindow.__modalOutcome = { settled: false };
|
|
186
|
+
void appWindow.io.modals.dialogs.request(requestConfig)
|
|
187
|
+
.then(response => {
|
|
188
|
+
appWindow.__modalOutcome = { settled: true, response };
|
|
189
|
+
})
|
|
190
|
+
.catch(error => {
|
|
191
|
+
appWindow.__modalOutcome = { settled: true, error: String(error) };
|
|
192
|
+
});
|
|
193
|
+
}, config);
|
|
194
|
+
|
|
195
|
+
// Switch to the dialog and answer it through WebdriverIO or a service model.
|
|
196
|
+
await dialog.waitUntilOpen();
|
|
197
|
+
await dialog.clickAction("confirm");
|
|
198
|
+
|
|
199
|
+
// Switch back to the requester, wait for settlement, then collect/assert the outcome.
|
|
200
|
+
await browser.switchById(requesterWindow.id);
|
|
201
|
+
await browser.waitUntil(
|
|
202
|
+
() => browser.execute(() => Boolean((window as any).__modalOutcome?.settled)),
|
|
203
|
+
{ timeoutMsg: "Expected the modal request to settle" }
|
|
204
|
+
);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Store both resolved and rejected outcomes, clean any app-owned request state after the test, and use
|
|
208
|
+
a descriptive timeout. Never leave a promise unobserved merely to avoid the deadlock.
|
|
209
|
+
|
|
210
|
+
## Notifications
|
|
211
|
+
|
|
212
|
+
Notifications are disabled on a fresh platform — call `io.notifications.configure({ enable: true })`
|
|
213
|
+
before raising one. To assert in the panel, open it with `io.notifications.panel.show()`, then
|
|
214
|
+
`browser.switchToNotificationPanel()` before querying `.io-notification` items — the `switchTo*`
|
|
215
|
+
command only switches focus, it doesn't open the panel. See `notifications.spec.ts`.
|
|
216
|
+
|
|
217
|
+
## Patterns that keep tests reliable
|
|
218
|
+
|
|
219
|
+
- **Wait for application readiness after `getWindow()`** — window availability doesn't prove that
|
|
220
|
+
`IODesktop()` initialization, optional libraries, registrations, subscriptions, event handlers,
|
|
221
|
+
or initial rendering are complete. Wait for an app-owned signal that matches the dependency of
|
|
222
|
+
the next action: a ready DOM state, an enabled control, a published Interop method, or another
|
|
223
|
+
observable API state. `channel-selector.spec.ts` waits for `#channel-status` before changing the
|
|
224
|
+
Channel; `interop.spec.ts` waits until the responder method appears in `io.interop.methods()`.
|
|
225
|
+
- **Arrange with API → act through UI → assert through API** — use io.Connect APIs to create a
|
|
226
|
+
controlled initial state, WebdriverIO to perform the user workflow, then an io.Connect API to
|
|
227
|
+
verify the underlying platform effect. Add a DOM assertion when the visible result is part of the
|
|
228
|
+
behavior. `workspace-add-app.spec.ts` creates a Workspace through the API, adds an app through the
|
|
229
|
+
Workspaces UI, verifies the window through `io.workspaces`, and finally checks the app DOM.
|
|
230
|
+
- **Wait for state, not time** — events, `browser.waitUntil`, element waits, or `waitFor`. Subscribe
|
|
231
|
+
before triggering the action. For event APIs, use `waitForEvent` from `tests/tests/common/iocd.ts`:
|
|
232
|
+
it filters events, times out with a useful message, and unsubscribes on success or timeout. Track
|
|
233
|
+
its idempotent `unsubscribe` in a cleanup registry so test failure can't leak the subscription.
|
|
234
|
+
Don't replace an unknown readiness condition with a fixed pause.
|
|
235
|
+
- **Isolate** — create state in `beforeEach` or the test; clean everything in `afterEach`. Catch
|
|
236
|
+
cleanup errors only when the resource may already be gone.
|
|
237
|
+
- **Don't bypass the behavior under test** — drive the first app as a user would and observe the
|
|
238
|
+
outcome in the receiver, rather than invoking application business logic directly from the test.
|
|
239
|
+
- **One behavior per test**; run the new spec alone while iterating.
|
|
240
|
+
|
|
241
|
+
> The single-app sample uses `io.appManager` (deprecated for `io.apps`) because it needs
|
|
242
|
+
> `getWindow()` — don't "fix" it blindly. Optional sub-APIs like `io.workspaces` are typed optional
|
|
243
|
+
> (`!`) and need the library in `ioInitOptions.libraries`; see [configuration](./configuration.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# IOCD-specific WebdriverIO commands
|
|
2
|
+
|
|
3
|
+
`IOCDService()` adds these to `browser` and elements — this is the part you can't infer. For the
|
|
4
|
+
standard WebdriverIO/Mocha/Chai surface and for exact signatures, read the installed
|
|
5
|
+
`@interopio/wdio-iocd-service` TypeScript declarations.
|
|
6
|
+
|
|
7
|
+
| Command | Purpose |
|
|
8
|
+
|---------|---------|
|
|
9
|
+
| `browser.io()` | The test io.Connect API (await it inside a test/hook). |
|
|
10
|
+
| `browser.switchById(id)` | Switch the WebDriver context to an IOCD window (app window, Web Group, or Workspace frame) by its IOCD window id. Required before driving that window's DOM. |
|
|
11
|
+
| `browser.switchToLaunchpad()` | Switch to the running Launchpad. |
|
|
12
|
+
| `browser.switchToNotificationPanel()` | Switch to the open Notification Panel. |
|
|
13
|
+
| `browser.travelTime(offsetMs)` / `browser.restoreTime()` | Shift and restore `Date`/`Date.now()` in the active window. |
|
|
14
|
+
| `element.waitAndClick(opts?)` | Wait until displayed and clickable, then click. |
|
|
15
|
+
| `element.waitForChildrenCount(selector, count, opts?)` | Wait until exactly `count` children match `selector`. |
|
|
16
|
+
|
|
17
|
+
Gotchas:
|
|
18
|
+
|
|
19
|
+
- `switchById` only switches to an **already-existing**, web-based window (scans handles ~5s, throws
|
|
20
|
+
if absent). It won't start apps, restore Workspaces, or open UI windows, and can't automate native
|
|
21
|
+
windows.
|
|
22
|
+
- The `switchTo*` commands only switch context — the Launchpad must be running and the Notification
|
|
23
|
+
Panel already open (e.g. `io.notifications.panel.show()`).
|
|
24
|
+
- `travelTime` patches only the active window's clock; restore before switching away.
|