Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@reportportal/agent-js-cypress
Advanced tools
This agent helps Cypress to communicate with Report Portal
agent-js-cypress is a runtime reporter for the Report Portal which provides information about collection run.
$ npm install @reportportal/agent-js-cypress
Add the following options to cypress.json
{
"reporter": "@reportportal/agent-js-cypress",
"reporterOptions": {
"endpoint": "http://your-instance.com:8080/api/v1",
"token": "00000000-0000-0000-0000-000000000000",
"launch": "LAUNCH_NAME",
"project": "PROJECT_NAME",
"description": "LAUNCH_DESCRIPTION"
}
}
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin');
module.exports = (on) => registerReportPortalPlugin(on);
Add the following to your custom commands file (cypress/support/commands.js):
require('@reportportal/agent-js-cypress/lib/commands/reportPortalCommands');
See examples of usage here.
Runs support following options:
Parameter | Description |
---|---|
token | User's Report Portal token from which you want to send requests. It can be found on the profile page of this user. |
endpoint | URL of your server. For example 'https://server:8080/api/v1'. |
launch | Name of launch at creation. |
project | The name of the project in which the launches will be created. |
rerun | Enable rerun |
rerunOf | UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name |
autoMerge | Enable automatical report test items of all runned spec into one launch. You should install plugin or setup additional settings in reporterOptions. See Automatically merge launch. |
reportHooks | Determines report before and after hooks or not. |
skippedIssue | ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side. Parameter could be equal boolean values: TRUE - skipped tests considered as issues and will be marked as 'To Investigate' on Report Portal (default value). FALSE - skipped tests will not be marked as 'To Investigate' on application. |
isLaunchMergeRequired | Allows to merge Cypress run's into one launch in the end of the run. Needs additional setup. See Manual merge launches. |
ReportPortal provides the following custom commands for reporting logs into the current test.
cy.log(log)
. Reports message as an info log of the current test.You can use the following methods to report logs and attachments with different log levels:
file should be an object:
{
name: "filename",
type: "image/png", // media type
content: data, // file content represented as 64base string
}
addTestAttributes (attributes). Add attributes(tags) to the current test. Should be called inside of corresponding test.
attributes is array of pairs of key and value:
[{
key: "attributeKey1",
value: "attributeValue2",
}]
Key is optional field.
To integrate with Sauce Labs just add attributes:
[{
"key": "SLID",
"value": "# of the job in Sauce Labs"
}, {
"key": "SLDC",
"value": "EU (EU or US)"
}]
setTestDescription (description). Set text description to the current test. Should be called inside of corresponding test.
setTestCaseId (id, suite). Set test case id to the current test or suite. Should be called inside of corresponding test/suite.
id is a string test case Id.
suite (optional) is the title of the suite to which the specified test case id belongs. Should be provided just in case of reporting test case id for specified suite instead of current test.
ReportPortal provides the following custom commands for setting status to the current suite/spec.
You can use the shorthand forms of the cy.setStatus method:
ReportPortal also provides the corresponding methods for setting status into the launch:
To use custom filename in cy.screenshot function you should setup ReportRortal custom commands. Default usage of Cypress screenshot function is supported without additional setup.
By default Cypress create a separate run for each test file. This section describe how to report test items of different specs into the single launch. This feature needs information about Cypreess configuration. To provide it to the reporter you need to install reportPortal plugin (see how to in this section) or to copy the following Cypress config options to the reporterOptions:
Note: you need to specify only those options that are not the default.
Enable auto-merge in reporterOptions as shown below:
{
...
"reporterOptions": {
...
"autoMerge": true
}
}
There is a possibility to merge all launches into a single launch in the end of the run. We advice to use autoMerge option to merge results in one launch but you can use this alternative option in case of you need to perform some additional actions before merge.
Edit cypress.json file. Set isLaunchMergeRequired option to true as shown below:
{
...
"reporterOptions": {
...
"isLaunchMergeRequired": true
}
}
Create folder "scripts" on project folder. Copy the following script into "cypress.js" file and put it to "scripts" folder.
const cypress = require('cypress');
const fs = require('fs');
const glob = require('glob');
const { mergeLaunches } = require('@reportportal/agent-js-cypress/lib/mergeLaunches');
const cypressConfigFile = 'cypress.json';
const getLaunchTempFiles = () => {
return glob.sync('rplaunch-*.tmp');
};
const deleteTempFile = (filename) => {
fs.unlinkSync(filename);
};
cypress.run().then(
() => {
fs.readFile(cypressConfigFile, 'utf8', (err, data) => {
if (err) {
throw err;
}
const config = JSON.parse(data);
if (config.reporterOptions.isLaunchMergeRequired) {
mergeLaunches(config.reporterOptions)
.then(() => {
const files = getLaunchTempFiles();
files.forEach(deleteTempFile);
console.log('Launches successfully merged!');
process.exit(0);
})
.catch((err) => {
console.error(error);
process.exit(1);
});
} else {
process.exit(0);
}
});
},
(error) => {
console.error(error);
const files = getLaunchTempFiles();
files.forEach(deleteTempFile);
process.exit(1);
},
);
"scripts": {
...
"cypress": "node scripts/cypress.js",
...
},
Licensed under the Apache License v2.0
FAQs
This agent helps Cypress to communicate with ReportPortal
The npm package @reportportal/agent-js-cypress receives a total of 20,935 weekly downloads. As such, @reportportal/agent-js-cypress popularity was classified as popular.
We found that @reportportal/agent-js-cypress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.