From ed86a6b48fa7ea30a3bd04b026a5579fcac82d38 Mon Sep 17 00:00:00 2001 From: Justyna Olszak Date: Tue, 11 Jan 2022 10:08:28 +0100 Subject: [PATCH] Udjust json structure --- core/util/writeXrayReport.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/util/writeXrayReport.js b/core/util/writeXrayReport.js index 31ce6effd..5c103fda9 100644 --- a/core/util/writeXrayReport.js +++ b/core/util/writeXrayReport.js @@ -22,6 +22,8 @@ module.exports = function (config, reporter) { 'iterations': [], 'testInfo': {} }; + const metadata = testCase[0].pair.metadata; + const projectKey = metadata ? metadata[0].split('-')[0] : ''; testCase.forEach((testedViewport) => { let { pair: { viewportLabel: name }, status } = testedViewport; @@ -32,9 +34,9 @@ module.exports = function (config, reporter) { } xrayTestResult.iterations.push({ name, status }); }); - xrayTestResult.status = testStatus; - xrayTestResult.testInfo.requirementKeys = testCase[0].pair.metadata; + xrayTestResult.testInfo.requirementKeys = metadata; + xrayTestResult.testInfo.projectKey = projectKey; xrayTestResult.testInfo.summary = testCase[0].pair.label; xrayTestResult.testInfo.type = "Generic"; transformedTestCases.push( @@ -42,13 +44,16 @@ module.exports = function (config, reporter) { ); } + debugger; return transformedTestCases; } function transformToXrayJson (json) { const results = {} const namedTestCases = _.groupBy(json, 'pair.label'); - return results.tests = transformTestCases(namedTestCases); + + results.tests = transformTestCases(namedTestCases); + return results; } logger.log('Writing Xray json report');