Closed JamesFrancisco closed 2 years ago
Hi James, you did not export from Test execution. You have to set testsExportedFromTestExecution:false
So, if the feature was exported from a Jira x-ray test execution, the setting is: testsExportedFromTestExecution:false not, testsExportedFromTestExecution:true?
no the contrary if the feature was exported from a Jira x-ray test execution, the setting is: testsExportedFromTestExecution:true
and your feature file should be like
` @id-of-your-test-execution @QA-346 Feature: FEEN BDD Evaluation Test Execution
@TEST_FEEN-688 Scenario: BDD Smoke Test Login Given I navigate to FEENIX login page And I enter FEENIX username "James.Francisco@invitationhomes.com" And I enter FEENIX password "****" And I click FEENIX login button Then I see "HOME AVAILABILITY" page `
@medtoure18
I am getting the error mentioned by @JamesFrancisco when I keep the setting testsExportedFromTestExecution:false
And I am getting below error when I keep the setting testsExportedFromTestExecution:true
examples:[] C:\Amit\Projects\CodeceptJS_Playwright_POC\node_modules\mocha\lib\runner.js:906 throw err; ^
SyntaxError: Unexpected token B in JSON at position 0
at JSON.parse (
Hi @amitasil Can i see your feature fille ?
@medtoure18
@SP-10 @REQ_SP-7 Feature: Navigate to Personal Insurance page In order to see the Personal Insurance details on the Steadfast website As a persona I want to be able to launch the Personal Insurance page successfully
@TEST_SP-8 @TESTSET_SP-9 Scenario: View 'Personal Insurance' heading on the Personal Insurance page Given I am on the Steadfast home page When I click on "Find out more" button for Personal Insurance Then I should see the Personal Insurance page And I should see the "Personal Insurance" page heading
@amitasil The crash is on that means, we did not get a json with the excution_id jira. can you go on node_modules\codeceptjs-xray-helper\index.js and comment line 129 and activate mode debug. and see if you get an error message.
Other question: @SP-10 => is your execution_id??
@medtoure18
Yes, SP-10 is the test execution id.
After commenting line# 129, I am getting this:
examples:[] SEND TO XRAY=>{ "testExecutionKey": "SP-10","info" : {"startDate" : "2021-11-22T20:37:42+11:00", "finishDate" :"2021-11-22T20:37:42+11:00","revision": "","description" : "Results of test execution ", "testEnvironments": },"tests" : [{"testKey":"TEST_SP-8","status":"PASS", "examples":[],"comment" : "Successful execution" }]} XRAY RESPONSE=>Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html
These are my configs:
xrayReport: {
require: "codeceptjs-xray-helper",
enabled: true,
debug:true,
jira_url: 'https://amitrawat.atlassian.net',
jira_user: 'amit.rawat.1982@gmail.com',
jira_password: 'mypassword',
test_revison: '',
testEnvironments: '',
testsExportedFromTestExecution:true
}
FYI: I am using CodeceptJS with Playwright: https://codecept.io/playwright/#setup
@amitasil
Ok, you need to use a jira token instead of password.
because, instead of given a json response with confirmation jira is returning this:
XRAY RESPONSE=>Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html
you can create a token from jira
https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
and replace in your conf
jira_password: '@mitAsil2606',
by jira_password: 'your_token',
Thanks @medtoure18 !!
Shall I keep the line# 129 commented in the index.js file?
By the way, I am getting this now:
<status><status-code>404</status-code><message>null for uri: https://amitrawat.atlassian.net/rest/raven/1.0/import/execution</message></status>
@amitasil yes for now, you can keep the line commented you get a 404 with your token as password?
@medtoure18
Getting message this now:
examples:[]
config:
xrayReport: {
require: "codeceptjs-xray-helper",
enabled: true,
debug:false,
jira_url: 'https://amitrawat.atlassian.net',
jira_user: 'amit.rawat.1982@gmail.com',
jira_password: 'oIqtascgdtAQV5wgKIZUB21A',
test_revison: '',
testEnvironments: '',
testsExportedFromTestExecution:true
}
@amitasil
you dont see:
SEND TO XRAY=>{ "testExecutionKey": "SP-10","info" : {"startDate" : "2021-11-22T20:37:42+11:00", "finishDate" :"2021-11-22T20:37:42+11:00","revision": "","description" : "Results of test execution ", "testEnvironments": },"tests" : [{"testKey":"TEST_SP-8","status":"PASS", "examples":[],"comment" : "Successful execution" }]}
anymore?
@medtoure18 No, it's just "examples:[]"
CodeceptJS v3.2.1
Using test root "C:\Amit\Projects\CodeceptJS_Playwright_POC"
Navigate to Personal Insurance page @SP-10 @REQ_SP-7 --
In order to see the Personal Insurance details on the Steadfast website
As a persona
I want to be able to launch the Personal Insurance page successfully
View 'Personal Insurance' heading on the Personal Insurance page @TEST_SP-8 @TESTSET_SP-9
Given I am on the Steadfast home page
When I click on "Find out more" button for Personal Insurance
Then I should see the Personal Insurance page
And I should see the "Personal Insurance" page heading
√ OK in 66593ms
OK | 1 passed // 1m
examples:[]
@medtoure18
After turning on the debug, I can see this:
examples:[]
SEND TO XRAY=>{ "testExecutionKey": "SP-10","info" : {"startDate" : "2021-11-22T21:58:23+11:00", "finishDate" :"2021-11-22T21:58:23+11:00","revision": "","description" : "Results of test execution ", "testEnvironments": },"tests" : [{"testKey":"TEST_SP-8","status":"PASS", "examples":[],"comment" : "Successful execution" }]}
XRAY RESPONSE=><?xml version="1.0" encoding="UTF-8" standalone="yes"?><status>**<status-code>404</status-code>**<message>null for uri: https://amitrawat.atlassian.net/rest/raven/1.0/import/execution</message></status>
Not sure why even after adding the API token, I am getting this?
@amitasil i just realised that you are using jira cloud, i never tested the plugin with jira cloud. Have you tried to post directly to your xray with postman?
@medtoure18
Can you give me the payload for the POST request, so that I can try in Postman?
@amitasil
you already have the playload :-)
just this json
{ "testExecutionKey": "SP-10","info" : {"startDate" : "2021-11-22T21:58:23+11:00", "finishDate" :"2021-11-22T21:58:23+11:00","revision": "","description" : "Results of test execution ", "testEnvironments": },"tests" : [{"testKey":"TEST_SP-8","status":"PASS", "examples":[],"comment" : "Successful execution" }]}
for more info: https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-CucumberJSONresultsMultipart
the plugin is only creating this json:
@medtoure18
Tried with Postman
URL used: https://xray.cloud.getxray.app/api/v2/import/execution
Body:
{
"testExecutionKey": "SP-10",
"info": {
"startDate": "2021-11-22T22:41:25+11:00",
"finishDate": "2021-11-22T22:41:25+11:00",
"revision": "",
"description": "Results of test execution ",
"testEnvironments": ["browser:chrome", "linux"]
},
"tests": [{
"testKey": "TEST_SP-8",
"status": "PASS",
"examples": [],
"comment": "Successful execution"
}]
}
Authorization: Basic Auth with username (jira email) and password (Jira API Key)
Response received:
{"error":"Could not find authentication data on request"}
@amitasil Are you sur for the URL Because in the plugin you added : https://amitrawat.atlassian.net
@medtoure18 This is what I've got from: https://docs.getxray.app/display/XRAYCLOUD/REST+API
@amitasil have you created your token like this: https://docs.getxray.app/display/ProductKB/%5BXray+Cloud%5D+How+to+use+REST+API+with+Xray+for+Jira+Cloud
@medtoure18 I am able to send request to XRay via Postman successfully now.I have to create token using the link you have mentioned and before hitting the "https://xray.cloud.getxray.app/api/v2/import/execution" request, I have to get the bearer token from the response of "https://xray.cloud.getxray.app/api/v2/authenticate".
Can you please work on updating your solution to work with the Cloud instance?
This is critical for our scenarios.
Hi @amitasil So if i understand, with jira cloud we need to moke each time 2 requests instead of one? In my side i dont have these days the time to work on the plugin. But you can make à pull request to add the case for jira cloud and i will acept it
@medtoure18 Yes, we have to make two requests.
I'll try to raise a PR and send it across as and when I get some time.
Thanks!! :)
The creation of the data package for transmission to the JIRA server fails when testsExportedFromTestExecution:is set to true.
Helper extract from codecept.comf.js xrayReport: { require: "codeceptjs-xray-helper", enabled: true, debug:true, jira_url: 'https://invitationhomes.atlassian.net', jira_user: 'james.francisco@invitationhomes.com', jira_password: '****', test_revison: '001', testEnvironments: '["browser:chrome", "Linux"]', testsExportedFromTestExecution:true }
Feature file contents:
@QA-346 Feature: FEEN BDD Evaluation Test Execution
@TEST_FEEN-688 Scenario: BDD Smoke Test Login Given I navigate to FEENIX login page And I enter FEENIX username "James.Francisco@invitationhomes.com" And I enter FEENIX password "****" And I click FEENIX login button Then I see "HOME AVAILABILITY" page
Stack Trace: Error processing global.after event: TypeError: Cannot read property 'split' of undefined at /Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs-xray-helper/index.js:106:72 at Array.forEach ()
at EventEmitter. (/Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs-xray-helper/index.js:102:26)
at EventEmitter.emit (events.js:219:5)
at EventEmitter.emit (domain.js:482:12)
at Object.emit (/Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs/lib/event.js:117:28)
at done (/Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs/lib/codecept.js:168:13)
at module.exports (/Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs/lib/hooks.js:28:13)
at Codecept.teardown (/Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs/lib/codecept.js:122:5)
at /Users/james.francisco/repos/feenixbdd/node_modules/codeceptjs/lib/codecept.js:173:28