Code Monkey home page Code Monkey logo

agent-js-cypress's Introduction

Join Slack chat! stackoverflow GitHub contributors Docker Pulls License Build with Love lambdaTest a27c44

Repositories structure

ReportPortal high level architecture

reportportal high level architecture

ReportPortal repositories structure

Report Portal organized into multiple repositories.

ReportPortal server side consists of the following services:

  • service-authorization Authorization Service. In charge of access tokens distribution
  • service-api API Service. Application Backend
  • service-ui UI Service. Application Frontend
  • service-index Index Service. Info and health checks per service.
  • service-analyzer Analyzer Service. Finds most relevant test fail problem.
  • gateway Traefik Gateway Service. Main entry point to application. Port used by gateway should be opened and accessible from outside network.
  • rabbitmq Load balancer for client requests. Bus for messages between servers.
  • minio Attachments storage.

Available plugins developed by ReportPortal team:

Client side adapters related repositories:

  • client-* - API integrations. Http clients, which process HTTP request sending.
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which help to collect logs, bind it with test-case item via agent-* and send to server via client-*

Other repositories stored according to next rules

  • service-* - micro-services which are a part of Application
  • commons-* - common libraries, models, etc., used by micro-services

Installation steps

Simple setup with Docker

It's the best way for demo purposes and small teams. The database is already in the docker-compose.

  1. Install Docker (Engine, Compose)

  2. Download Example of docker-compose descriptor to any folder

  3. Deploy ReportPortal using docker compose plugin within the same folder

docker compose -p reportportal up

To start ReportPortal in daemon mode, add '-d' argument:

docker compose -p reportportal up -d
  1. Open in your browser IP address of deployed environment at port 8080
http://IP_ADDRESS:8080
  1. Use next login\pass for access:
  • default\1q2w3e
  • superadmin\erebus.

Please change admin password for security.

Mentioned compose file deploy all available Bug Tracking System integrations, which not always needed, but use resources.

Production-ready set and Custom deployment with Docker

For production usage, we recommend:

  • choose only required Bug Tracking System integration service. Exclude the rest

To customize deployment and make it production-ready please follow customization steps and details

Integration. How to get log data in

You should add Client Side code inside your test automation. It consists of:

  • client-* - API integrations. Http clients, which process HTTP request sending. E.g. for Java (client-java-*)
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which helps to collect logs, bind it with test-case via agent-* and send to server via client-*

Integration steps and documentation

Contribution

There are many different ways to contribute to Report Portal's development, just find the one that best fits with your skills. Examples of contributions we would love to receive include:

  • Code patches
  • Documentation improvements
  • Translations
  • Bug reports
  • Patch reviews
  • UI enhancements

Big features are also welcome but if you want to see your contributions included in Report Portal codebase we strongly recommend you start by initiating a chat through our Team in Slack.

Contribution details

Documentation

Community / Support

License

Report Portal is Apache 2.0.

agent-js-cypress's People

Contributors

aliakseiliasnitski avatar am1988 avatar amsterget avatar avarabyeu avatar bam6ycha avatar chivekrodis avatar dependabot[bot] avatar dzmitryhumianiuk avatar filland avatar garethleonard avatar katrin-kot avatar katsiarynatatarynovich avatar millerick avatar nigui avatar orgads avatar pashidlos avatar thomaswinkler avatar tr1ble avatar vladislavakulich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agent-js-cypress's Issues

Field 'startTime' shouldn't be null.

Hi All,

I'm trying to use the latest code from the master branch to output my cypress test results into Report Portal. Everything is setup as specified in the readme file, however when I run the tests I get the following error about the start time shouldn't be null.

Error: Request failed with status code 400: {"error_code":4001,"message":"Incorrect Request. [Field 'startTime' shouldn't be null.] "} at \node_modules\reportportal-client\lib\rest.js:27:23 at processTicksAndRejections (internal/process/task_queues.js:85:5)

Does anyone have any ideas on why this error is occurring? Do I need to provide a start time myself?

Thanks in advance.

Fail to merge reports

Hello,
I'm using the agent-js-cypress from master and I have error on reportportal-client.

The agent-js-cypress send the launches like String but the API wait Long value :

The agent-js-cypress send
{ description: 'Merged launch', endTime: 1591208166778, extendSuitesDescription: true, launches: [ '3bb36bf8', '07e2f9ad', '27de20d4', '56da7005' ], mergeType: 'BASIC', mode: 'DEFAULT', name: 'E2E_Cypress', attributes: undefined }
Error:
(node:24028) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. Invalid JSON input: Cannot deserialize value of typejava.lang.Longfrom String \"3bb36bf8\": not a valid Long value; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of typejava.lang.Long from String \"3bb36bf8\": not a valid Long value\n at [Source: (PushbackInputStream); line: 1, column: 99] (through reference chain: com.epam.ta.reportportal.ws.model.launch.MergeLaunchesRQ[\"launches\"]->java.util.HashSet[0])"} at ...\node_modules\reportportal-client\lib\rest.js:28:23

Can you help me?

Tests stuck in running state in RP when executed from a docker container

When running cypress tests from within a docker container, the tests are not finishing but getting stuck in a run state in ReportPortal.

The docker image used is : cypress/browsers:node13.6.0-chrome80-ff72
Command to execute tests:
<entrypoint.sh>
npx cypress run --headless --browser $browser --config-file=cypress/cypress.$env.json --env ***

If the above npx cypress run is the last command in the entrypoint.sh file, the problem occurs, however, if there are further commands after the npx run line (for example an if condition to check exit code), the problem does not occur. (Dockerfile and cypress.json shared in private)

Could not locate the bindings file error

Hi! I have a cypress project working fine, and I am trying to communicate it with a report portal instance. So I followed the steps to install the report portal agent and client for cypress, but now when I run cypress I get the following error:

Error: Could not locate the bindings file. Tried:

  • It tries in ...\node_modules\deasync\ directory, inside folders such as build or debug, that don't exist...
    Any clue about what can be happening?
    Many thanks!!

Question: add testCaseId and attributes to suite

I'm implementing this agent and it is working. Now I also want to add a testCaseId and attributes to a suite. I tried this with this in the before of a suite (describe) but it doesn't work.

cy.setTestCaseId('15656');
cy.setTestDescription('Some description');

I don't see this information comming in the report portal database either.

Can someone help here?

Report Portal Tests Results Keep Loading In Launch Section Even After The Jenkins Job Finished

I am using Jenkins pipeline to run the job and using Report Portal with Cypress to track the test suite.
There are two job - smoke & Regression in which smoke is the upstream pipeline. I am facing one issue with Report Portal -:
I can see the suites keep loading in launch section in reporting portal even after finishing the Jenkins job. I need to finish the suite in Reporting Portal forcefully & because of this RP shows incorrect test counts. Please find the attached screenshot, you can see in the screenshot, it is showing the status as in-progress and those 3 dots showing loading continuously.
missing-RP-1
Note :- We already set "Launch inactivity timeout" as 1 hour but still the launch is not finished automatically after 1 hour.
Thanks!!

ERR_IPC_CHANNEL_CLOSED when autoMerge set to true.

I have an Angular Nx project with Cypress. When I did not set autoMerge, the tests ran and were all reported to my instance of ReportPortal.

Once I switched to autoMerge, the first spec file ran successfully, and the second (and subsequent) spec files failed out with the ERR_IPC_CHANNEL_CLOSED failure, causing only the first spec file to run.

I was able to get the autoMerge to run successfully a handful of times, but once any change was made to the Cypress.json file, I was not able to get it to run again.

I have included a repo where this can be reproduced: https://github.com/kpmck/angular-nx-cypress-reportportal

Steps to reproduce:

  1. open solution in VS Code
  2. run npm i to install packages
  3. add your ReportPortal details in the cypress.json file
  4. run ng e2e to execute e2e tests

Cypress: 4.12.1 (I have also tried 5.4.0 and 4.1.0)
Node: 8.9.5
reportportal/agent-js-cypress: 5.0.1

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at ChildProcess.target.send (internal/child_process.js:678:16)
at Runner. (C:\sandbox\angular-nx-cypress-reportportal\node_modules@reportportal\agent-js-cypress\lib\cypressReporter.js:109:21)
at Runner.emit (events.js:215:7)
at Reporter.emit (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\reporter.js:263:54)
at Object.onMocha (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\project.js:381:18)
at Socket. (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\socket.js:313:32)
at Socket.emit (events.js:210:5)
at C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
code: 'ERR_IPC_CHANNEL_CLOSED'
}
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at ChildProcess.target.send (internal/child_process.js:678:16)
at Runner. (C:\sandbox\angular-nx-cypress-reportportal\node_modules@reportportal\agent-js-cypress\lib\cypressReporter.js:109:21)
at Runner.emit (events.js:215:7)
at Reporter.emit (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\reporter.js:263:54)
at Object.onMocha (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\project.js:381:18)
at Socket. (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\socket.js:313:32)
at Socket.emit (events.js:210:5)
at C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:75:11)

Test results do not appear in reportportal

I'm using "cypress": "^8.7.0" and "@reportportal/agent-js-cypress": "^5.0.2" with node 14

My reportportal implementation is already running well with testcafe for another project. Now I tried setting it up with this project that uses cypress and the results just don't show up in RP. I followed every step shown here: https://github.com/reportportal/agent-js-cypress

I turned on the debug option in the reporter options and I'm getting this output:

Finish test item ...
Success finish item ...
Finish test item ...
Success finish item ...
Finish launch ...
Success finish launch ...
This sounds like the launch worked but I do not see anything in RP.

Edit: I just tried the example from the example repo and it does not work either.

The plugins file is missing or invalid.

