testeranto 0.73.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/dist/common/Node.js +1 -8
- package/dist/common/PM/main.js +65 -56
- package/dist/common/PM/node.js +4 -96
- package/dist/common/PM/web.js +8 -53
- package/dist/common/SubPackages/react/jsx/index.js +14 -2
- package/dist/common/Web.js +0 -1
- package/dist/common/lib/abstractBase.js +1 -1
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +1 -8
- package/dist/module/PM/main.js +65 -56
- package/dist/module/PM/node.js +3 -94
- package/dist/module/PM/web.js +8 -53
- package/dist/module/SubPackages/react/jsx/index.js +11 -2
- package/dist/module/Web.js +0 -1
- package/dist/module/lib/abstractBase.js +1 -1
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.js +2 -2
- package/dist/types/PM/main.d.ts +0 -2
- package/dist/types/PM/node.d.ts +0 -1
- package/dist/types/SubPackages/react/jsx/index.d.ts +2 -5
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Node.ts +1 -15
- package/src/PM/main.ts +119 -87
- package/src/PM/node.ts +10 -403
- package/src/PM/web.ts +20 -355
- package/src/Report.tsx +2 -2
- package/src/SubPackages/react/jsx/index.ts +13 -3
- package/src/Web.ts +0 -2
- package/src/lib/abstractBase.ts +1 -1
package/dist/common/Node.js
CHANGED
|
@@ -10,18 +10,11 @@ class NodeTesteranto extends core_js_1.default {
|
|
|
10
10
|
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
11
11
|
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
12
12
|
}
|
|
13
|
-
async receiveTestResourceConfig(
|
|
14
|
-
// t: ITestJob,
|
|
15
|
-
partialTestResource) {
|
|
16
|
-
console.log("receiveTestResourceConfig!!", this.testJobs[0].receiveTestResourceConfig);
|
|
13
|
+
async receiveTestResourceConfig(partialTestResource) {
|
|
17
14
|
const t = JSON.parse(partialTestResource);
|
|
18
15
|
const pm = new node_js_1.PM_Node(t);
|
|
19
16
|
const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
20
|
-
console.log("test is done, awaiting test result write to fs");
|
|
21
17
|
pm.customclose();
|
|
22
|
-
// Promise.all([...artifacts, logPromise]).then(async () => {
|
|
23
|
-
// // process.exit((await failed) ? 1 : 0);
|
|
24
|
-
// });
|
|
25
18
|
}
|
|
26
19
|
}
|
|
27
20
|
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
package/dist/common/PM/main.js
CHANGED
|
@@ -33,17 +33,13 @@ const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
|
33
33
|
const index_js_1 = require("./index.js");
|
|
34
34
|
const fPaths = [];
|
|
35
35
|
const fileStreams3 = [];
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const files = {}; // = new Set<string>();
|
|
37
|
+
const screenshots = {};
|
|
38
38
|
class PM_Main extends index_js_1.PM {
|
|
39
|
-
|
|
40
|
-
constructor(configs
|
|
41
|
-
// testResourceConfig: ITTestResourceConfiguration
|
|
42
|
-
) {
|
|
39
|
+
constructor(configs) {
|
|
43
40
|
super();
|
|
44
41
|
this.launchNode = async (src, dest) => {
|
|
45
42
|
console.log("launchNode", src);
|
|
46
|
-
// childProcesses[src] = "running";
|
|
47
43
|
const destFolder = dest.replace(".mjs", "");
|
|
48
44
|
let argz = "";
|
|
49
45
|
const testConfig = this.configs.tests.find((t) => {
|
|
@@ -54,7 +50,6 @@ class PM_Main extends index_js_1.PM {
|
|
|
54
50
|
process.exit(-1);
|
|
55
51
|
}
|
|
56
52
|
const testConfigResource = testConfig[2];
|
|
57
|
-
console.log("mark22 testConfigResource", testConfigResource);
|
|
58
53
|
let portsToUse = [];
|
|
59
54
|
if (testConfigResource.ports === 0) {
|
|
60
55
|
argz = JSON.stringify({
|
|
@@ -110,8 +105,6 @@ class PM_Main extends index_js_1.PM {
|
|
|
110
105
|
};
|
|
111
106
|
this.launchWeb = (t, dest) => {
|
|
112
107
|
console.log("launchWeb", t, dest);
|
|
113
|
-
const testResourceConfiguration = this.testResourceConfiguration;
|
|
114
|
-
// childProcesses[t] = "running";
|
|
115
108
|
const destFolder = dest.replace(".mjs", "");
|
|
116
109
|
const webArgz = JSON.stringify({
|
|
117
110
|
name: dest,
|
|
@@ -128,54 +121,49 @@ class PM_Main extends index_js_1.PM {
|
|
|
128
121
|
}
|
|
129
122
|
})`;
|
|
130
123
|
const fileStreams2 = [];
|
|
131
|
-
const screenshots2 = [];
|
|
124
|
+
// const screenshots2: Promise<any>[] = [];
|
|
132
125
|
const doneFileStream2 = [];
|
|
133
126
|
this.browser
|
|
134
127
|
.newPage()
|
|
135
128
|
.then((page) => {
|
|
136
|
-
page.exposeFunction("custom-screenshot", async (ssOpts) => {
|
|
129
|
+
page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
|
|
130
|
+
console.log("main.ts browser custom-screenshot", testName);
|
|
137
131
|
const p = ssOpts.path;
|
|
138
|
-
console.log("custom-screenshot", ssOpts);
|
|
139
132
|
const dir = path_1.default.dirname(p);
|
|
140
|
-
console.log("dir", dir);
|
|
141
133
|
fs_1.default.mkdirSync(dir, {
|
|
142
134
|
recursive: true,
|
|
143
135
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// )
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
// path: p,
|
|
154
|
-
// });
|
|
155
|
-
// await sPromise;
|
|
136
|
+
files[testName].add(ssOpts.path);
|
|
137
|
+
const sPromise = page.screenshot(Object.assign(Object.assign({}, ssOpts), { path: p }));
|
|
138
|
+
if (!screenshots[testName]) {
|
|
139
|
+
screenshots[testName] = [];
|
|
140
|
+
}
|
|
141
|
+
screenshots[testName].push(sPromise);
|
|
142
|
+
// sPromise.then(())
|
|
143
|
+
await sPromise;
|
|
144
|
+
return sPromise;
|
|
156
145
|
// page.evaluate(`window["screenshot done"]`);
|
|
157
146
|
});
|
|
158
|
-
page.exposeFunction("writeFileSync", (fp, contents) => {
|
|
159
|
-
console.log("writeFileSync", fp);
|
|
160
|
-
// Create directories if they don't exist
|
|
147
|
+
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
161
148
|
const dir = path_1.default.dirname(fp);
|
|
162
|
-
console.log("dir", dir);
|
|
163
149
|
fs_1.default.mkdirSync(dir, {
|
|
164
150
|
recursive: true,
|
|
165
151
|
});
|
|
166
|
-
// return fs.writeFileSync(fp, contents);
|
|
167
152
|
const p = new Promise(async (res, rej) => {
|
|
168
153
|
fs_1.default.writeFileSync(fp, contents);
|
|
169
154
|
res(fp);
|
|
170
155
|
});
|
|
171
156
|
doneFileStream2.push(p);
|
|
157
|
+
if (!files[testName]) {
|
|
158
|
+
files[testName] = new Set();
|
|
159
|
+
}
|
|
160
|
+
files[testName].add(fp);
|
|
172
161
|
return p;
|
|
173
162
|
});
|
|
174
163
|
page.exposeFunction("existsSync", (fp, contents) => {
|
|
175
164
|
return fs_1.default.existsSync(fp);
|
|
176
165
|
});
|
|
177
166
|
page.exposeFunction("mkdirSync", (fp) => {
|
|
178
|
-
console.log("mkdirsync", fp);
|
|
179
167
|
if (!fs_1.default.existsSync(fp)) {
|
|
180
168
|
return fs_1.default.mkdirSync(fp, {
|
|
181
169
|
recursive: true,
|
|
@@ -183,8 +171,12 @@ class PM_Main extends index_js_1.PM {
|
|
|
183
171
|
}
|
|
184
172
|
return false;
|
|
185
173
|
});
|
|
186
|
-
page.exposeFunction("createWriteStream", (fp) => {
|
|
174
|
+
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
187
175
|
const f = fs_1.default.createWriteStream(fp);
|
|
176
|
+
if (!files[testName]) {
|
|
177
|
+
files[testName] = new Set();
|
|
178
|
+
}
|
|
179
|
+
files[testName].add(fp);
|
|
188
180
|
const p = new Promise((res, rej) => {
|
|
189
181
|
res(fp);
|
|
190
182
|
});
|
|
@@ -201,13 +193,23 @@ class PM_Main extends index_js_1.PM {
|
|
|
201
193
|
page.exposeFunction("end", async (uid) => {
|
|
202
194
|
return fileStreams2[uid].end();
|
|
203
195
|
});
|
|
204
|
-
page.exposeFunction("customclose", () => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Promise.all([
|
|
196
|
+
page.exposeFunction("customclose", (p, testName) => {
|
|
197
|
+
fs_1.default.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
|
|
198
|
+
delete files[testName];
|
|
199
|
+
Promise.all(screenshots[testName] || []).then(() => {
|
|
200
|
+
delete screenshots[testName];
|
|
208
201
|
page.close();
|
|
209
202
|
});
|
|
210
|
-
//
|
|
203
|
+
// globalThis["writeFileSync"](
|
|
204
|
+
// p + "/manifest.json",
|
|
205
|
+
// // files.entries()
|
|
206
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
207
|
+
// );
|
|
208
|
+
// console.log("closing doneFileStream2", doneFileStream2);
|
|
209
|
+
// console.log("closing doneFileStream2", doneFileStream2);
|
|
210
|
+
// Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
|
|
211
|
+
// page.close();
|
|
212
|
+
// });
|
|
211
213
|
// Promise.all(screenshots).then(() => {
|
|
212
214
|
// page.close();
|
|
213
215
|
// });
|
|
@@ -220,22 +222,13 @@ class PM_Main extends index_js_1.PM {
|
|
|
220
222
|
return page;
|
|
221
223
|
})
|
|
222
224
|
.then(async (page) => {
|
|
223
|
-
await page.goto(`file://${`${dest}.html`}`, {
|
|
224
|
-
// waitUntil: "load",
|
|
225
|
-
// timeout: 0,
|
|
226
|
-
});
|
|
225
|
+
await page.goto(`file://${`${dest}.html`}`, {});
|
|
227
226
|
page.evaluate(evaluation).finally(() => {
|
|
228
227
|
console.log("evaluation failed.", dest);
|
|
229
228
|
});
|
|
230
229
|
return page;
|
|
231
|
-
})
|
|
232
|
-
.then((page) => {
|
|
233
|
-
// console.log("qwe", page);
|
|
234
|
-
// page.close();
|
|
235
230
|
});
|
|
236
231
|
};
|
|
237
|
-
// this.testResourceConfiguration = testResourceConfig;
|
|
238
|
-
// console.log("mkdirsync4", testResourceConfig);
|
|
239
232
|
this.server = {};
|
|
240
233
|
this.configs = configs;
|
|
241
234
|
this.ports = {};
|
|
@@ -250,29 +243,45 @@ class PM_Main extends index_js_1.PM {
|
|
|
250
243
|
}
|
|
251
244
|
return false;
|
|
252
245
|
};
|
|
253
|
-
globalThis["writeFileSync"] = (
|
|
246
|
+
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
254
247
|
// Create directories if they don't exist
|
|
255
|
-
const dir = path_1.default.dirname(
|
|
256
|
-
console.log("dir", dir);
|
|
248
|
+
const dir = path_1.default.dirname(filepath.split("/").slice(0, -1).join("/"));
|
|
257
249
|
fs_1.default.mkdirSync(dir, {
|
|
258
250
|
recursive: true,
|
|
259
251
|
});
|
|
260
|
-
|
|
252
|
+
if (!files[testName]) {
|
|
253
|
+
files[testName] = new Set();
|
|
254
|
+
}
|
|
255
|
+
files[testName].add(filepath);
|
|
256
|
+
return fs_1.default.writeFileSync(filepath, contents);
|
|
261
257
|
};
|
|
262
|
-
globalThis["createWriteStream"] = (filepath) => {
|
|
258
|
+
globalThis["createWriteStream"] = (filepath, testName) => {
|
|
263
259
|
const f = fs_1.default.createWriteStream(filepath);
|
|
264
260
|
fileStreams3.push(f);
|
|
261
|
+
// files.add(filepath);
|
|
262
|
+
if (!files[testName]) {
|
|
263
|
+
files[testName] = new Set();
|
|
264
|
+
}
|
|
265
|
+
files[testName].add(filepath);
|
|
265
266
|
return Object.assign(Object.assign({}, JSON.parse(JSON.stringify(f))), { uid: fileStreams3.length - 1 });
|
|
266
267
|
};
|
|
267
268
|
globalThis["write"] = (uid, contents) => {
|
|
268
|
-
console.log("write", uid, contents);
|
|
269
|
-
// process.exit();
|
|
270
269
|
fileStreams3[uid].write(contents);
|
|
271
270
|
};
|
|
272
271
|
globalThis["end"] = (uid) => {
|
|
273
272
|
fileStreams3[uid].end();
|
|
274
273
|
};
|
|
275
|
-
globalThis["customclose"] = () => {
|
|
274
|
+
globalThis["customclose"] = (p, testName) => {
|
|
275
|
+
if (!files[testName]) {
|
|
276
|
+
files[testName] = new Set();
|
|
277
|
+
}
|
|
278
|
+
fs_1.default.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
|
|
279
|
+
delete files[testName];
|
|
280
|
+
// globalThis["writeFileSync"](
|
|
281
|
+
// p + "/manifest.json",
|
|
282
|
+
// // files.entries()
|
|
283
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
284
|
+
// );
|
|
276
285
|
// fileStreams3[uid].end();
|
|
277
286
|
};
|
|
278
287
|
// page.exposeFunction("customclose", () => {
|
package/dist/common/PM/node.js
CHANGED
|
@@ -3,59 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PM_Node =
|
|
7
|
-
// import puppeteer from "puppeteer";
|
|
6
|
+
exports.PM_Node = void 0;
|
|
8
7
|
const fs_1 = __importDefault(require("fs"));
|
|
9
8
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
// import puppeteer from "puppeteer-core/lib/esm/puppeteer/puppeteer-core";
|
|
11
9
|
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
12
10
|
const index_js_1 = require("./index.js");
|
|
13
11
|
const fPaths = [];
|
|
14
|
-
function addPageBinding(type, name, prefix) {
|
|
15
|
-
// Depending on the frame loading state either Runtime.evaluate or
|
|
16
|
-
// Page.addScriptToEvaluateOnNewDocument might succeed. Let's check that we
|
|
17
|
-
// don't re-wrap Puppeteer's binding.
|
|
18
|
-
if (globalThis[name]) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
// We replace the CDP binding with a Puppeteer binding.
|
|
22
|
-
Object.assign(globalThis, {
|
|
23
|
-
[name](...args) {
|
|
24
|
-
var _a, _b, _c;
|
|
25
|
-
// This is the Puppeteer binding.
|
|
26
|
-
const callPuppeteer = globalThis[name];
|
|
27
|
-
(_a = callPuppeteer.args) !== null && _a !== void 0 ? _a : (callPuppeteer.args = new Map());
|
|
28
|
-
(_b = callPuppeteer.callbacks) !== null && _b !== void 0 ? _b : (callPuppeteer.callbacks = new Map());
|
|
29
|
-
const seq = ((_c = callPuppeteer.lastSeq) !== null && _c !== void 0 ? _c : 0) + 1;
|
|
30
|
-
callPuppeteer.lastSeq = seq;
|
|
31
|
-
callPuppeteer.args.set(seq, args);
|
|
32
|
-
// Needs to be the same as CDP_BINDING_PREFIX.
|
|
33
|
-
globalThis[prefix + name](JSON.stringify({
|
|
34
|
-
type,
|
|
35
|
-
name,
|
|
36
|
-
seq,
|
|
37
|
-
args,
|
|
38
|
-
isTrivial: !args.some((value) => {
|
|
39
|
-
return value instanceof Node;
|
|
40
|
-
}),
|
|
41
|
-
}));
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
callPuppeteer.callbacks.set(seq, {
|
|
44
|
-
resolve(value) {
|
|
45
|
-
callPuppeteer.args.delete(seq);
|
|
46
|
-
resolve(value);
|
|
47
|
-
},
|
|
48
|
-
reject(value) {
|
|
49
|
-
callPuppeteer.args.delete(seq);
|
|
50
|
-
reject(value);
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.addPageBinding = addPageBinding;
|
|
58
|
-
const files = new Set();
|
|
59
12
|
class PM_Node extends index_js_1.PM {
|
|
60
13
|
constructor(t) {
|
|
61
14
|
super();
|
|
@@ -72,44 +25,17 @@ class PM_Node extends index_js_1.PM {
|
|
|
72
25
|
return globalThis["write"](writeObject.uid, contents);
|
|
73
26
|
}
|
|
74
27
|
writeFileSync(filepath, contents) {
|
|
75
|
-
|
|
76
|
-
return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents);
|
|
28
|
+
return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
77
29
|
}
|
|
78
30
|
createWriteStream(filepath) {
|
|
79
|
-
|
|
80
|
-
return globalThis["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath);
|
|
31
|
+
return globalThis["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
|
|
81
32
|
}
|
|
82
33
|
end(writeObject) {
|
|
83
34
|
return globalThis["end"](writeObject.uid);
|
|
84
35
|
}
|
|
85
36
|
customclose() {
|
|
86
|
-
|
|
87
|
-
// globalThis["writeFileSync"](
|
|
88
|
-
// this.testResourceConfiguration.fs + "/manifest.json",
|
|
89
|
-
// // files.entries()
|
|
90
|
-
// JSON.stringify(Array.from(files))
|
|
91
|
-
// ).then(() => {
|
|
92
|
-
// globalThis["customclose"]();
|
|
93
|
-
// });
|
|
37
|
+
globalThis["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
|
|
94
38
|
}
|
|
95
|
-
// write(accessObject: { uid: number; }, contents: string): boolean {
|
|
96
|
-
// throw new Error("Method not implemented.");
|
|
97
|
-
// }
|
|
98
|
-
// existsSync(destFolder: string): boolean {
|
|
99
|
-
// return fs.existsSync(destFolder);
|
|
100
|
-
// }
|
|
101
|
-
// async mkdirSync(destFolder: string) {
|
|
102
|
-
// if (!fs.existsSync(destFolder)) {
|
|
103
|
-
// return fs.mkdirSync(destFolder, { recursive: true });
|
|
104
|
-
// }
|
|
105
|
-
// return false;
|
|
106
|
-
// }
|
|
107
|
-
// writeFileSync(fp: string, contents: string) {
|
|
108
|
-
// fs.writeFileSync(fp, contents);
|
|
109
|
-
// }
|
|
110
|
-
// createWriteStream(filepath: string): fs.WriteStream {
|
|
111
|
-
// return fs.createWriteStream(filepath);
|
|
112
|
-
// }
|
|
113
39
|
testArtiFactoryfileWriter(tLog, callback) {
|
|
114
40
|
return (fPath, value) => {
|
|
115
41
|
callback(new Promise((res, rej) => {
|
|
@@ -150,27 +76,9 @@ class PM_Node extends index_js_1.PM {
|
|
|
150
76
|
}
|
|
151
77
|
// launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
|
|
152
78
|
startPuppeteer(options) {
|
|
153
|
-
console.log("start1");
|
|
154
79
|
return puppeteer_core_1.default.connect(options).then((b) => {
|
|
155
80
|
this.browser = b;
|
|
156
81
|
});
|
|
157
|
-
// return new Promise<Browser>((res, rej) => {
|
|
158
|
-
// // this.browser = await puppeteer.connect(options);
|
|
159
|
-
// // console.log("start2", this.browser);
|
|
160
|
-
// // console.log("mark5", this.browser);
|
|
161
|
-
// // res(this.browser);
|
|
162
|
-
// });
|
|
163
82
|
}
|
|
164
83
|
}
|
|
165
84
|
exports.PM_Node = PM_Node;
|
|
166
|
-
// class PuppetMasterServer extends AbstractPuppetMaster {
|
|
167
|
-
// // constructor(...z: []) {
|
|
168
|
-
// // super(...z);
|
|
169
|
-
// // }
|
|
170
|
-
// // // pages(): Promise<Page[]>;
|
|
171
|
-
// // pages(): Promise<Page[]> {
|
|
172
|
-
// // return new Promise<Page[]>((res, rej) => {
|
|
173
|
-
// // res(super.pages());
|
|
174
|
-
// // });
|
|
175
|
-
// // }
|
|
176
|
-
// }
|
package/dist/common/PM/web.js
CHANGED
|
@@ -4,20 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PM_Web = void 0;
|
|
7
|
-
const index_js_1 = require("./index.js");
|
|
8
7
|
const puppeteer_core_browser_js_1 = __importDefault(require("puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js"));
|
|
9
|
-
|
|
10
|
-
return new Promise((resolve) => {
|
|
11
|
-
window["myFunction"] = () => {
|
|
12
|
-
// Do something when myFunction is called
|
|
13
|
-
console.log("myFunction was called!");
|
|
14
|
-
resolve(); // Resolve the promise
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const files = new Set();
|
|
8
|
+
const index_js_1 = require("./index.js");
|
|
19
9
|
class PM_Web extends index_js_1.PM {
|
|
20
|
-
// testResourceConfiguration: ITTestResourceConfiguration;
|
|
21
10
|
constructor(t) {
|
|
22
11
|
super();
|
|
23
12
|
this.server = {};
|
|
@@ -33,23 +22,16 @@ class PM_Web extends index_js_1.PM {
|
|
|
33
22
|
return window["write"](writeObject.uid, contents);
|
|
34
23
|
}
|
|
35
24
|
writeFileSync(filepath, contents) {
|
|
36
|
-
|
|
37
|
-
files.add(filepath);
|
|
38
|
-
return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents);
|
|
25
|
+
return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
39
26
|
}
|
|
40
27
|
createWriteStream(filepath) {
|
|
41
|
-
|
|
42
|
-
return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath);
|
|
28
|
+
return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
|
|
43
29
|
}
|
|
44
30
|
end(writeObject) {
|
|
45
31
|
return window["end"](writeObject.uid);
|
|
46
32
|
}
|
|
47
33
|
customclose() {
|
|
48
|
-
window["
|
|
49
|
-
// files.entries()
|
|
50
|
-
JSON.stringify(Array.from(files))).then(() => {
|
|
51
|
-
window["customclose"]();
|
|
52
|
-
});
|
|
34
|
+
window["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
|
|
53
35
|
}
|
|
54
36
|
testArtiFactoryfileWriter(tLog, callback) {
|
|
55
37
|
return (fPath, value) => {
|
|
@@ -95,12 +77,12 @@ class PM_Web extends index_js_1.PM {
|
|
|
95
77
|
};
|
|
96
78
|
}
|
|
97
79
|
startPuppeteer(options, destFolder) {
|
|
80
|
+
const name = this.testResourceConfiguration.name;
|
|
98
81
|
return fetch(`http://localhost:3234/json/version`)
|
|
99
82
|
.then((v) => {
|
|
100
83
|
return v.json();
|
|
101
84
|
})
|
|
102
85
|
.then((json) => {
|
|
103
|
-
console.log("found endpoint", json.webSocketDebuggerUrl);
|
|
104
86
|
return puppeteer_core_browser_js_1.default
|
|
105
87
|
.connect({
|
|
106
88
|
browserWSEndpoint: json.webSocketDebuggerUrl,
|
|
@@ -111,10 +93,9 @@ class PM_Web extends index_js_1.PM {
|
|
|
111
93
|
get(target, prop, receiver) {
|
|
112
94
|
if (prop === "screenshot") {
|
|
113
95
|
return async (x) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return await window["custom-screenshot"](Object.assign(Object.assign({}, x), { path: destFolder + "/" + x.path }));
|
|
96
|
+
return await window["custom-screenshot"](Object.assign(Object.assign({}, x), {
|
|
97
|
+
// path: destFolder + "/" + x.path,
|
|
98
|
+
path: x.path }), name);
|
|
118
99
|
};
|
|
119
100
|
}
|
|
120
101
|
else if (prop === "mainFrame") {
|
|
@@ -143,32 +124,6 @@ class PM_Web extends index_js_1.PM {
|
|
|
143
124
|
this.browser = proxy3;
|
|
144
125
|
});
|
|
145
126
|
});
|
|
146
|
-
// console.log("connecting to ws://localhost:3234/devtools/browser/RANDOM");
|
|
147
|
-
// return puppeteer
|
|
148
|
-
// .connect({
|
|
149
|
-
// ...options,
|
|
150
|
-
// })
|
|
151
|
-
// .finally(() => {
|
|
152
|
-
// console.log("idk");
|
|
153
|
-
// });
|
|
154
|
-
// return new Promise<Browser>(async (res, rej) => {
|
|
155
|
-
// console.log("connecting with options", options);
|
|
156
|
-
// this.browser = await puppeteer.connect({
|
|
157
|
-
// ...options,
|
|
158
|
-
// });
|
|
159
|
-
// res(this.browser);
|
|
160
|
-
// });
|
|
161
127
|
}
|
|
162
128
|
}
|
|
163
129
|
exports.PM_Web = PM_Web;
|
|
164
|
-
// class PuppetMasterServer extends AbstractPuppetMaster {
|
|
165
|
-
// // constructor(...z: []) {
|
|
166
|
-
// // super(...z);
|
|
167
|
-
// // }
|
|
168
|
-
// // // pages(): Promise<Page[]>;
|
|
169
|
-
// // pages(): Promise<Page[]> {
|
|
170
|
-
// // return new Promise<Page[]>((res, rej) => {
|
|
171
|
-
// // res(super.pages());
|
|
172
|
-
// // });
|
|
173
|
-
// // }
|
|
174
|
-
// }
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.testInterface = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
4
8
|
exports.testInterface = {
|
|
5
|
-
|
|
9
|
+
// beforeAll: async (proto, testResource, artificer, pm): Promise<IStore> => {
|
|
10
|
+
// return React.createElement(proto);
|
|
11
|
+
// // return new Promise((resolve, rej) => {
|
|
12
|
+
// // resolve(x());
|
|
13
|
+
// // });
|
|
14
|
+
// },
|
|
15
|
+
beforeEach: async (subject, initializer, artificer) => {
|
|
6
16
|
return new Promise((resolve, rej) => {
|
|
7
|
-
|
|
17
|
+
const x = react_1.default.createElement(subject);
|
|
18
|
+
console.log("react-element", x);
|
|
19
|
+
resolve(x);
|
|
8
20
|
});
|
|
9
21
|
},
|
|
10
22
|
andWhen: function (s, whenCB) {
|
package/dist/common/Web.js
CHANGED
|
@@ -14,7 +14,6 @@ class WebTesteranto extends core_js_1.default {
|
|
|
14
14
|
const t = partialTestResource; //JSON.parse(partialTestResource);
|
|
15
15
|
const pm = new web_1.PM_Web(t);
|
|
16
16
|
const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
17
|
-
console.log("test is done, awaiting test result write to fs");
|
|
18
17
|
pm.customclose();
|
|
19
18
|
// Promise.all([...artifacts, logPromise]).then(async () => {
|
|
20
19
|
// console.log("hello world");
|
|
@@ -218,7 +218,7 @@ class BaseGiven {
|
|
|
218
218
|
// "custom-screenshot-MARK-afterEachProxy",
|
|
219
219
|
// window["custom-screenshot"].toString()
|
|
220
220
|
// );
|
|
221
|
-
return await
|
|
221
|
+
return await pTarget[pProp](Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
222
222
|
"/" +
|
|
223
223
|
x.path }));
|
|
224
224
|
};
|