Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wdio-timeline-reporter

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wdio-timeline-reporter - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

83

lib/timeline-reporter.js

@@ -7,3 +7,2 @@ const events = require('events');

const round = { round: true };

@@ -53,2 +52,17 @@

}
details {
color: #FF3860;
border-radius: 4px;
padding: .5em .5em 0;
}
summary {
font-weight: bold;
font-size: 1rem;
}
table {
text-overflow: elipsis;
}
</style>

@@ -268,2 +282,4 @@ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">

this.on('timeline:addContext', this.addSomeContext);
this.on('end', function (runner) {

@@ -297,3 +313,3 @@ const embedImage = (this.config.reporterOptions

for (let testId of Object.keys(suiteInfo.tests)) {
const { state, title, screenshots, error, _duration, start, end } = suiteInfo.tests[testId];
const { state, title, screenshots, error, _duration, start, end, context } = suiteInfo.tests[testId];

@@ -321,7 +337,10 @@ const imagesHtml = screenshots.reduce((accumulator, currentValue) => {

errorHtml = `
<table class="table is-striped" border="10" bordercolor="#FF3860">
${!!type ? `<tr><td>Type:</td><td>${type}</td></tr>` : ``}
${!!message ? `<tr><td>Message:</td><td>${message.replace(/<|>/g, '')}</td></tr>` : ``}
${!!stack ? `<tr><td>Stack:</td><td>${stack.replace(/<|>/g, '')}</td></tr>` : ``}
</table>
<details>
<summary>ERROR LOG</summary>
<table class="table is-striped">
${!!type ? `<tr><td>Type:</td><td>${type}</td></tr>` : ``}
${!!message ? `<tr><td>Message:</td><td>${message.replace(/<|>/g, '')}</td></tr>` : ``}
${!!stack ? `<tr><td>Stack:</td><td>${stack.replace(/<|>/g, '')}</td></tr>` : ``}
</table>
</details>
`;

@@ -340,2 +359,3 @@ }

<table class="table is-striped is-fullwidth is-bordered">
<tr><td>Browser:</td><td>${this.baseReporter.stats.runners[cid].capabilities.browserName}</td></tr>
<tr><td>Duration:</td><td>${humanizeDuration(_duration, round)}</td></tr>

@@ -347,9 +367,10 @@ <tr><td>Start:</td><td>${start}</td></tr>

</div>
<div class="${screenshotDivClass}${pendingPostFix}">
<div class="tile ${screenshotDivClass}${pendingPostFix}">
<div class="screenshots-scroll-container${pendingPostFix}">
${isPending ? `<div class="notification is-warning">Skipped</div>` : ``}
${imagesHtml}
${isPending ? `<article class="notification is-warning"><p class="subtitle">Skipped</p></article>` : ``}
${imagesHtml}
</div>
</div>
${errorHtml}
${!!context ? `${this.makeContextHtml(context)}` : ''}
</div>

@@ -405,4 +426,46 @@ `;

}
makeContextHtml(context) {
const makeHtml = (item) => {
if (typeof item === 'string') {
return `<tr><td></td><td>${item}</td></tr>`
} else if (typeof item === 'object') {
return `</tr><td>${item.title}:</td><td>${item.value}</td></tr>`;
}
return '';
}
const markup = context.map(makeHtml);
const html = `${!!markup ? `<details><summary>ADDITIONAL CONTEXT</summary><table class=table is-bordered is-striped>${markup.join('')}</table></details>` : '' }`;
return html;
}
getCurrentTest(cid) {
const stats = this.baseReporter.stats;
const results = stats.runners[cid];
const specsKeys = Object.keys(results.specs);
const spec = results.specs[specsKeys[0]];
const suiteKeys = Object.keys(spec.suites);
const suite = spec.suites[suiteKeys[suiteKeys.length - 1]];
const testKeys = Object.keys(suite.tests);
const test = suite.tests[testKeys[testKeys.length - 1]];
return test;
}
addSomeContext(object) {
const { cid, context } = object;
const test = this.getCurrentTest(cid)
test['context'] = test['context'] || [];
test['context'].push(context);
}
static addContext(context) {
TimelineReporter.tellReporter('timeline:addContext', { context })
}
static tellReporter (event, msg = {}) {
process.send({ event, ...msg })
}
}
module.exports = TimelineReporter;

2

package.json
{
"name": "wdio-timeline-reporter",
"version": "0.1.9",
"version": "0.2.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/timeline-reporter.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc