agent-js-cypress icon indicating copy to clipboard operation
agent-js-cypress copied to clipboard

The Cypress reporter doesn't report the steps to RP

Open trew100 opened this issue 5 years ago • 9 comments

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)
    }
);

trew100 avatar Apr 02 '19 17:04 trew100

@VladislavAkulich could you help ?

filland avatar Apr 03 '19 08:04 filland

@avarabyeu ? could you take a look?

DzmitryHumianiuk avatar Apr 10 '19 16:04 DzmitryHumianiuk

@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?

avarabyeu avatar Apr 26 '19 11:04 avarabyeu

@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 avatar Apr 27 '19 19:04 trew100

@trew100 did you find the solution? I'm facing the same issue

romerobu avatar Mar 25 '20 10:03 romerobu

@ElenaRomanchuk has ticket for next sprint for investigation.

DzmitryHumianiuk avatar Mar 25 '20 11:03 DzmitryHumianiuk

@ElenaRomanchuk @DzmitryHumianiuk Thanks!

romerobu avatar Mar 30 '20 22:03 romerobu

I'm curious if there has been any updates to this feature request, this would be incredibly helpful!

kpmck avatar Oct 22 '20 14:10 kpmck

Hi! This functionality is very complex and its implementation may break some popular plugins for Cypress. So, we have not implemented it.

ElenaRomanchuk avatar Oct 23 '20 13:10 ElenaRomanchuk