My cypress version is 7.7.0. I have installed agent-js-cypress also. I have followed the https://github.com/reportportal/agent-js-cypress and wanted to run the test in reportportal. I ran the test ./node_modules/.bin/cypress --reporter reportportal. When I run it like this I am getting an error called plugins file is missing or invalid. I am copying the error here

The plugins file is missing or invalid.

Your `pluginsFile` is set to `C:\Users\annap\code\junior-training-website\cypress\plugins\index.js`, but either the file is missing, it contains a syntax error, or threw an error when required. The `pluginsFile` must be a `.js`, `.ts`, or `.coffee` file.

Or you might have renamed the extension of your `pluginsFile`. If that's the case, restart the test runner.

Please fix this, or set `pluginsFile` to `false` if a plugins file is not necessary for your project.

 Error: Cannot find module '../../agent-js-cypress/lib/plugin'
Require stack:
 

So I tried to find this module 'agent-js-cypress/lib/plugin' in node_modules' directory. But I can see node_modules/cypress/agent-js-cypress/src or /img. I dont see any lib module inside.

Report Portal Shows Incorrect Test Counts In Launch Section

Hello Team,

We are fetching results into Reporting Portal from the Jenkins job. I am facing one issue with the RP with the total test counts. We have 2 launches configured in RP - smoke_suite & regression_suite. If we compare the test counts in Jenkins jobs with RP launches, we found some of the tests missing in RP from each launch which makes RP useless due to incorrect data. I am not sure this is because of this issue - #62
We are using RP 5 with cypress-JS agent.
Can anyone please take a look and let me know what can be the root cause. Any help would be much appreciated. Please refer the screenshots for reference -
RP -
RP-incr

Jenkins -
RP-inr
As we can see from above screenshot, there should be total 80 test cases which is showing incorrect in RP.
Thanks!!

cy.log the order is lost

My Cypress Test:

beforeEach(() => {
    cy.log('Before each test');
});

afterEach(() => {
    cy.log('After each test');
});

after(() => {
    cy.log('After suite test');
});

it('Another Visits the project page', () => {
    cy.visit('/');
    cy.log('test LOG message: ' + new Date());
    cy.log('first log message');
    cy.log('second log message');
    cy.log('third log message');
    cy.log('fourth log message');
    cy.log('fifth log message');
    cy.screenshot();
    cy.screenshot({
        blackout: ['.external-user-action-profile-name'], // blackout User-Name
    });
    cy.contains('Starterkit Application');
    cy.screenshot({
        capture: 'runner',
        disableTimersAndAnimations: true,
    });
    cy.info('Testing Cypress Report-Portal method cy.info()');
    cy.log('last LOG message: ' + new Date());
});

My Report-Portal Result:

image

Is there a way to preserve the Order of the Log-Messages?

How to get logging in report

Hi, I'm looking to implement report portal for a cypress test suite I have.

From looking through the code I can see there is a sendLog method that is called on the rp:log event being fired. What I don't really understand is how/when that rp:log event is triggered (and therefore what to do within my suite when I want to log something). I also see there is a bunch of event constants in the constants file but it doesn't look like they are used currently? Am I wrong or are they being pulled in by another package?

Launch "undefined" not found

Error: Launch "undefined" not found
at RPClient.finishLaunch (/node_modules/reportportal-client-restler/lib/report-portal-client.js:171:55)
at ReportPortalReporter.finishLaunch (/node_modules/agent-js-cypress/rp-reporter.js:75:41)
at Runner.ReportPortalReporter.runner.on (/node_modules/agent-js-cypress/rp-reporter.js:65:18)
at emitOne (events.js:116:13)
at Runner.emit (events.js:211:7)
at Reporter.emit (/Users/vbariletti/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:237:55)
at Object.server.startWebsockets.onMocha (/Users/vbariletti/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:300:22)
at Socket. (/Users/vbariletti/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:236:36)
at emitTwo (events.js:126:13)
at Socket.emit (events.js:214:7)
at /Users/vbariletti/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:528:12
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)

it fails in finishLaunch but I couldn’t find where this method is called from, I provided all changes that described in ReadMe, but it still fails
I tried to debug and observe that launchTempId, finishExecutionRQ is undefined
oh and also i see it logs results on the endpoint, so I can see the launch on the dashboard

Problem with "agent-js-cypress" integration

Hi.

I'm having problems integrating Cypress and ReportPortal (5.5.0 and 5.3.5).

When using the "autoMerge" flag to merge the runs, the ReportPortal does not record (or appears not to be receiving the logs) of test runs.

Without using the option it logs one execution per file, as expected.

A validation I also performed was to check the behavior of the example project available here on GitHub. The problem occurred the same way (verified with Cypress versions 7.2, 7.7, 8.0 and 8.6).

I tried to change the strategy and follow the option "isLaunchMergeRequired" and I wasn't successful either (the guidelines presented in the repository caused an error in Cypress).

Another detail is that the assertions made by Cypress are not being registered in the scenario summary in the ReportPortal (the entries in the RP only show the hooks in a disorganized way). The example below demonstrates this behavior.

/// <reference types="cypress" />

describe('Example context test', { tags: ['@debug', '@example'] }, () => {
  before(() => {
    cy.log('Before suite test')
  })

  beforeEach(() => {
    cy.log('Before each test')
  })

  afterEach(() => {
    cy.log('After each test')
  })

  after(() => {
    cy.log('After suite test')
  })

  it('Should use assertions', () => {
    const target = '_blank'

    cy.visit('/commands/assertions')
    cy.exampleAssertTable()
    cy.exampleAssertLinks(target)
  })

  it('Should use a fixture', () => {
    cy.exampleServiceIntercept().as('getComment')

    cy.visit('/commands/files')
    cy.get('.fixture-btn').click()
    cy.wait('@getComment').its('response.body')
      .should('have.property', 'name')
      .and('include', 'Using fixtures to represent data')
  })
})

image

Test cases fails to Merge

Command is npx cypress run
I can see that .tmp file gets created. However, I can not see merge launch on report portal.
Inside Cypress.js, I have added logs, these logs are not visible.

`$ npx cypress run

====================================================================================================

(Run Starting)

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 4.0.2 │
│ Browser: Electron 78 (headless) │
│ Specs: 2 found (actions.spec.js, example.spec.js) │
└────────────────────────────────────────────────────────────────────────────────────────────────┘

────────────────────────────────────────────────────────────────────────────────────────────────────

Running: actions.spec.js (1 of 2)
(node:29316) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(node:29316) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

(Results)

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 14 │
│ Passing: 14 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 39 seconds │
│ Spec Ran: actions.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘

────────────────────────────────────────────────────────────────────────────────────────────────────

Running: example.spec.js (2 of 2)
(node:21340) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(node:21340) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

(Results)

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 9 │
│ Passing: 6 │
│ Failing: 2 │
│ Pending: 1 │
│ Skipped: 0 │
│ Screenshots: 4 │
│ Video: false │
│ Duration: 31 seconds │
│ Spec Ran: example.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘

(Screenshots)

  • D:\Gitlab_Projects\cypress-report-portal\cypress-report-portal-integration\cypre (114x50)
    ss\screenshots\example.spec.js\Feature Cypress Report Portal Integration Test -
    • SubFeature Verify Cypress Examples page -- SubFeature Verify content Cypress
      example page -- Test Verify page should contain Commands.png
  • D:\Gitlab_Projects\cypress-report-portal\cypress-report-portal-integration\cypre (1280x720)
    ss\screenshots\example.spec.js\Feature Cypress Report Portal Integration Test -
    • SubFeature Verify Cypress Examples page -- SubFeature Verify content Cypress
      example page -- Test Verify page should contain gfkjdgkjdfgl (failed) (failed)
      .png
  • D:\Gitlab_Projects\cypress-report-portal\cypress-report-portal-integration\cypre (272x201)
    ss\screenshots\example.spec.js\Feature Cypress Report Portal Integration Test -
    • SubFeature Verify content of Google Dot Com -- Test Verify contains of googl
      e page (failed).png
  • D:\Gitlab_Projects\cypress-report-portal\cypress-report-portal-integration\cypre (1280x720)
    ss\screenshots\example.spec.js\Feature Cypress Report Portal Integration Test -
    • SubFeature Verify content of Google Dot Com -- Test Verify contains of googl
      e page (failed) (failed).png

====================================================================================================

(Run Finished)

   Spec                                              Tests  Passing  Failing  Pending  Skipped

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ √ actions.spec.js 00:39 14 14 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ × example.spec.js 00:31 9 6 2 1 - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
× 1 of 2 failed (50%) 01:11 23 20 2 1 -
`

{
"projectId" : "crossVertical",
"reporter": "index.js",
"video" : false,
"reporterOptions": {
"endpoint": "http://encrypted.amazonaws.com:8080/api/v1",
"token": "6741d259-6352-3434-4353-059ec805a8ec",
"launch": "example",
"project": "cypress_project",
"description": "END_TO_END VERTICAL",
"isLaunchMergeRequired": true
}
}

"isLaunchMergeRequired":true option does not work with Report Portal v5 0

"isLaunchMergeRequired":true option does not work with Report Portal v5 0

Tested on the example.spec with main.js, observed that "isLaunchMergeRequired"=true is not working.
Launches are not shown as merged in the Report portal.

Note: Other options "rerun" and "debug" is working as expected

Environment:
Report Portal : v5 0 0 (Installed on Google Kubernetes)
Cypress: 3.8.2

Support for launch attributes

I would love to see support for launch based attributes, I couldn't see anything in the documentation, but having looked at the code I have attempted to supply attributes in reporterOptions, as below:

"reporterOptions": { "attributes": [ { "key": "environment", "value": "dev" }, { "key": "release", "value": "v0.6.0" } ] }

This appears to work for the initial launch, but then I start to see these errors:

Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'attributes[].value' should not contain only white spaces and shouldn't be empty.] "} at /..retracted../node_modules/@reportportal/client-javascript/lib/rest.js:32:23 at processTicksAndRejections (internal/process/task_queues.js:93:5) Fail to finish test Error: Request failed with status code 400: {"errorCode":4001,"message":"Incorrect Request. [Field 'attributes[].value' should not contain only white spaces and shouldn't be empty.] "} at /..retracted../node_modules/@reportportal/client-javascript/lib/rest.js:32:23 at processTicksAndRejections (internal/process/task_queues.js:93:5)

Would be really helpful to see this feature working, if possible. Thanks

ReportPortal custom commands not sending logs to RP

The ReportPortal custom commands are not sending logs to RP (tried all custom commands, the logs are not showing up in reportportal: cy.log(), cy.trace(), cy.debug()... )

The test agent is configured correctly, launches, test suite and test steps are created in RP, also failing test logs and stacktraces are attached, but using the custom commands do not yield any additional logs. cy.screenshot() is working fine as well.

Custom commands are added to the support/commands.js:
require('agent-js-cypress/lib/commands/reportPortalCommands');

plugins/index.js
const registerReportPortalPlugin = require('agent-js-cypress/lib/plugin');
module.exports = (on) => registerReportPortalPlugin(on);

Test project shared with the developer directly to help reproduce the issue.

Using agent-js-cypres along with mochawesome reporter via cypress-multi-reporters

I'm trying to both generate a local report using mochawesome and send test data to ReportPortal.io for my Cypress project. I think the config should be something like:

    "reporter": "cypress-multi-reporters",
    "reporterOptions": {
        "reporterEnabled": "agent-js-cypress/rp-reporter.js, mochawesome",
        "agentJsCypressRpReporterReporterOptions": {
            "endpoint": "http://localhost:8080/api/v1",
            "token": "6df05ba5-98b5-4203-9106-a5867be16113",
            "launch": "Cypress Test Run",
            "project": "demoday",
            "description": "Test run from gde-cypress-poc",
            "isLaunchMergeRequired": true
        },
        "mochawesomeReporterOptions": {
            "reportDir": "cypress/reports/mocha",
            "quite": true,
            "overwrite": false,
            "html": false,
            "json": true
        }
    }

When I try that, I just ECONNREFUSED errors from reportportal. Is it possible to use the rp-reporter in tandem with another in this way? If not currently, is that planned for the future?

Merge parallel launches

We run our tests in parallel in circle-ci using the cypress-orbs. We've got a couple different reporters configured so I use a custom cypress runner that also configures report portal. Providing the isLaunchMergeRequired option as true does not work and providing autoMerge as true causes tests to never finish inside of Report Portal. I'd like the launches to be merged once they all finish in parallel, similar to this issue here on another agent: reportportal/agent-net-specflow#35

This issue is created out of this post in slack here: https://reportportal.slack.com/archives/C2GTJTTNH/p1607090566045400?thread_ts=1606931183.021600&cid=C2GTJTTNH

Here is my configuration file for cypress/reportPortal. I've taken the merge code out for now as it wasn't working.

const CYPRESS = require('cypress');
const FS = require('fs');
const GLOB = require('glob');
const REPORTPORTAL = require('@reportportal/agent-js-cypress')
const ARGS = process.argv.slice(2)
const REPORTERCONFIGFILE = 'cypress/reporters/reportPortal.json';
const TAG = ARGS[0].toUpperCase()
const GROUP = ARGS[1]
let environment = TAG.includes("staging")?'staging':'daily'
let config;

const DATA = FS.readFileSync(REPORTERCONFIGFILE, 'utf8') 

config = JSON.parse(DATA)
config.reporterOptions.token = process.env.RPP_TOKEN
config.reporterOptions.launch = TAG + " " + process.env.CIRCLE_SHA1.substring(0,8)
CYPRESS.run({
  reporterOptions : config.reporterOptions,
  parallel: true,
  record: true,
  browser: "chrome",
  headless: true,
  key: process.env.CYPRESS_RECORD_KEY,
  tag: TAG,
  group: GROUP,
  config: {
    baseUrl: environment,
  },
  reporter: "@reportportal/agent-js-cypress",
  env: {
    grep: "@Flaky",
    invert: true}
  }).then(
    () => {
      process.exit(0)
    });

Perhaps we could set the launch id to the commit sha somehow so it's always unique, then once it gets to report portal it detects they're all the same and merges?

package is not working with cypress latest version 9.0.0

The following error originated from your test code, not from Cypress.

Cypress.Commands.add() is used to create new commands, but debug is an existing Cypress command.

Please use Cypress.Commands.overwrite() if you would like to overwrite an existing command.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

https://on.cypress.io/custom-commands

Tests hanging in project with large number of files

Sometimes in a project with a large number of files, the test finishes before the agent can finish searching for any screenshots to attach. The tests in reportportal will hang after that until they time out.

