sumcumo / cypress-testrail-reporter

Parse and Post your cypress results to testrail
Apache License 2.0
3 stars 3 forks source link

Field :suite_id is a required field. #2

Closed leafarenuk closed 3 years ago

leafarenuk commented 3 years ago

Hi all,

after following your instructions and trying to send information to Testrail I got the following error:

Error: Field :suite_id is a required field.

Full stacktrace:

Start Test Rail Export [ 'test', 'mochawesomeReport.json', false, [], [] ]
Test results parsed []
Passed: [ 0 ]
Skipped: [ 0 ]
Failed: [ 0 ]
parsedTestResults [
  '{"analysis":{"passed":0,"failed":0,"skipped":0},"results":[{"file":"PRIVATE","cases":{}}],"testRailCases":[]}'
]
cids [ [] ]
Add Run tets [ [] ]
/Users/PRIVATE/node_modules/@sum.cumo/cypress-testrail-reporter/dist/reporter/index.js:80
        throw new Error(e.response.data.error || e);
              ^

Error: Field :suite_id is a required field.
    at onError (/Users/PRIVATE/node_modules/@sum.cumo/cypress-testrail-reporter/dist/reporter/index.js:80:15)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
error Command failed with exit code 1.

Maybe the Testrail API have changed to require the suiteID?

ma-jahn commented 3 years ago

@leafarenuk Thank you for your feedback.

I'll doublecheck with a Testrail 7.1 instance and get back to you asap. If i can't reproduce i'll make the suite_id configurable.

Cheers

ma-jahn commented 3 years ago

Hi @leafarenuk

in the testrail docs i found the following

suite_id | int | The ID of the test suite for the test run (optional if the project is operating in single suite mode, required otherwise)

So i assume you are trying to use the cypress testrail reporter in a multi suite mode (if that's the correct name). To get this working for you i'll have to allow a suite_id to be passed from outside.

Would the following work for you and your use case?

yarn cypress-testrail-reporter --name SOME_NAME --reportFilename PATH_TO_YOUR_REPORT --suiteId 123

Alternatively a suite ID could also be maintained in the cypress.json (as a fallback).

leafarenuk commented 3 years ago

@ma-jahn thanks for your investigation and answer!

yes that should be fine.

I think it would be also good to set the suiteId in cypress.json. That would everyone who uses the "multi suite mode"

ma-jahn commented 3 years ago

Hi @leafarenuk

the merge request was merged #3 and you should be able to install Version 1.2.6.

There are 2 ways of setting the suiteId.

  1. Within your testrailReporter section of your cypress.json
  2. As argument like yarn cypress-testrail-reporter --suiteId "123"

Please let me know if this works for you. Cheers!