MCPcopy Create free account
hub / github.com/DHTMLX/gantt / runSmoke

Function runSmoke

scripts/test.js:48–79  ·  view source on GitHub ↗
(browser, state)

Source from the content-addressed store, hash-verified

46}
47
48async function runSmoke(browser, state) {
49 while (state.index < state.files.length) {
50 const file = state.files[state.index];
51 state.index += 1;
52
53 const errors = [];
54 const page = await browser.newPage();
55 await page.setViewport({ width: 1280, height: 900 });
56 page.on("pageerror", (e) => errors.push("pageerror: " + e.message));
57 page.on("console", (msg) => {
58 if (msg.type() === "error") {
59 errors.push("console.error: " + msg.text());
60 }
61 });
62 try {
63 await page.goto("http://127.0.0.1:9200/samples/" + relSample(file), { waitUntil: "networkidle2", timeout: 30000 });
64 await new Promise(r => setTimeout(r, 250));
65 } catch (e) {
66 errors.push("navigation: " + e.message);
67 }
68 await page.close();
69
70 if (errors.length) {
71 state.status = false;
72 state.failed.push(file);
73 console.log(chalk.red("[smoke] " + relSample(file)));
74 errors.forEach(e => console.log(chalk.red(" " + e)));
75 } else {
76 console.log("[smoke] " + relSample(file));
77 }
78 }
79}
80
81async function main() {
82 const start = new Date();

Callers 1

mainFunction · 0.85

Calls 4

relSampleFunction · 0.85
setViewportMethod · 0.65
closeMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected