Add data collection mechanism in end to end test suite
This commit is contained in:
parent
6804a26e74
commit
89832eff9e
6 changed files with 42 additions and 13 deletions
|
@ -22,7 +22,7 @@ const fs = require("fs");
|
|||
const program = require('commander');
|
||||
program
|
||||
.option('--no-logs', "don't output logs, document html on error", false)
|
||||
.option('--app-url [url]', "url to test", "http://localhost:5000")
|
||||
.option('--app-url [url]', "url to test", "http://localhost:8080")
|
||||
.option('--windowed', "dont run tests headless", false)
|
||||
.option('--slow-mo', "type at a human speed", false)
|
||||
.option('--dev-tools', "open chrome devtools in browser window", false)
|
||||
|
@ -79,8 +79,26 @@ async function runTests() {
|
|||
await new Promise((resolve) => setTimeout(resolve, 5 * 60 * 1000));
|
||||
}
|
||||
|
||||
await Promise.all(sessions.map((session) => session.close()));
|
||||
const performanceEntries = {};
|
||||
|
||||
await Promise.all(sessions.map(async (session) => {
|
||||
// Collecting all performance monitoring data before closing the session
|
||||
const measurements = await session.page.evaluate(() => {
|
||||
let measurements = [];
|
||||
window.mxPerformanceMonitor.addPerformanceDataCallback({
|
||||
entryNames: [
|
||||
window.mxPerformanceEntryNames.REGISTER,
|
||||
],
|
||||
callback: (events) => {
|
||||
measurements = JSON.stringify(events);
|
||||
},
|
||||
}, true);
|
||||
return measurements;
|
||||
});
|
||||
performanceEntries[session.username] = JSON.parse(measurements);
|
||||
return session.close();
|
||||
}));
|
||||
fs.writeFileSync(`performance-entries.json`, JSON.stringify(performanceEntries));
|
||||
if (failure) {
|
||||
process.exit(-1);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue