What is @rpii/wdio-report-events?
@rpii/wdio-report-events is a WebdriverIO plugin that provides event-driven reporting capabilities. It allows users to hook into various WebdriverIO events and generate custom reports based on those events.
What are @rpii/wdio-report-events's main functionalities?
Event Listening
This feature allows users to listen to specific WebdriverIO events such as 'test:pass' and 'test:fail'. The code sample demonstrates how to create a custom reporter that logs messages when tests pass or fail.
const { WdioReporter } = require('@rpii/wdio-report-events');
class CustomReporter extends WdioReporter {
constructor(options) {
super(options);
this.on('test:pass', this.onTestPass);
this.on('test:fail', this.onTestFail);
}
onTestPass(test) {
console.log(`Test passed: ${test.title}`);
}
onTestFail(test) {
console.log(`Test failed: ${test.title}`);
}
}
module.exports = CustomReporter;
Custom Reporting
This feature allows users to create custom reports by hooking into WebdriverIO events. The code sample shows how to create a reporter that writes test results to a file.
const { WdioReporter } = require('@rpii/wdio-report-events');
const fs = require('fs');
class FileReporter extends WdioReporter {
constructor(options) {
super(options);
this.on('test:end', this.onTestEnd);
}
onTestEnd(test) {
const report = `Test: ${test.title} - Status: ${test.state}`;
fs.appendFileSync('test-report.txt', report + '\n');
}
}
module.exports = FileReporter;
Other packages similar to @rpii/wdio-report-events
wdio-spec-reporter
The wdio-spec-reporter package provides a detailed spec report of test results. It is similar to @rpii/wdio-report-events in that it listens to WebdriverIO events, but it focuses on generating a spec-style report rather than allowing for custom event handling.
wdio-allure-reporter
The wdio-allure-reporter package integrates with the Allure reporting framework to generate comprehensive test reports. It is similar to @rpii/wdio-report-events in that it hooks into WebdriverIO events, but it provides more advanced reporting features and integrates with the Allure ecosystem.
@rpii/wdio-report-events
Updated for module compatibility with webdriver 8
Abstracts the event driver messaging to pass screenshots and log data to webdriverio reports
Used internally by various packages that need to fire events, and listen for them.
Easy to update if webdriver.io changes the report scheme again.