Test execution is not stopping automatically in report portal [v5.2.2]. need to stop forcefully after every execution to analyse

Describe the bug
We have our application framework in cypress (JS) (agent-js-cypress) which is configured with Jenkins and report portal . Report portal we have installed with kubernetes.
Basically we configure our Execution to run with the help of jenkins and analyse the result in report portal
The problem occurring is now execution is getting stopped successfully in jenkins after passing or failing but it keeps running in report portal.

Expected behavior
Test cases execution needs to be stopped as soon as it completed in jenkins

Desktop (please complete the following information):

  • OS: [ iOS]
  • Browser [e.g. chrome]

Not working with "yarn" package manager

Hello!

My project uses yarn as a package manager.
Basically I was trying to integrate cypress-agent with my cypress config, but have been struggling a lot with making it work.

As far as I understood, the problem was that node-ipc for some reason wouldn't connect and I'm getting connection errors:
image

Eventually I went to examples repo (https://github.com/reportportal/examples-js) and tried to test it from there, but (to my surprise) it also didn't work with "yarn".

Then I installed it through npm and everything worked as expected. There was no error and portal has started receiving messages from my tests.

So please if you are aware of this issue - let me know if it's fixable, otherwise for us it's not possible to use reports dashboard.

Steps to reproduce:

  • Clone examples repository (https://github.com/reportportal/examples-js)
  • run "yarn install"
  • update cypress.json to have correct values (token, endpoint, etc)
  • Go to "node_modules/@reportportal/agent-js-cypress/lib/plugin/ipcClient.js and comment line 29 (this will allow to see node-ipc logs in your console)
  • run "yarn test"

In the console you will se the same log that I attached above.

When install is done via "npm install" everything works.

Please let me know if this is enough information, thanks!

Thanks a lot in advance.

Fail to start launch Error: Request failed with status code 502

int.json

 "reporterOptions": {
    "configFile": "reporter-config.json"
  },

reporter-config.json

{
  "reporterEnabled": "mochawesome, @reportportal/agent-js-cypress,  mocha-junit-reporter",
  "reporterOptions": {
    "mochawesomeReporterOptions": {
      "mochaFile": "cypress/results/results-[hash].xml",
      "reportDir": "cypress/artifacts/reports/",
      "reportFilename": "value",
      "reportTitle": "value ",
      "overwrite": false,
      "html": true,
      "timestamp": true,
      "json": true
    },
    "reportportalAgentJsCypressReporterOptions": {
      "endpoint": "http://emter amazpon ec2 url.compute.amazonaws.com:8080/api/v1",
      "token": "token",
      "launch": "cypress",
      "project": "cypress_project",
      "description": "END_TO_END",
      "isLaunchMergeRequired": false,
      "autoMerge": true,
      "integrationFolder": "cypress/integration",
      "screenshotsFolder": "cypress/screenshots",
      "fixturesFolder": "cypress/fixtures",
      "supportFile": "cypress/support/index.js",
      "pluginsFile": "cypress/plugins/index.js"
    }
  }
}

When executed from Git Pipeline, we are getting below errors

Error: Request failed with status code 502
     at /home/cypress_testing/node_modules/@reportportal/client-javascript/lib/rest.js:31:23
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
 Fail to start launch Error: Request failed with status code 502
     at /home/cypress_testing/node_modules/@reportportal/client-javascript/lib/rest.js:31:23
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
 Fail to start suite Error: Request failed with status code 502
     at /home/cypress_testing/node_modules/@reportportal/client-javascript/lib/rest.js:31:23
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
 Fail to start suite Error: Request failed with status code 502
     at /home/cypress_testing/node_modules/@reportportal/client-javascript/lib/rest.js:31:23
     at processTicksAndRejections (internal/process/task_queues.js:93:5)
 Fail to start test Error: Request failed with status code 502
     at /home/cypress_testing/node_modules/@reportportal/client-javascript/lib/rest.js:31:23
     at processTicksAndRejections (internal/process/task_queues.js:93:5)

Add the option to send more detailed logs to ReportPortal

There is a strong need to push more detailed logs into ReportPortal, as especially with tests running in CI or in K8S, it is really difficult to investigate failures.

Please provide an option to send the below logs to RP even for successful test executions.

Useful logs would be:

  • command log from cypress
  • cypress console output
  • browser console output (nice to have)
  • filter/trim logs (nice to have)

Please see https://github.com/archfz/cypress-terminal-report as an example; it provides very detailed output to help with investigating issues.
image

Launches not reflected in RP Dashboard - API Token correct

Hi, I am using the cypress-reportportal plugin and have the same configuration as specified hier but running my test does not appear in RP.

I also included some logging in my test scripts such as:

cy.setTestDescription("1","with user details")
cy.addTestAttributes([
    {
        value: 'userTest'
    },
])
..
..
 cy.setStatusPassed("with user details")

Hopefully, someone here could help me. Maybe i forgot something to add or configure? Thank you!

> `Cypress.Commands.add()` is used to create new commands, but `debug` is an existing Cypress command.

I am using cypress 9.1.1 version and requiring require('@reportportal/agent-js-cypress/lib/commands/reportPortalCommands');

is throwing me the following error

An uncaught error was detected outside of a test:
     CypressError: The following error originated from your test code, not from Cypress.

  > `Cypress.Commands.add()` is used to create new commands, but `debug` is an existing Cypress command.

Please use `Cypress.Commands.overwrite()` if you would like to overwrite an existing command.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

https://on.cypress.io/custom-commands

cy.screenshot() or automatic screenshots on fail don't load images to RP when test name contains coma or single quote

To reproduce just add a spec file to this example with the following content:

context('screen', () => {
    it('test case title with ,', () => {
        cy.screenshot(); // or without that command
        expect(true).to.be.false;
    });

    it('test case title with \'', () => {
        cy.screenshot(); // or without that command
        expect(true).to.be.false;
    });
});

I tried to change the screenshot name in after:screenshot hook but it didn't work :(

[v5] Unable to finish test launch even when results are uploaded

Describe the bug
Using Cypress, when executing the spec will leave the automation running because it is waiting for the test launch to finish.

The installation method is using without docker.

There is no error reported from the logs.

Expected behavior
Test launch should finish and automation should not leave hanging

Screenshots
If you take a look on the screenshot, the test launch is not completed however the results are uploaded
image

this is the grep logs
image

Installed versions:
API_VERSION="5.2.1"
UAT_VERSION="5.2.1"
ANALYZER_VERSION="5.0.0"
MIGRATIONS_VERSION="5.2.0"
UI_VERSION="5.2.0"
SERVICE_INDEX_VERSION="5.0.8"

Getting issue while downloading the "agent-js-cypress" on Windows 64 bit operating system.

Hi All,

We have downloaded the "agent-js-cypress" with help of Cypress, and while downloading we are getting below warning messages. We believe due to those warning message our messages are not passing to Report portal level.

Hence could any one please help us to resolve this issue.

Error messages:

npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: "Please update to latest v2.3 or v2.2"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.1 (node_modules@reportportal\agent-js-cypress\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

Note: We did complete configuration set up as core team provided.

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

ECONNREFUSED with reporter only when using cypress-multi-reporters

Working off of agent-js-cypress 1.1.3, I see that my launches are going through just fine when I have @reportportal/agent-js-cypress denoted as my only reporter. However, when attempting to use cypress-multi-reporter, I run into an ECONNREFUSED issue (though the mochawesome report generates just fine).

Error: connect ECONNREFUSED [IP address]
    at [Project folder]/node_modules/@reportportal/client-javascript/lib/rest.js:31:23

My cypress.json has the following:

    "reporter": "cypress-multi-reporters",
    "reporterOptions": {
        "configFile": "reporter.json"
    }

And my reporter.json is as follows:

{
    "reporterEnabled": "@reportportal/agent-js-cypress, mochawesome",
    "agentJsCypressReporterOptions": {
        "endpoint": "http://localhost:8080/api/v1",
        "token": "35c84358-5bb2-419f-9bd7-3cafa424db74",
        "launch": "Cypress Test Run 2020.09.21",
        "project": "Pricing",
        "description": "Test run from [project name]",
        "isLaunchMergeRequired": true
    },
    "mochawesomeReporterOptions": {
        "reportDir": "cypress/reports/mocha",
        "quite": true,
        "overwrite": true,
        "html": false,
        "json": true
    }
}

Reporter options for the the Report Portal agent are identical to what I used as a solo reporter, where it was working. I know this is similar to an issue I've submitted in the past, but the error is new. What am I missing?

TypeError: createMergeLaunchLockFile is not a function

Following error occurs after updating to @reportportal/agent-js-cypress 5.0.0:

****/node_modules/@reportportal/agent-js-cypress/lib/reporter.js:68
createMergeLaunchLockFile(launch, tempId);
^

TypeError: createMergeLaunchLockFile is not a function
at Reporter.runStart (/Users/1077260/Documents/source/Platform/cypress-canary-tests/node_modules/@reportportal/agent-js-cypress/lib/reporter.js:68:7)
at process. (/Users/1077260/Documents/source/Platform/cypress-canary-tests/node_modules/@reportportal/agent-js-cypress/lib/worker.js:41:16)
at process.emit (events.js:210:5)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
✓ Can open *** website (3057ms)
Error [ERR_IPC_CHANNEL_CLOSED] [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at ChildProcess.target.send (internal/child_process.js:678:16)
at Runner. (/Users/1077260/Documents/source/Platform/cypress-canary-tests/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:137:19)
at Runner.emit (events.js:215:7)
at Reporter.emit (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:263:54)
at Object.onMocha (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:381:18)
at Socket. (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:313:32)
at Socket.emit (events.js:210:5)
at /Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:75:11)
{
code: 'ERR_IPC_CHANNEL_CLOSED'
}
Error [ERR_IPC_CHANNEL_CLOSED] [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at ChildProcess.target.send (internal/child_process.js:678:16)
at Runner. (/Users/1077260/Documents/source/Platform/cypress-canary-tests/node_modules/@reportportal/agent-js-cypress/lib/cypressReporter.js:137:19)
at Runner.emit (events.js:215:7)
at Reporter.emit (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:263:54)
at Object.onMocha (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/project.js:381:18)
at Socket. (/Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/socket.js:313:32)
at Socket.emit (events.js:210:5)
at /Users/1077260/Library/Caches/Cypress/4.9.0/Cypress.app/Contents/Resources/app/packages/socket/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:75:11)

Possible to add launchAttributes ?

I tried to add some Launch attributes in the same way, we do it with the agent-js-codecept, but the attributes are not available in reportportal.

Can i somehow add Launchattributes?

This is how we do it with the codecept agent ✅ :

reportportal: {
...
launchAttributes: [
        {
          key: 'Author',
          value: process.env.GITHUB_ACTOR || 'Local Launch'
        },
        {
          key: 'Branch',
          value: process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || 'Local Launch'
        },
        {
          key: 'PR',
          value: process.env.PR_ID || 'Local Launch'
        }]
}

With the cypress agent i tried 🔴 :

config.reporterOptions.launchAttributes = [
      {
        key: "Author",
        value: process.env.GITHUB_ACTOR || "Local Launch"
      },
      {
        key: "Branch",
        value:
          process.env.GITHUB_HEAD_REF ||
          process.env.GITHUB_REF_NAME ||
          "Local Launch"
      },
      {
        key: "PR",
        value: process.env.PR_ID || "Local Launch"
      }
    ];

[v5] Cypress Test Launches do not complete successfully.

Describe the bug
None of my launches finish. They get stuck in "in progress" until they time out after a day. We are using cypress along with the report portalagent-js-cypress plugin.

To Reproduce
We have just setup a fresh report portal installation in Kubernetes. I have tried running single cypress tests, full suites, and through circle CI and have not had a single launch finish properly. I've used custom launch configurations and "out of the box" configurations.

Expected behavior
Launches should successfully finish.

Screenshots

image

filename.match(/#\d+-(.*)/)[0]; Cannot read property '0' of null

I following the instructions as in readme file.

  1. installed both dependencies

  2. Added reportportal options in cypress.json
    {
    "defaultCommandTimeout": 10000,
    "env": {
    "baseURL": "my url"
    },
    "projectId": "pyvpcd",

    "reporter": "agent-js-cypress/rp-reporter.js",
    "reporterOptions": {
    "endpoint":"https://web.demo.reportportal.io",
    "token":"d1726dd7-5dc8-4cf2-82e7-e08aee5acf67",
    "launch":"default_TEST_EXAMPLE",
    "project":"default_personal",
    "description":"PROJECT_DESCRIPTION",
    "isLaunchMergeRequired":true
    }
    }

  3. Added cypress.js under scripts and copied the code (I haven't made any changes to code)

  4. Added a script in package.json.
    "cypress": "node scripts/cypress.js"

When I run tests, I get below error from report portal agent:

/Cypress/node_modules/reportportal-client/lib/helpers.js:9
const launchNumberAndId = filename.match(/#\d+-(.*)/)[0];
^
TypeError: Cannot read property '0' of null
at getIdFormFileName (Cypress/node_modules/reportportal-client/lib/helpers.js:9:58)
at Array.map ()
at Object.readLaunchesFromFile (/Cypress/node_modules/reportportal-client/lib/helpers.js:35:27)

My questions are:

  1. Why is "isLaunchMergeRequired" set to true in cypress.json? - If I set to false, no error is thrown. However, nothing is logged in ReportPortal.
  2. The code you have provided to add in cypress.js - It only executes mergeLaunches code..? I cannot see anything for creating launch. Is there anything that I need to change?
  3. Do you have an example of cypress and reportPortal integration?
  4. How can I resolve my issue?

Thanks,
Vibha

Report Portal Launch when executed in Jenkins not finished

Hi,

My project is configured with cypress client according to the instruction of this repository.
I've executed it locally integrated with ReportPortal and works OK. However when I execute it on Jenkins (pipeline) even though Jenkins build is success, in Report Portal execution starts fine but never ends. I think it could be some kind of async issue as it seems that report portal is not receiving the end event , but I'm completely lost.

Thanks in advance!

image

Capture all failed screenshots when enable retry in cypress

Trying to integrate one of our project(based on cypress) with RP. we enabled retry in cypress, when an exception happen, it retry and there will be multiple screenshots for each attempt.
by default, this agent only send the first failure screenshot to RP, it will be better if we can use the last one or option to send all failed screenshot to RP.

image

I am not a javascript developer, here is a pr demonstrated what I needed #72

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.