testeranto 0.70.0 → 0.74.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/README.md +9 -18
- package/dist/common/Node.js +7 -34
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +370 -0
- package/dist/common/PM/node.js +84 -0
- package/dist/common/PM/web.js +129 -0
- package/dist/common/Project.js +20 -2
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react/jsx/index.js +14 -2
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/common/Web.js +24 -44
- package/dist/common/esbuildConfigs/web.js +3 -1
- package/dist/common/lib/abstractBase.js +189 -41
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +6 -2
- package/dist/common/lib/core.js +41 -45
- package/dist/common/lib/index.js +2 -1
- package/dist/common/preload.js +14 -18
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +7 -34
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +340 -0
- package/dist/module/PM/node.js +77 -0
- package/dist/module/PM/web.js +122 -0
- package/dist/module/Project.js +20 -2
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/index.js +11 -2
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/module/Web.js +24 -44
- package/dist/module/esbuildConfigs/web.js +3 -1
- package/dist/module/lib/abstractBase.js +189 -41
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +6 -2
- package/dist/module/lib/core.js +41 -45
- package/dist/module/lib/index.js +2 -1
- package/dist/module/preload.js +15 -14
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +26 -0
- package/dist/types/PM/node.d.ts +25 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +2 -5
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +13 -12
- package/dist/types/lib/basebuilder.d.ts +4 -2
- package/dist/types/lib/classBuilder.d.ts +2 -2
- package/dist/types/lib/core.d.ts +4 -4
- package/dist/types/lib/index.d.ts +6 -5
- package/dist/types/lib/types.d.ts +16 -24
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/Node.ts +8 -47
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +452 -0
- package/src/PM/node.ts +122 -0
- package/src/PM/web.ts +162 -0
- package/src/Project.ts +21 -2
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +160 -46
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +3 -3
- package/src/SubPackages/react/jsx/index.ts +13 -3
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react-dom/component/web.ts +126 -67
- package/src/SubPackages/react-test-renderer/jsx/index.ts +0 -1
- package/src/Web.ts +25 -69
- package/src/esbuildConfigs/web.ts +4 -2
- package/src/lib/abstractBase.ts +260 -65
- package/src/lib/basebuilder.ts +121 -100
- package/src/lib/classBuilder.ts +5 -4
- package/src/lib/core.ts +58 -59
- package/src/lib/index.ts +10 -9
- package/src/lib/types.ts +18 -27
- package/src/preload.ts +14 -14
- package/dist/common/NodeWriter.js +0 -54
- package/dist/common/electron.js +0 -266
- package/dist/module/NodeWriter.js +0 -48
- package/dist/module/electron.js +0 -261
- package/dist/types/NodeWriter.d.ts +0 -2
- package/src/NodeWriter.ts +0 -72
- package/src/electron.ts +0 -317
- package/yarn-error.log +0 -3144
- /package/dist/types/{electron.d.ts → Puppeteer.d.ts} +0 -0
package/src/lib/basebuilder.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PassThrough } from "stream";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
ITTestResourceRequest,
|
|
3
5
|
ITestJob,
|
|
@@ -13,7 +15,7 @@ import {
|
|
|
13
15
|
IWhenKlasser,
|
|
14
16
|
IThenKlasser,
|
|
15
17
|
ICheckKlasser,
|
|
16
|
-
IUtils,
|
|
18
|
+
// IUtils,
|
|
17
19
|
} from "./types.js";
|
|
18
20
|
|
|
19
21
|
import {
|
|
@@ -23,6 +25,7 @@ import {
|
|
|
23
25
|
BaseThen,
|
|
24
26
|
BaseGiven,
|
|
25
27
|
} from "./abstractBase.js";
|
|
28
|
+
import { PM } from "../PM/index.js";
|
|
26
29
|
|
|
27
30
|
export abstract class BaseBuilder<
|
|
28
31
|
ITestShape extends IBaseTest,
|
|
@@ -45,6 +48,7 @@ export abstract class BaseBuilder<
|
|
|
45
48
|
whenOverides: Record<keyof WhenExtensions, IWhenKlasser<ITestShape>>;
|
|
46
49
|
thenOverides: Record<keyof ThenExtensions, IThenKlasser<ITestShape>>;
|
|
47
50
|
checkOverides: Record<keyof CheckExtensions, ICheckKlasser<ITestShape>>;
|
|
51
|
+
puppetMaster: PM;
|
|
48
52
|
|
|
49
53
|
constructor(
|
|
50
54
|
public readonly input: ITestShape["iinput"],
|
|
@@ -53,9 +57,9 @@ export abstract class BaseBuilder<
|
|
|
53
57
|
whenOverides: Record<keyof WhenExtensions, IWhenKlasser<ITestShape>>,
|
|
54
58
|
thenOverides: Record<keyof ThenExtensions, IThenKlasser<ITestShape>>,
|
|
55
59
|
checkOverides: Record<keyof CheckExtensions, ICheckKlasser<ITestShape>>,
|
|
56
|
-
logWriter: ILogWriter,
|
|
57
60
|
testResourceRequirement: ITTestResourceRequest,
|
|
58
61
|
testSpecification: any
|
|
62
|
+
// puppetMaster: PM
|
|
59
63
|
) {
|
|
60
64
|
this.artifacts = [];
|
|
61
65
|
this.testResourceRequirement = testResourceRequirement;
|
|
@@ -65,6 +69,7 @@ export abstract class BaseBuilder<
|
|
|
65
69
|
this.thenOverides = thenOverides;
|
|
66
70
|
this.checkOverides = checkOverides;
|
|
67
71
|
this.testSpecification = testSpecification;
|
|
72
|
+
// this.puppetMaster = puppetMaster;
|
|
68
73
|
|
|
69
74
|
this.specs = testSpecification(
|
|
70
75
|
this.Suites(),
|
|
@@ -74,106 +79,122 @@ export abstract class BaseBuilder<
|
|
|
74
79
|
this.Check()
|
|
75
80
|
);
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.artifacts.push(p);
|
|
90
|
-
})(testResourceConfiguration.fs + "/" + fPath, value),
|
|
91
|
-
tLog,
|
|
92
|
-
utils
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
this.testJobs = this.specs.map(
|
|
97
|
-
(suite: BaseSuite<ITestShape>, utils: IUtils) => {
|
|
98
|
-
const runner = suiteRunner(suite, utils);
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
test: suite,
|
|
102
|
-
testResourceRequirement,
|
|
103
|
-
|
|
104
|
-
toObj: () => {
|
|
105
|
-
return suite.toObj();
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
runner,
|
|
109
|
-
|
|
110
|
-
receiveTestResourceConfig: async function (
|
|
111
|
-
testResourceConfiguration = {
|
|
112
|
-
name: "",
|
|
113
|
-
fs: ".",
|
|
114
|
-
ports: [],
|
|
115
|
-
scheduled: false,
|
|
82
|
+
this.testJobs = this.specs.map((suite: BaseSuite<ITestShape>) => {
|
|
83
|
+
const suiteRunner =
|
|
84
|
+
(suite: BaseSuite<ITestShape>) =>
|
|
85
|
+
async (
|
|
86
|
+
// testResourceConfiguration: ITTestResourceConfiguration,
|
|
87
|
+
puppetMaster: PM,
|
|
88
|
+
tLog: ITLog
|
|
89
|
+
): Promise<BaseSuite<ITestShape>> => {
|
|
90
|
+
await puppetMaster.startPuppeteer(
|
|
91
|
+
{
|
|
92
|
+
browserWSEndpoint:
|
|
93
|
+
puppetMaster.testResourceConfiguration.browserWSEndpoint,
|
|
116
94
|
},
|
|
117
|
-
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`${testResourceConfiguration.fs}/tests.json`,
|
|
134
|
-
JSON.stringify(this.toObj(), null, 2)
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const logFilePath = `${testResourceConfiguration.fs}/log.txt`;
|
|
138
|
-
|
|
139
|
-
const access = await logWriter.createWriteStream(logFilePath);
|
|
140
|
-
|
|
141
|
-
const tLog = (...l: string[]) => access.write(`${l.toString()}\n`);
|
|
142
|
-
|
|
143
|
-
const suiteDone: BaseSuite<ITestShape> = await runner(
|
|
144
|
-
testResourceConfiguration,
|
|
145
|
-
tLog,
|
|
146
|
-
y
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const logPromise = new Promise((res, rej) => {
|
|
150
|
-
access.on("finish", () => {
|
|
151
|
-
res(true);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
access.end();
|
|
155
|
-
|
|
156
|
-
const numberOfFailures = Object.keys(suiteDone.givens).filter(
|
|
157
|
-
(k) => {
|
|
158
|
-
return suiteDone.givens[k].error;
|
|
159
|
-
}
|
|
160
|
-
).length;
|
|
161
|
-
logWriter.writeFileSync(
|
|
162
|
-
`${testResourceConfiguration.fs}/exitcode`,
|
|
163
|
-
numberOfFailures.toString()
|
|
164
|
-
);
|
|
165
|
-
console.log(
|
|
166
|
-
`exiting gracefully with ${numberOfFailures} failures.`
|
|
167
|
-
);
|
|
168
|
-
return {
|
|
169
|
-
failed: numberOfFailures,
|
|
170
|
-
artifacts: this.artifacts || [],
|
|
171
|
-
logPromise,
|
|
172
|
-
};
|
|
173
|
-
},
|
|
95
|
+
puppetMaster.testResourceConfiguration.fs
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return await suite.run(
|
|
99
|
+
input,
|
|
100
|
+
puppetMaster.testResourceConfiguration,
|
|
101
|
+
(fPath: string, value: string | Buffer | PassThrough) =>
|
|
102
|
+
puppetMaster.testArtiFactoryfileWriter(
|
|
103
|
+
tLog,
|
|
104
|
+
(p: Promise<void>) => {
|
|
105
|
+
this.artifacts.push(p);
|
|
106
|
+
}
|
|
107
|
+
)(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
|
|
108
|
+
tLog,
|
|
109
|
+
puppetMaster
|
|
110
|
+
);
|
|
174
111
|
};
|
|
175
|
-
|
|
176
|
-
|
|
112
|
+
|
|
113
|
+
const runner = suiteRunner(suite);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
test: suite,
|
|
117
|
+
// testResourceRequirement,
|
|
118
|
+
|
|
119
|
+
toObj: () => {
|
|
120
|
+
return suite.toObj();
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
runner,
|
|
124
|
+
|
|
125
|
+
receiveTestResourceConfig: async function (
|
|
126
|
+
// testResourceConfiguration = {
|
|
127
|
+
// name: "",
|
|
128
|
+
// fs: ".",
|
|
129
|
+
// ports: [],
|
|
130
|
+
// browserWSEndpoint: "",
|
|
131
|
+
// },
|
|
132
|
+
puppetMaster: PM
|
|
133
|
+
) {
|
|
134
|
+
// console.log(
|
|
135
|
+
// `testResourceConfiguration! ${JSON.stringify(
|
|
136
|
+
// testResourceConfiguration,
|
|
137
|
+
// null,
|
|
138
|
+
// 2
|
|
139
|
+
// )}`
|
|
140
|
+
// );
|
|
141
|
+
// console.log("puppetMaster", puppetMaster);
|
|
142
|
+
|
|
143
|
+
await puppetMaster
|
|
144
|
+
.mkdirSync
|
|
145
|
+
// ""
|
|
146
|
+
// puppetMaster.testResourceConfiguration.fs + "/"
|
|
147
|
+
();
|
|
148
|
+
// if (!puppetMaster.existsSync(destFolder)) {
|
|
149
|
+
// puppetMaster.mkdirSync(destFolder, { recursive: true });
|
|
150
|
+
// }
|
|
151
|
+
|
|
152
|
+
// puppetMaster.writeFileSync(
|
|
153
|
+
// // puppetMaster.testResourceConfiguration.fs + `/tests.json`,
|
|
154
|
+
// `tests.json`,
|
|
155
|
+
// JSON.stringify(this.toObj(), null, 2)
|
|
156
|
+
// );
|
|
157
|
+
|
|
158
|
+
const logFilePath = "log.txt";
|
|
159
|
+
// puppetMaster.testResourceConfiguration.fs + `/log.txt`;
|
|
160
|
+
|
|
161
|
+
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
162
|
+
|
|
163
|
+
// console.log("access", access);
|
|
164
|
+
const tLog = (...l: string[]) => {
|
|
165
|
+
// access.write(`${l.toString()}\n`);
|
|
166
|
+
// console.log("tLog", l);
|
|
167
|
+
puppetMaster.write(access, `${l.toString()}\n`);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const suiteDone: BaseSuite<ITestShape> = await runner(
|
|
171
|
+
puppetMaster,
|
|
172
|
+
tLog
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const logPromise = new Promise((res, rej) => {
|
|
176
|
+
puppetMaster.end(access);
|
|
177
|
+
res(true);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
181
|
+
return suiteDone.givens[k].error;
|
|
182
|
+
}).length;
|
|
183
|
+
puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
|
|
184
|
+
|
|
185
|
+
puppetMaster.writeFileSync(
|
|
186
|
+
`tests.json`,
|
|
187
|
+
JSON.stringify(this.toObj(), null, 2)
|
|
188
|
+
);
|
|
189
|
+
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
190
|
+
return {
|
|
191
|
+
failed: numberOfFailures,
|
|
192
|
+
artifacts: this.artifacts || [],
|
|
193
|
+
logPromise,
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
});
|
|
177
198
|
}
|
|
178
199
|
|
|
179
200
|
Specs() {
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { BaseBuilder } from "./basebuilder.js";
|
|
8
8
|
|
|
9
|
-
import { ILogWriter, ITTestResourceRequest } from ".";
|
|
10
9
|
import {
|
|
11
10
|
ISuiteKlasser,
|
|
12
11
|
IGivenKlasser,
|
|
@@ -14,6 +13,8 @@ import {
|
|
|
14
13
|
IThenKlasser,
|
|
15
14
|
ICheckKlasser,
|
|
16
15
|
} from "./types.js";
|
|
16
|
+
import { PM } from "../PM/index.js";
|
|
17
|
+
import { ITTestResourceRequest } from "./index.js";
|
|
17
18
|
|
|
18
19
|
export abstract class ClassBuilder<
|
|
19
20
|
ITestShape extends IBaseTest
|
|
@@ -27,8 +28,8 @@ export abstract class ClassBuilder<
|
|
|
27
28
|
whenKlasser: IWhenKlasser<ITestShape>,
|
|
28
29
|
thenKlasser: IThenKlasser<ITestShape>,
|
|
29
30
|
checkKlasser: ICheckKlasser<ITestShape>,
|
|
30
|
-
testResourceRequirement: ITTestResourceRequest
|
|
31
|
-
|
|
31
|
+
testResourceRequirement: ITTestResourceRequest
|
|
32
|
+
// puppetMaster: PM
|
|
32
33
|
) {
|
|
33
34
|
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
34
35
|
(a, [key], index) => {
|
|
@@ -110,9 +111,9 @@ export abstract class ClassBuilder<
|
|
|
110
111
|
classyWhens,
|
|
111
112
|
classyThens,
|
|
112
113
|
classyChecks,
|
|
113
|
-
logWriter,
|
|
114
114
|
testResourceRequirement,
|
|
115
115
|
testSpecification
|
|
116
|
+
// puppetMaster
|
|
116
117
|
);
|
|
117
118
|
}
|
|
118
119
|
}
|
package/src/lib/core.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ITestImplementation,
|
|
6
6
|
} from "../Types.js";
|
|
7
7
|
|
|
8
|
-
import { ITestInterface
|
|
8
|
+
import { ITestInterface } from "./types.js";
|
|
9
9
|
import {
|
|
10
10
|
DefaultTestInterface,
|
|
11
11
|
ILogWriter,
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
BaseCheck,
|
|
24
24
|
} from "./abstractBase.js";
|
|
25
25
|
import { ClassBuilder } from "./classBuilder.js";
|
|
26
|
+
import { PM } from "../PM/index";
|
|
26
27
|
|
|
27
28
|
export default abstract class Testeranto<
|
|
28
29
|
ITestShape extends IBaseTest
|
|
@@ -32,17 +33,48 @@ export default abstract class Testeranto<
|
|
|
32
33
|
testSpecification: ITestSpecification<ITestShape>,
|
|
33
34
|
testImplementation: ITestImplementation<ITestShape>,
|
|
34
35
|
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
|
|
35
|
-
logWriter: ILogWriter,
|
|
36
36
|
testInterface: Partial<ITestInterface<ITestShape>>
|
|
37
|
+
// puppetMaster: PM
|
|
37
38
|
) {
|
|
38
39
|
const fullTestInterface = DefaultTestInterface(testInterface);
|
|
39
|
-
|
|
40
40
|
super(
|
|
41
41
|
testImplementation,
|
|
42
42
|
testSpecification,
|
|
43
43
|
input,
|
|
44
44
|
|
|
45
45
|
class extends BaseSuite<ITestShape> {
|
|
46
|
+
afterAll(store: IStore, artifactory: ITestArtifactory, pm: PM) {
|
|
47
|
+
// const pagesHandler = {
|
|
48
|
+
// get(target, prop) {
|
|
49
|
+
// console.log(`Getting pages property ${prop}`);
|
|
50
|
+
// return target[prop];
|
|
51
|
+
// },
|
|
52
|
+
// };
|
|
53
|
+
|
|
54
|
+
// const browserHandler = {
|
|
55
|
+
// get(target, prop) {
|
|
56
|
+
// console.log(`Getting browser property ${prop}`);
|
|
57
|
+
// if (prop === "pages") {
|
|
58
|
+
// // return target[prop];
|
|
59
|
+
// return new Proxy(target[prop], pagesHandler);
|
|
60
|
+
// } else {
|
|
61
|
+
// return target[prop];
|
|
62
|
+
// }
|
|
63
|
+
// },
|
|
64
|
+
// };
|
|
65
|
+
// const proxy = new Proxy(utils.browser, browserHandler);
|
|
66
|
+
|
|
67
|
+
return fullTestInterface.afterAll(
|
|
68
|
+
store,
|
|
69
|
+
(fPath: string, value: unknown) =>
|
|
70
|
+
// TODO does not work?
|
|
71
|
+
{
|
|
72
|
+
artifactory(`afterAll4-${this.name}/${fPath}`, value);
|
|
73
|
+
},
|
|
74
|
+
pm
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
46
78
|
assertThat(t) {
|
|
47
79
|
fullTestInterface.assertThis(t);
|
|
48
80
|
}
|
|
@@ -51,7 +83,7 @@ export default abstract class Testeranto<
|
|
|
51
83
|
s: ITestShape["iinput"],
|
|
52
84
|
artifactory: ITestArtifactory,
|
|
53
85
|
tr,
|
|
54
|
-
|
|
86
|
+
pm
|
|
55
87
|
): Promise<ITestShape["isubject"]> {
|
|
56
88
|
return (
|
|
57
89
|
fullTestInterface.beforeAll ||
|
|
@@ -59,14 +91,14 @@ export default abstract class Testeranto<
|
|
|
59
91
|
input: ITestShape["iinput"],
|
|
60
92
|
artifactory: ITestArtifactory,
|
|
61
93
|
tr,
|
|
62
|
-
|
|
94
|
+
pm: PM
|
|
63
95
|
) => input as any)
|
|
64
|
-
)(s, this.testResourceConfiguration, artifactory,
|
|
96
|
+
)(s, this.testResourceConfiguration, artifactory, pm);
|
|
65
97
|
}
|
|
66
98
|
} as any,
|
|
67
99
|
|
|
68
100
|
class Given extends BaseGiven<ITestShape> {
|
|
69
|
-
async givenThat(subject, testResource, artifactory, initializer) {
|
|
101
|
+
async givenThat(subject, testResource, artifactory, initializer, pm) {
|
|
70
102
|
return fullTestInterface.beforeEach(
|
|
71
103
|
subject,
|
|
72
104
|
initializer,
|
|
@@ -74,8 +106,8 @@ export default abstract class Testeranto<
|
|
|
74
106
|
// TODO does not work?
|
|
75
107
|
artifactory(`beforeEach/${fPath}`, value),
|
|
76
108
|
testResource,
|
|
77
|
-
this.initialValues
|
|
78
|
-
|
|
109
|
+
this.initialValues,
|
|
110
|
+
pm
|
|
79
111
|
);
|
|
80
112
|
}
|
|
81
113
|
|
|
@@ -83,7 +115,7 @@ export default abstract class Testeranto<
|
|
|
83
115
|
store: ITestShape["istore"],
|
|
84
116
|
key: string,
|
|
85
117
|
artifactory,
|
|
86
|
-
|
|
118
|
+
pm
|
|
87
119
|
): Promise<unknown> {
|
|
88
120
|
return new Promise((res) =>
|
|
89
121
|
res(
|
|
@@ -92,51 +124,21 @@ export default abstract class Testeranto<
|
|
|
92
124
|
key,
|
|
93
125
|
(fPath: string, value: unknown) =>
|
|
94
126
|
artifactory(`after/${fPath}`, value),
|
|
95
|
-
|
|
127
|
+
pm
|
|
96
128
|
)
|
|
97
129
|
)
|
|
98
130
|
);
|
|
99
131
|
}
|
|
100
|
-
afterAll(store: IStore, artifactory: ITestArtifactory, utils: IUtils) {
|
|
101
|
-
const pagesHandler = {
|
|
102
|
-
get(target, prop) {
|
|
103
|
-
console.log(`Getting pages property ${prop}`);
|
|
104
|
-
return target[prop];
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const browserHandler = {
|
|
109
|
-
get(target, prop) {
|
|
110
|
-
console.log(`Getting browser property ${prop}`);
|
|
111
|
-
if (prop === "pages") {
|
|
112
|
-
// return target[prop];
|
|
113
|
-
return new Proxy(target[prop], pagesHandler);
|
|
114
|
-
} else {
|
|
115
|
-
return target[prop];
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
const proxy = new Proxy(utils.browser, browserHandler);
|
|
120
|
-
|
|
121
|
-
return fullTestInterface.afterAll(
|
|
122
|
-
store,
|
|
123
|
-
(fPath: string, value: unknown) =>
|
|
124
|
-
// TODO does not work?
|
|
125
|
-
{
|
|
126
|
-
artifactory(`afterAll4-${this.name}/${fPath}`, value);
|
|
127
|
-
},
|
|
128
|
-
utils
|
|
129
|
-
// {
|
|
130
|
-
// ...utils,
|
|
131
|
-
// browser: proxy,
|
|
132
|
-
// }
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
132
|
} as any,
|
|
136
133
|
|
|
137
134
|
class When extends BaseWhen<ITestShape> {
|
|
138
|
-
async andWhen(store, whenCB, testResource) {
|
|
139
|
-
return await fullTestInterface.andWhen(
|
|
135
|
+
async andWhen(store, whenCB, testResource, pm) {
|
|
136
|
+
return await fullTestInterface.andWhen(
|
|
137
|
+
store,
|
|
138
|
+
whenCB,
|
|
139
|
+
testResource,
|
|
140
|
+
pm
|
|
141
|
+
);
|
|
140
142
|
}
|
|
141
143
|
} as any,
|
|
142
144
|
|
|
@@ -169,14 +171,15 @@ export default abstract class Testeranto<
|
|
|
169
171
|
this.initialValues = initialValues;
|
|
170
172
|
}
|
|
171
173
|
|
|
172
|
-
async checkThat(subject, testResourceConfiguration, artifactory) {
|
|
174
|
+
async checkThat(subject, testResourceConfiguration, artifactory, pm) {
|
|
173
175
|
return fullTestInterface.beforeEach(
|
|
174
176
|
subject,
|
|
175
177
|
this.initialValues,
|
|
176
178
|
(fPath: string, value: unknown) =>
|
|
177
179
|
artifactory(`before/${fPath}`, value),
|
|
178
180
|
testResourceConfiguration,
|
|
179
|
-
this.initialValues
|
|
181
|
+
this.initialValues,
|
|
182
|
+
pm
|
|
180
183
|
);
|
|
181
184
|
}
|
|
182
185
|
|
|
@@ -184,7 +187,7 @@ export default abstract class Testeranto<
|
|
|
184
187
|
store: ITestShape["istore"],
|
|
185
188
|
key: string,
|
|
186
189
|
artifactory,
|
|
187
|
-
|
|
190
|
+
pm
|
|
188
191
|
): Promise<unknown> {
|
|
189
192
|
return new Promise((res) =>
|
|
190
193
|
res(
|
|
@@ -194,21 +197,17 @@ export default abstract class Testeranto<
|
|
|
194
197
|
(fPath: string, value: unknown) =>
|
|
195
198
|
// TODO does not work?
|
|
196
199
|
artifactory(`afterEach2-${this.name}/${fPath}`, value),
|
|
197
|
-
|
|
200
|
+
pm
|
|
198
201
|
)
|
|
199
202
|
)
|
|
200
203
|
);
|
|
201
204
|
}
|
|
202
205
|
} as any,
|
|
203
206
|
|
|
204
|
-
testResourceRequirement
|
|
205
|
-
|
|
207
|
+
testResourceRequirement
|
|
208
|
+
// puppetMaster
|
|
206
209
|
);
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
abstract receiveTestResourceConfig(
|
|
210
|
-
t: ITestJob,
|
|
211
|
-
partialTestResource: ITTestResourceConfiguration,
|
|
212
|
-
utils: IUtils
|
|
213
|
-
);
|
|
212
|
+
abstract receiveTestResourceConfig(partialTestResource: string);
|
|
214
213
|
}
|
package/src/lib/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PM } from "../PM/index.js";
|
|
1
2
|
import { IBaseTest } from "../Types.js";
|
|
2
3
|
|
|
3
4
|
import {
|
|
@@ -7,15 +8,18 @@ import {
|
|
|
7
8
|
BaseWhen,
|
|
8
9
|
BaseThen,
|
|
9
10
|
} from "./abstractBase.js";
|
|
11
|
+
import { ITestInterface } from "./types.js";
|
|
10
12
|
|
|
11
|
-
import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
|
|
13
|
+
// import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
|
|
12
14
|
|
|
13
15
|
export const BaseTestInterface: ITestInterface<IBaseTest> = {
|
|
14
16
|
beforeAll: async (s) => s,
|
|
15
17
|
beforeEach: async function (
|
|
16
18
|
subject: any,
|
|
17
19
|
initialValues: any,
|
|
18
|
-
|
|
20
|
+
x: any,
|
|
21
|
+
testResource: any,
|
|
22
|
+
pm: PM
|
|
19
23
|
) {
|
|
20
24
|
return subject as any;
|
|
21
25
|
},
|
|
@@ -39,7 +43,7 @@ export type ITTestResourceConfiguration = {
|
|
|
39
43
|
name: string;
|
|
40
44
|
fs: string;
|
|
41
45
|
ports: number[];
|
|
42
|
-
|
|
46
|
+
browserWSEndpoint: string;
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
export type ITTestResourceRequirement = {
|
|
@@ -57,7 +61,7 @@ export type ITLog = (...string) => void;
|
|
|
57
61
|
export type ILogWriter = {
|
|
58
62
|
createWriteStream: (line: string) => any | any;
|
|
59
63
|
writeFileSync: (fp: string, contents: string) => any;
|
|
60
|
-
mkdirSync: (
|
|
64
|
+
mkdirSync: () => any;
|
|
61
65
|
testArtiFactoryfileWriter: (
|
|
62
66
|
tLog: ITLog,
|
|
63
67
|
n: (Promise) => void
|
|
@@ -74,7 +78,7 @@ type ITest = {
|
|
|
74
78
|
testResourceConfiguration: ITTestResourceConfiguration;
|
|
75
79
|
};
|
|
76
80
|
|
|
77
|
-
export type ITestJob<T =
|
|
81
|
+
export type ITestJob<T = PM> = {
|
|
78
82
|
toObj(): object;
|
|
79
83
|
test: ITest;
|
|
80
84
|
runner: (
|
|
@@ -82,10 +86,7 @@ export type ITestJob<T = INodeUtils | IWebUtils> = {
|
|
|
82
86
|
t: ITLog
|
|
83
87
|
) => Promise<BaseSuite<IBaseTest>>;
|
|
84
88
|
testResourceRequirement: ITTestResourceRequirement;
|
|
85
|
-
receiveTestResourceConfig: (
|
|
86
|
-
testResource,
|
|
87
|
-
utils: T
|
|
88
|
-
) => Promise<{
|
|
89
|
+
receiveTestResourceConfig: (pm: PM) => Promise<{
|
|
89
90
|
failed: number;
|
|
90
91
|
artifacts: Promise<unknown>[];
|
|
91
92
|
logPromise: Promise<unknown>;
|