agent-js-cypress
agent-js-cypress copied to clipboard
The Cypress reporter doesn't report the steps to RP
Hi
I'm trying to report my tests to ReportPortal with the agent-js-cypress
My setup file is like in the repo man.
I set desc to each test in the suite like this
describe('My website Login Page', () => {
it('1: Login Page Check Elements', () => {
cy.visit('http://localhost:3000')
cy.get('#usernameId').type('username')
cy.get('#passwordId').type('password')
cy.get('#exampleCustomCheckbox').check({ force: true }).should('be.checked')
cy.get(' #langRadioIt').check({ force: true }).should('be.checked')
cy.get(' #langRadioAr').check({ force: true }).should('be.checked')
cy.get(' #langRadioEn').check({ force: true }).should('be.checked')
})
it('2 : Incorrect user name or password', () => {
cy.visit('http://localhost:3000')
cy.get('#usernameId').type('username')
cy.get('#passwordId').type('pass11111111')
cy.get('.px-0 > .fs-17').click()
cy.url().should('include', '/login')
})
it('3: Correct user name or password', () => {
cy.visit('http://localhost:3000')
cy.get('#usernameId').type('username')
cy.get('#passwordId').type('password')
cy.get('.px-0 > .fs-17').click()
cy.url().should('include', '/main')
})
While the test reported to RP only the name of the test display in launch without the steps. step display only when the test failed so the error log show in the details
when I report with Pytest for example, all the steps reported also. this is a bug? if not how I need to setup the cypress.js
cypress.js
const cypress = require('cypress'),
RPClient = require('reportportal-client')
fs = require('fs'),
glob = require("glob");
const cypressConfigFile = "cypress.json";
const getLaunchTempFiles = () => {
return glob.sync("rplaunch-*.tmp");
}
const deleteTempFile = (filename) => {
fs.unlinkSync(filename);
}
cypress.run().then(
() => {
fs.readFile(cypressConfigFile, 'utf8', function (err, data) {
if (err) {
throw err;
}
let config = JSON.parse(data);
if (config.reporterOptions.isLaunchMergeRequired) {
let client = new RPClient(config.reporterOptions);
client.mergeLaunches();
let files = getLaunchTempFiles();
files.map(deleteTempFile);
}
});
},
error => {
console.error(error)
let files = getLaunchTempFiles();
files.map(deleteTempFiles);
process.exit(1)
}
);
@VladislavAkulich could you help ?
@avarabyeu ? could you take a look?
@trew100 @filland I expect you should see the following structure in ReportPortal: [SUITE] - My website Login Page [TEST] -- 1: Login Page Check Elements [TEST] -- 2 : Incorrect user name or password [TEST] -- 3: Correct user name or password
What kind of steps you want to see here?
@trew100 @filland I expect you should see the following structure in ReportPortal: [SUITE] - My website Login Page [TEST] -- 1: Login Page Check Elements [TEST] -- 2 : Incorrect user name or password [TEST] -- 3: Correct user name or password
What kind of steps you want to see here?
I want to see test details like this. https://web.demo.reportportal.io/ui/#default_personal/launches/all%7Cpage.page=1&page.size=50&page.sort=start_time%2Cnumber%2CDESC/5cc46170826fb00001315fec%7Cpage.page=1&page.size=50&page.sort=start_time%2CASC/5cc46170826fb00001315fed%7Cpage.page=1&page.size=50&page.sort=start_time%2CASC/5cc46170826fb00001315fee%7Cpage.page=1&page.size=50&page.sort=start_time%2CASC?page.page=1&page.size=50&page.sort=start_time%2CASC&log.item=5cc46170826fb0000131600b
Pytest plugin for example report this details and Cypress plugin doesn't. How can I do this with Cypress?
@trew100 did you find the solution? I'm facing the same issue
@ElenaRomanchuk has ticket for next sprint for investigation.
@ElenaRomanchuk @DzmitryHumianiuk Thanks!
I'm curious if there has been any updates to this feature request, this would be incredibly helpful!
Hi! This functionality is very complex and its implementation may break some popular plugins for Cypress. So, we have not implemented it.