2022-05-05 12:35:47 +00:00
|
|
|
// Imports
|
2022-05-05 20:30:24 +00:00
|
|
|
import { Worker } from "rabbiteer";
|
2022-07-12 02:44:44 +00:00
|
|
|
import evt from "../../sockets/events.js";
|
2022-05-05 12:35:47 +00:00
|
|
|
// Class
|
2022-05-05 20:30:24 +00:00
|
|
|
export default class TestResultsWorker extends Worker {
|
2022-07-12 02:44:44 +00:00
|
|
|
constructor(skio) {
|
2022-05-05 12:35:47 +00:00
|
|
|
super("TestResults");
|
2022-07-12 02:44:44 +00:00
|
|
|
this.skio = skio;
|
2022-05-05 12:35:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Example Test Result
|
|
|
|
{
|
|
|
|
testName: “SomeTest”,
|
|
|
|
testClass: “SomeClass”,
|
|
|
|
testMethod: “SomeMethod”,
|
|
|
|
testType: “API/UI”,
|
|
|
|
testTimestamp: 123893024,
|
|
|
|
origin: “TestSuite”,
|
|
|
|
failed: true,
|
|
|
|
failedMessage: “Some Failure”,
|
|
|
|
screenshotUrl: “https://screenshot”,
|
|
|
|
expectedScreenshotUrl: “https://expected”
|
|
|
|
consoleLogUrl: “https://consolelog”
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
onMessage(testResult) {
|
2022-07-12 02:44:44 +00:00
|
|
|
const { pipelineData, pipelineTriggers, pipelineDelay } = testResult;
|
|
|
|
const pipelineTrigger = { pipelineData, pipelineTriggers, pipelineDelay };
|
|
|
|
// Alter to start next test
|
|
|
|
// TODO the delay should be autopopulated either by the suite, or filled in by the server
|
|
|
|
if (pipelineTriggers)
|
|
|
|
return this.pipelineTrigger(
|
|
|
|
pipelineTrigger,
|
|
|
|
testResult.pipelineDashboardSocket
|
|
|
|
);
|
|
|
|
this.pipelineClose(testResult.pipelineDashboardSocket);
|
|
|
|
}
|
|
|
|
|
|
|
|
pipelineTrigger(pipelineTrigger, socketId) {
|
|
|
|
pipelineTrigger.pipelineDelay = 1000 * 5;
|
|
|
|
this.skio.to(socketId).emit(evt.PPL_TRG, pipelineTrigger);
|
|
|
|
}
|
|
|
|
|
|
|
|
pipelineClose(socketId) {
|
|
|
|
this.skio.to(socketId).emit(evt.PPL_CLS);
|
2022-05-05 12:35:47 +00:00
|
|
|
}
|
|
|
|
}
|