Giter Club home page Giter Club logo

cypress-xray-plugin's People

Contributors

csvtuda avatar dependabot[bot] avatar moritzsalein avatar

Stargazers

 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

cypress-xray-plugin's Issues

Are there any plans to add more features around updating test steps?

Hello, I have really enjoyed using this plugin for my Cypress/X-Ray integration. Thank you for your work! The update test step feature flag gives a quick solution to generate test step information. I was wondering if there are any plans to expand this update test step functionality. Some things that would be useful for me would be:

  • The ability to update the text within the test step with exactly what I want, not just a copy of the code
  • The ability to update multiple test steps within a test
  • The ability to update the data and expected result fields within the test steps

Error: `Invalid time value`

Hey guys.

I have a problem when I finish running my tests, it uploads it to x-ray, but it is giving an error as shown in the screenshot below

image

Error: `Failed to configure Jira client: no viable authentication method was configured`

Description

I have set up the jira server authentication method for the xray plugin, and tested my PAT using postman. However, the authentication is still not succeeding

Cypress version

13.6.2

Plugin version

6.0.0

Jira/Xray type

Server

Configuration

run: pnpm nx e2e app-e2e --skip-nx-cache --prod JIRA_API_TOKEN=${{ secrets.JIRA_API_TOKEN }} JIRA_TEST_EXECUTION_ISSUE_KEY=${{ inputs.testKey }} -- --baseUrl=https://app-${{ inputs.env || 'dev' }}.domain.com --record --parallel --key=${{ secrets.CYPRESS_DASHBOARDS_KEY }} --ci-build-id=${{ github.run_id }} --tag "${{ inputs.ENV }}, ${{ github.run_id}}"

await configureXrayPlugin(config, {
    jira: {
      projectKey: 'PREZ',
      url: 'https://jira.me.com',
      attachVideos: false,
    },
    xray: {
      uploadScreenshots: true,
    },
    cucumber: {
      featureFileExtension: '.feature',
      downloadFeatures: false,
      uploadFeatures: true,
    },
  });

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

Prevent backgrounds from becoming precondition issues

In continuation to the previous issues 79, 85 and 84, I have put many test steps in Background

  Background: Login
    Given user opens login page
    When user fills username with "login"
    And user fills password with "psw"
    And user clicks on login
    And user checks if language is set to English

However now I see a new pre condition ticket created with title Login (test steps were uploaded in this ticket). It should not be considered as a login pre condition test as it always part of the scenarios in the feature, that is the purpose of Background in Features to sum up the common steps.
2023-06-26 13_12_02-

Error: `@badeball/[email protected]: The engine is incompatible`

I am receiving this error in node v16.20.0 for "cypress-xray-plugin": "4.0.1". The documentation states v15 or above is required.

error @badeball/[email protected]: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "16.20.0"
error Found incompatible module

Installing node v18 resolves the issue but is incompatible with many of my projects.

Jira description and summary modified when nothing but `testExecutionIssueKey` is set

According to the documentation https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/configuration/jira/#testexecutionissuedescription if I add the Test Execution Issue Key and omit adding a description or summary the plugin will not modify the existing description and summary, it is understood that the ones it already contains will remain before loading the results, but after running my tests the plugin adds the default values to each one.

image

image

Attach videos to test execution issues

Cool plugin, thanks a bunch.
It would be lovely to have an option to upload any videos to the execution issue (as an attachment) in Jira, is that planned?

Error: `Cannot find module 'axios'`

When including the plugin as a testing dependency into a Cypress project, it causes Cypress to fail when running any tests due to a failed axios import.

Expected Behavior

The plugin should not result in an import error on Cypress test run setup.

Current Behavior

Currently, when running either npx cypress run or npx cypress open, the following error appears:

$ npx cypress run

Your configFile threw an error from: C:\repositories\some-repo\cypress.config.ts

The error was thrown while executing your e2e.setupNodeEvents() function:

Error: Cannot find module 'axios'
Require stack:
- C:\repositories\some-repo\node_modules\cypress-xray-plugin\src\credentials.js
- C:\repositories\some-repo\node_modules\cypress-xray-plugin\src\util\config.js
- C:\repositories\some-repo\node_modules\cypress-xray-plugin\src\hooks.js
- C:\repositories\some-repo\node_modules\cypress-xray-plugin\plugin.js
- C:\repositories\some-repo\cypress.config.ts
- C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js
- C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\require_async_child.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._resolveFilename (C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\tsconfig-paths\lib\register.js:75:40)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\repositories\some-repo\node_modules\cypress-xray-plugin\src\credentials.js:7:33)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .js] (C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\ts-node\dist\index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\repositories\some-repo\node_modules\cypress-xray-plugin\src\util\config.js:6:23)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .js] (C:\Users\some-user\AppData\Local\Cypress\Cache\12.3.0\Cypress\resources\app\node_modules\ts-node\dist\index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)

Steps to Reproduce

  1. create an empty cypress project:

    1. npm init (and follow through all the steps, doesn't matter)
    2. npm i -D cypress
  2. install the plugin as a dependency:

    1. npm i -D cypress-xray-plugin
  3. run cypress:

    1. npx cypress run

Manual test steps are removed on results upload

Hello!

I use your Xray plugin to upload test results. I targeted existing manual tests, but unfortunately after the result import the test steps has been disappeared from the tests. Also, if I target generic tests, the test definition is cleared as well. Could you please tell me what can be the problem? Thanks in advance!

Version: 5.1.0

Best regards,
Zoltan Tarsoly

Add note regarding problematic names in documentation

Documentation might want to also point out issues with the '-' character in test names. For whatever reason, XRay will not find a perfect match in a test case that has dashes, possibly to do with the way the the plugin is looking for the test case ID in the test string. The result is creating a new duplicate test issue on each run.

Originally posted by @barnes in #47 (comment)

Test issues without test issue keys not being created as expected

Looking through the documentation, it seems the expectation is that a new test issue will be created for any tests not found in Jira, but that is not currently happening in my case.

Config file e2e:

import { addXrayResultUpload, configureXrayPlugin } from "cypress-xray-plugin/plugin";

...

 e2e: {
    async setupNodeEvents(on, config) {
      await configureXrayPlugin({
        jira: {
          projectKey: 'QTP'
        },
        xray: {
          uploadResults: true
        },
      });
      await addXrayResultUpload(on);
    },
  }, 

Example of CLI warning:

| Cypress Xray Plugin | WARNING | No test issue key found for test "test - general login validation tests tests with good email, bad pass". Skipping result upload for this test.

If I create a test issue in Jira and prefix the test name in Cypress, the upload functions normally. Screenshot and video uploading working as well.

Error: `Cannot use 'in' operator to search for 'title' in undefined`

When executing tests without specifying individual issue keys in their titles, the upload fails with an unexpected error.

Expected Behavior

The plugin should be able to upload test results to Xray without having to specify issue keys in every test title.

Current Behavior

Currently, when running npx cypress run, the following error appears:

$ npx cypress run

[...]

An error was thrown in your plugins file while executing the handler for the after:run event.

The error we received was:

TypeError: Cannot use 'in' operator to search for 'should work' in undefined
    at addTestKeyIfPresent (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/conversion/conversion.js:44:27)
    at toXrayTest (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/conversion/conversion.js:64:10)
    at /home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/conversion/conversion.js:153:35
    at Array.forEach (<anonymous>)
    at /home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/conversion/conversion.js:149:26
    at Array.forEach (<anonymous>)
    at toXrayJSON (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/conversion/conversion.js:148:18)
    at CloudClient.importExecutionResults (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/client/client.js:21:50)
    at afterRunHook (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/src/hooks.js:22:43)
    at Object.handler (/home/runner/work/webinar-cypress-cicd/webinar-cypress-cicd/node_modules/cypress-xray-plugin/plugin.js:10:40)
    at invoke (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:43:18)
    at /home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:59:14
    at tryCatcher (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/bluebird/js/release/method.js:39:29)
    at Object.wrapChildPromise (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:58:23)
    at RunPlugins.execute (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:180:21)
    at EventEmitter.<anonymous> (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:279:12)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (/home/runner/.cache/Cypress/12.3.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:513:28)
    at process.emit (node:domain:489:12)

Steps to Reproduce

  1. create an empty cypress project:

    1. npm init (and follow through all the steps, doesn't matter)
    2. npm i -D cypress
  2. install the plugin as a dependency:

    1. npm i -D cypress-xray-plugin
  3. write a simple test case:

describe("some page", () => {
  it("should work", () => {
    cy.visit("https://example.org");
    cy.get("h1");
  }
}
  1. run cypress:
    1. npx cypress run

Failed to import Cucumber execution: AxiosError: Request failed with status code 400

Hello @csvtuda how are you doing? Sorry to bother again with another problem, but I found some problems using cucumber to send the result to Xray.

Right now my settings are:

// cypress.config.ts
import { defineConfig } from "cypress";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin;
import { addXrayResultUpload, configureXrayPlugin, syncFeatureFile } from "cypress-xray-plugin";
import fix from "cypress-on-fix"
export default defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const fixedOn = fix(on);
    await configureXrayPlugin(config, {
        plugin: {
          debug: true,
        },
        cucumber: {
          featureFileExtension: ".feature",
          uploadFeatures: true
        },
        jira: {
          projectKey: "RPF",
          url: "https://my-project.atlassian.net",
          testExecutionIssueKey: process.env.CYPRESS_TEST_EXECUTION_KEY,
        },
        xray: {
          uploadResults: process.env.CYPRESS_TEST_EXECUTION_KEY !== '',
        },
      });

      await addCucumberPreprocessorPlugin(fixedOn, config);
        await addXrayResultUpload(fixedOn);
        fixedOn("file:preprocessor", async (file) => {
            await syncFeatureFile(file);
            const cucumberPlugin = createBundler({
                plugins: [createEsbuildPlugin(config)],
            });
            return cucumberPlugin(file);
        });

      return config;   
    },
    specPattern: 'cypress/e2e/features/*.feature',
}}
})

And I'm getting the following error:

│ Cypress Xray Plugin │ INFO    │ Importing execution (Cucumber)...
│ Cypress Xray Plugin │ DEBUG   │ Request:  /services/ui/logs/1692659980332_POST_https_xray.cloud.getxray.app_api_v2_import_execution_cucumber_multipart_request.json
│ Cypress Xray Plugin │ INFO    │ Waiting for https://xray.cloud.getxray.app/api/v2 to respond... (10 seconds)
│ Cypress Xray Plugin │ INFO    │ Waiting for https://xray.cloud.getxray.app/api/v2 to respond... (20 seconds)
│ Cypress Xray Plugin │ DEBUG   │ Response: /services/ui/logs/1692660010176_POST_https_xray.cloud.getxray.app_api_v2_import_execution_cucumber_multipart_response.json
| Cypress Xray Plugin │ ERROR   │ Failed to import Cucumber execution: AxiosError: Request failed with status code 400
│ Cypress Xray Plugin │ WARNING │ Execution results import was skipped. Skipping remaining tasks
│ Cypress Xray Plugin │ ERROR   │ Complete error logs have been written to: /services/ui/logs/importExecutionCucumberMultipartError.json

Looking at the response from https_xray.cloud.getxray.app_api_v2_import_execution_cucumber_multipart_response.json I get:

{
   "message":"Request failed with status code 400",
   "name":"AxiosError",
   "stack":"AxiosError: Request failed with status code 400\n    at settle (/services/ui/node_modules/cypress-xray-plugin/node_modules/axios/lib/core/settle.js:19:12)\n    at IncomingMessage.handleStreamEnd (/services/ui/node_modules/cypress-xray-plugin/node_modules/axios/lib/adapters/http.js:570:11)\n    at IncomingMessage.emit (node:events:525:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1359:12)\n    at processTicksAndRejections (node:internal/process/task_queues:82:21)"
}

Add option to disable the plugin for local runs

When trying to run cypress headless without the PAT token as it was prior the cypress xray plugin the test run fails.

An error was thrown in your plugins file while executing the handler for the before:run event.

The error we received was:

Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported.
You can find all configurations currently supported at https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/configuration/authentication/
    at initXrayClient (C:\Projects\node_modules\cypress-xray-plugin\src\util\config.js:110:15)
    at beforeRunHook (C:\Projects\node_modules\cypress-xray-plugin\src\hooks.js:53:33)
    at Object.handler (C:\Projects\node_modules\cypress-xray-plugin\plugin.js:12:41)
    at invoke (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:183:18)
    at C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
    at tryCatcher (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
    at RunPlugins.execute (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
    at EventEmitter.<anonymous> (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
    at EventEmitter.emit (node:events:511:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:511:28)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:944:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Only solution is to comment out the cypress xray plugin.
Is there no way to run the cypress headless without the PAT token?

Prevent imported feature files from changing existing issue data

When importing feature files during feature file synchronization, any existing issue information is replaced with the imported feature file's data (summaries, steps, tags, ...). Having an option at hand for disabling this behaviour would be useful.

The jira ticket title is altered too, although I just wanted to upload the Feature with the background steps together. So either I dont upload anything or my tickets are altered completely (title, tags, cucumber steps), but I wished only the steps to be uploaded or altered.

Originally posted by @alexviz7 in #86 (comment)

`ECONNRESET` error during results upload

I'm stuck figuring out what could be causing this error, and I'm at the point of giving up. This only manifests on my CI/CD pipeline while it works locally, the error message from importExecutionResultsError.json file is:

{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET
   at Function.AxiosError.from (/e2e/node_modules/axios/lib/core/AxiosError.js:89:14)
   at RedirectableRequest.handleRequestError (/e2e/node_modules/axios/lib/adapters/http.js:577:25)
   at RedirectableRequest.emit (node:events:513:28)
   at RedirectableRequest.emit (node:domain:489:12)
   at ClientRequest.eventHandlers.<computed> (/e2e/node_modules/follow-redirects/index.js:14:24)
   at ClientRequest.emit (node:events:513:28)
   at ClientRequest.emit (node:domain:489:12)
   at Socket.socketErrorListener (node:_http_client:502:9)
   at Socket.emit (node:events:513:28)
   at Socket.emit (node:domain:489:12)
   at emitErrorNT (node:internal/streams/destroy:151:8)
   at emitErrorCloseNT (node:internal/streams/destroy:116:3)
   at processTicksAndRejections

System info:
TeamCity as build server
Jira DataCenter + Xray plugin

I've setup authentication using JIRA_API_TOKEN and don't think it's related to this as locally it works.
Plus, don't think it's connection issues between TeamCity and Jira, because another solution that uses node-fetch package works without issues...

Any ideas, thoughts are appreciated

Error: `Cannot resolve cypress-xray-plugin/register`

Registering the plugin's app event listeners currently does not seem to work.

  Running:  language.feature                                                                (1 of 1)
X [ERROR] Could not resolve "cypress-xray-plugin/register"

    cypress/support/e2e.ts:20:7:
      20 │ import 'cypress-xray-plugin/register';
         ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The path "./register" is not exported by package "cypress-xray-plugin":

    node_modules/cypress-xray-plugin/package.json:30:15:
      30 │     "exports": "./index.js",
         ╵                ~~~~~~~~~~~~

  You can mark the path "cypress-xray-plugin/register" as external to exclude it from the bundle, which will remove this error.


Oops...we found an error preparing this test file:

  > cypress\support\e2e.ts

The error was:

Error: Build failed with 1 error:
cypress/support/e2e.ts:20:7: ERROR: Could not resolve "cypress-xray-plugin/register"
    at failureErrorWithLog (C:\Projects\frontend\node_modules\esbuild\lib\main.js:1636:15)
    at C:\Projects\frontend\node_modules\esbuild\lib\main.js:1048:25
    at runOnEndCallbacks (C:\Projects\frontend\node_modules\esbuild\lib\main.js:1471:45)
    at buildResponseToResult (C:\Projects\frontend\node_modules\esbuild\lib\main.js:1046:7)
    at C:\Projects\frontend\node_modules\esbuild\lib\main.js:1075:16
    at responseCallbacks.<computed> (C:\Projects\frontend\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (C:\Projects\frontend\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (C:\Projects\frontend\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:511:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:332:12)
    at readableAddChunk (node:internal/streams/readable:305:9)

TypeError: Cannot read properties of null (reading 'some')
    at afterSpecHandler (C:\Projects\frontend\node_modules\@badeball\cypress-cucumber-preprocessor\lib\add-cucumber-preprocessor-plugin.js:166:47)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (C:\Projects\frontend\node_modules\cypress-on-fix\index.js:32:20)

Originally posted by @alexviz7 in #132 (comment)

Failed to import Cucumber execution: AxiosError: Request failed with status code 400

Description

Hello @csvtuda

I wrote this report in #151 but later saw that you have a bug reporting template.

I am having the same issue as @caique-rd, although I have a manual work around that may give a clue. In summary, I believe the issue is in the @TestName tag.

Even though the docs say to use @TestName:issuekey for Jira cloud instances, the upload only works when the report uses @issuekey. I wonder if certain versions of Jira cloud only accept @issuekey.

Here's the test I did:

Pre conditions:
✅ Issue PRO-100 exists in Jira (cloud instance)

  1. Run a minimal cypress cucumber test
Feature: Minimal Feature

    @TestName:PRO-100
    Scenario: Minimal Scenario
    Given minimal Given
    When minimal When
    Then minimal Then
Given("minimal Given", () => {})
When("minimal When", () => {})
Then("minimal Then", () => {
    expect(false).to.be.true
})
  1. The test fails with the error of this issue: Failed to import Cucumber execution: AxiosError: Request failed with status code 400
│ Cypress Xray Plugin │ INFO    │ Jira username and API token found. Setting up Jira cloud basic auth credentials
│ Cypress Xray Plugin │ INFO    │ Xray client ID and client secret found. Setting up Xray cloud JWT credentials
│ Cypress Xray Plugin │ INFO    │ Authenticating to: https://xray.cloud.getxray.app/api/v2/authenticate...

│ Cypress Xray Plugin │ INFO    │ Fetching necessary Jira issue type information in preparation for Cucumber result uploads...

│ Cypress Xray Plugin │ INFO    │ Preprocessing feature file [PATH]/features/minimal.feature...

│ Cypress Xray Plugin │ INFO    │ Uploading Cucumber test results...
│ Cypress Xray Plugin │ ERROR   │ Failed to import Cucumber execution: AxiosError: Request failed with status code 400
│ Cypress Xray Plugin │ WARNING │ Execution results import was skipped. Skipping remaining tasks
│ Cypress Xray Plugin │ ERROR   │ Complete error logs have been written to [PATH]/logs/importExecutionCucumberMultipartError.json
  1. Edit the cucumber-report.json, remove 'TestName:' in tags[0].name

before edit:

        "tags": [
          {
            "name": "@TestName:PRO-100",
            "line": 3
          }
        ],

after edit:

        "tags": [
          {
            "name": "@PRO-100",
            "line": 3
          }
        ],
  1. Use the Xray REST api https://xray.cloud.getxray.app/api/v2/import/execution/cucumber to upload the cucumber-report
    importCucumberResults(results) {
        cy.request({
            method: 'POST',
            url: 'https://xray.cloud.getxray.app/api/v2/import/execution/cucumber',
            body: results,
            headers: {
                'Authorization': `Bearer ${token}`
            }
        }).then((response) => {
            console.log(response)
        })
    }
  1. Import is successful: a Test Execution is created

Note: if I remove TestName: from the tag in the .feature file, I get an error that indicates that it is required:

│ Cypress Xray Plugin │ INFO    │ Uploading Cucumber test results...
│ Cypress Xray Plugin │ WARNING │ Skipping result upload for scenario: Minimal Scenario
│ Cypress Xray Plugin │ WARNING │   
│ Cypress Xray Plugin │ WARNING │   No test issue keys found in tags of scenario: Minimal Scenario
│ Cypress Xray Plugin │ WARNING │   You can target existing test issues by adding a corresponding tag:
│ Cypress Xray Plugin │ WARNING │   
│ Cypress Xray Plugin │ WARNING │   @TestName:PRO-123
│ Cypress Xray Plugin │ WARNING │   Scenario: Minimal Scenario
│ Cypress Xray Plugin │ WARNING │     Before undefined

Cypress version

13.6.0

Plugin version

5.2.2

Jira/Xray type

Cloud

Configuration

const { defineConfig } = require("cypress");
const { plugins } = require('./cypress/support/plugins')
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
const { addXrayResultUpload, configureXrayPlugin,  syncFeatureFile  } = require("cypress-xray-plugin");
const xraySecrets = require('./secrets/xray.json')
const fix = require('cypress-on-fix')


module.exports = defineConfig({
  projectId: "[HIDDEN]",
  env: {
    XRAY_CLIENT_SECRET: xraySecrets.client_secret,
    XRAY_CLIENT_ID: xraySecrets.client_id,
    JIRA_API_TOKEN: xraySecrets.JIRA_API_TOKEN,
    JIRA_USERNAME: xraySecrets.JIRA_USERNAME,
  },
  video: false,
  chromeWebSecurity: false,
  e2e: {
    retries: process.env.CI ? 1 : 0,
    taskTimeout: 120000,
    experimentalStudio: true,
    specPattern: "**/*.{feature,features,cy.js}",
    waitTimes: {
      debounce: 1100,
      visualCheck: 500,
      nextPage: 1000
    },
    pageLoadTimeout: 15000,
    viewportHeight: 900,
    viewportWidth: 1440,
    watchForFileChanges: false,

    async setupNodeEvents(on, config) {
      // get the environment name passed in as CLI argument:
      // --env environment=staging
      // Cypress places --env CLI args in config.env
      // get the environment file based on the environment name
      const envFile = `./cypress/config/environment.${config.env.environment}.js`
      config.environment = require(envFile).environment
      config.environment.name = config.env.environment
      config.baseUrl = config.environment.baseUrl

      console.log('Environment:', config.environment)

      // setup all of our custom plugins (gmail, readPDF, etc)
      // these plugins expose certain functions that run in Node
      // as opposed to in the Cypress navigator.
      on('task', plugins)

      const fixedOn = fix(on)
      // setup xray
      await configureXrayPlugin(
          config, 
          {
            jira: {
              projectKey: "PRO",
              url: "[HIDDEN]"
            },
            xray: {
              uploadResults: true,
            },
            cucumber: {
              featureFileExtension: ".feature"
            },
        }
      );
      // setup cucumber
      // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
      await preprocessor.addCucumberPreprocessorPlugin(fixedOn, config);
      await addXrayResultUpload(fixedOn);

      // ensure that the logs are printed to the terminal
      require('cypress-terminal-report/src/installLogsPrinter')(on,
        {
          printLogsToConsole: "always"
        });

      fixedOn("file:preprocessor", async (file) => {
        await syncFeatureFile(file);
        const cucumberPlugin = createBundler({
          plugins: [createEsbuildPlugin.createEsbuildPlugin(config)],
        });
        return cucumberPlugin(file);
      });

      return config
    }
  },
});

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

Test steps disappear after results upload

Description

Hello!
I have xray repository with test cases, each test case has steps with an "action" field and an "expected result" field
Screenshot 2023-11-29 at 17 07 44

When I run this plugin, it creates me new issue with the test result
Screenshot 2023-11-29 at 17 10 40

But after running my test case steps are removed:
Screenshot 2023-11-29 at 17 12 15
and there are no additional information in "x-ray history" tab in Jira.

I found this pr https://github.com/Qytera-Gmbh/cypress-xray-plugin/pull/229/files#diff-58fe231e03338f09421bfe4d990494b89b13ad3d3d31677a6170ba820f7243f1

And my question is, Is it expected behavior? Is there any way to not remove steps from the issue? Or maybe I'm using the plugin in the wrong way?

Cypress version

^12.15.0

Plugin version

5.2.1

Jira/Xray type

Cloud

Configuration

No response

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

Using multiple Cypress configs leads to `Your configFile is invalid` errors

Hello together,

We use the plugin with Cypress and several configfiles.
since the upgrade to Cypress V13+ together with Cypress-Xray V5+ we get the error message that our configfile is invalid.

Concrete Versions used here:

"cypress": "^13.2.0",
"cypress-xray-plugin": "^5.0.0"

The Error Message:

Your configFile is invalid: /Users/christoph/projekte/cypress-patch-management/cypress.xray-config.js
It threw an error when required, check the stack trace below:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './plugin' is not defined by "exports" in /Users/.../node_modules/cypress-xray-plugin/package.json
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:697:9)
    at resolveExports (node:internal/modules/cjs/loader:565:36)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/christoph/projekte/cypress-patch-management/cypress.xray-config.js:2:54)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at loadFile (/Users/christoph/Library/Caches/Cypress/13.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:89:14)
    at EventEmitter.<anonymous> (/Users/christoph/Library/Caches/Cypress/13.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:38)
    at EventEmitter.emit (node:events:513:28)
    at process.<anonymous> (/Users/christoph/Library/Caches/Cypress/13.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:513:28)
    at emit (node:internal/child_process:937:14)
   

We use multiple configfiles to control the reported output.
One configfile is specifically responsible for the synchronisation of the tests with Xray. Another is used locally and another reports JUnit results in the pipeline.

This is our specific config for Xray sync:

//cypress.xray-config.js 
const { defineConfig } = require('cypress');
const { addXrayResultUpload, configureXrayPlugin } = require('cypress-xray-plugin/plugin');

module.exports = defineConfig({
  viewportWidth: 1920,
  viewportHeight: 1080,
  pageLoadTimeout: 60000,
  defaultCommandTimeout: 10000,
  video: false,
  e2e: {
    baseUrl: 'someURL',
    includeShadowDom: true,
    async setupNodeEvents(on, config) {
      await configureXrayPlugin({
        jira: {
          url: 'myJiraURL',
          projectKey: 'MYPROJ',
          testExecutionIssueKey: 'myTESTEXECUTION',
          testPlanIssueKey: 'myTESTPLAN',
        },
      });
      await addXrayResultUpload(on);
    },
  },
});

we execute the cypress test run with this command:

npx cypress run --config-file cypress.xray-config.js --env JIRA_API_TOKEN=$JIRA_API_TOKEN

The "default" configfile:

//cypress.config.js
const { defineConfig } = require("cypress");

module.exports = defineConfig({
  trashAssetsBeforeRuns: true,
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
    },
    video: false
  },
});

With using
"cypress": "12.17.3",
"cypress-xray-plugin": "3.3.3"

Everything is working fine as expected

Plugin not working with `4.0.0`

Thank you first of all for the work you ve done to fix the issues I found.
I installed the latest cypress-xray-plugin version 4.0.0 and after that I had an Error on my cypress config file.

Screenshot 2023-07-31 114412

Running cypress with the Jira PAT created the following error:

Your configFile is invalid: C:\Projects\frontend\cypress.config.ts

It threw an error when required, check the stack trace below:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './plugin' is not defined by "exports" in C:\Projects\frontend\node_modules\cypress-xray-plugin\package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:259:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:589:9)
    at resolveExports (node:internal/modules/cjs/loader:571:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:645:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1058:27)
    at Function.Module._resolveFilename (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\tsconfig-paths\lib\register.js:75:40)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:925:27)
    at Module.require (node:internal/modules/cjs/loader:1139:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (C:\Projects\frontend\cypress.config.ts:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1257:14)
    at Module.m._compile (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\ts-node\dist\index.js:857:29)
    at Module._extensions..js (node:internal/modules/cjs/loader:1311:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\ts-node\dist\index.js:859:16)
    at Module.load (node:internal/modules/cjs/loader:1115:32)
    at Function.Module._load (node:internal/modules/cjs/loader:962:12)
    at Module.require (node:internal/modules/cjs/loader:1139:19)
    at require (node:internal/modules/helpers:121:18)
    at loadFile (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:89:14)
    at EventEmitter.<anonymous> (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:38)

Feature file upload fails to target existing issues on Xray cloud

When uploading feature files to Xray cloud, scenarios annotations containing test issue keys of the form @TestName:CYP-123 seem to be ignored.

Expected Behavior

The plugin should be able to parse cloud-specific tags as well, not only the server-specific tags @CYP-123.

Current Behavior

Currently, when importing Cucumber tests, the plugin seems to ignore tags such as @TestName:CYP-123.
Instead, regular name-based test issue matching takes place.

Steps to Reproduce

  1. create a feature file containing such a tag
Feature: Minimal example
    @TestName:CYP-123
    Scenario: Minimal scenario
        Given something
  1. create step definitions
Given("something", function() {
  expect(true).to.be.true;
});
  1. run npx cypress run
  2. change the scenario's name to Minimal scenario 2
  3. run npx cypress run
  4. observe a new test case issue being created

Redundant error messages for before and after hooks when plugin is disabled

Description

When we run cypress locally, we do not report to JIRA, and so have the plugin disabled.
│ Cypress Xray Plugin │ INFO │ Plugin disabled. Skipping further configuration
Followed by
│ Cypress Xray Plugin │ ERROR │ Skipping before:run hook: Plugin misconfigured: configureXrayPlugin() was not called
If the plugin is disabled, should this not be either a WARNING or INFO ?

Cypress version

13.1.0

Plugin version

5.2.1

Jira/Xray type

Cloud

Configuration

npx cypress run --env PLUGIN_ENABLED=false

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

Add configuration option for execution issue title / description

As we expand our test set, being able to better label the Test Execution issues would be great. Simply being able to set the title as a configuration setting would be great to label the non-prod region, sprint ID, etc to make it easier to identify on the Jira board.

Error: `Cannot read properties of undefined (reading 'key')`

cypress-xray-plugin version - 3.3.3
cypress version - 12.16.0
I am trying to upload the e2e test execution into Xary server, I am getting error like

Cypress Xray Plugin | ERROR | Failed to upload results to Xray: "TypeError: Cannot read properties of undefined (reading 'key')"

Please find the cypress config

// @ts-ignore
import {defineConfig} from "cypress"
import { addXrayResultUpload, configureXrayPlugin } from "cypress-xray-plugin/plugin"


export default defineConfig({
  reporter: 'junit',
  video:false,
  reporterOptions: {
    mochaFile: 'cypress/results/output.xml',
  },
  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    async setupNodeEvents(on, config) {
        // implement node event listeners here
        await configureXrayPlugin({
          plugin: {
            debug: true,
            overwriteIssueSummary: true
          },
          jira: {
              projectKey: "projectkey",
              url:"jiraurl"
          },
          xray: {
            statusPassed: "SUCCESS",
            uploadResults: true
         },
      });
      await addXrayResultUpload(on);
    },
    baseUrl: 'base url',
  },
})

my test.cy.ts file looks like

//@ts-nocheck

describe('The UserName/Password Field', () => {
    beforeEach(()=>{
        cy.visit('/')
    });
    it("Load the Kuma Title", () => {
      cy.get('input[name="username"]').type('username');
      cy.wait(500);
      cy.get('[data-cy="login"]').should('exist').click();
      cy.wait(4000);
      cy.get('[data-cy="kuma"]').should('exist').click();
      cy.wait(2000);
    });
});

in Gitlab CI it's throwing the type error "Failed to upload results to Xray: "TypeError: Cannot read properties of undefined (reading 'key')"

image

Add Xray test environment support

Hello @csvtuda ,

it would be great if we can add the test environment for the test execution result. It is an Xray field, not a Jira one.

Thanks in advance!

Best,
Zoltan

Integration with `cypress-multi-reporters`

Is it possible to use this plugin along with any other reporter using cypress-multi-reporters? If so, could you provide an example for the set up? In my case, I need to generate a mochawesome html report.

Plugin overwrites existing issue summaries

Hi,

As continuation to the previous issue I realized that some Jira test tickets, that had the prefix 'Test Ui:' would be altered or not be found. Is there a way to put a prefix in the configuration or do I have to delete the 'Test-UI' prefix or write it in the scenario too?
2023-06-26 12_31_05-cypress config ts -Visual Studio Code  Administrator

Multiple plugins cannot be executed in the `after:run` hook

Hello!

I use your Xray plugin which is a great addition along with cypress-mochawesome-reporter. Since I added your plugin to my project the Mochawesome Report is not executed after the run to merge the JSONs and to create the HTML report. Do you have idea what can be the problem? Thanks in advance!

Version: 5.1.0

Best regards,
Zoltan Tarsoly

Error: `Cannot resolve cypress-xray-plugin/plugin`

When I run my tests in the CLI I get the follow error:

Error: Webpack Compilation Error
./cypress/support/e2e.js
Module not found: Error: Can't resolve 'cypress-xray-plugin/plugin' in '/Users/caiquecoelho/Documents/Projects/directory_ui_test_framework/cypress/support'
resolve 'cypress-xray-plugin/plugin' in '/Users/caiquecoelho/Documents/Projects/directory_ui_test_framework/cypress/support'
  Parsed request is a module
  using description file: /Users/caiquecoelho/Documents/Projects/directory_ui_test_framework/package.json (relative path: ./cypress/support)
    Field 'browser' doesn't contain a valid alias configuration
    Looked for and couldn't find the file at the following paths:

I'm using the 4.0.1 version and my configurations look like this:
e2e.js

import "cypress-xray-plugin/plugin";

cypress.config.js

const {addXrayResultUpload, configureXrayPlugin} = require("cypress-xray-plugin")
....
module.exports = async (on, config) => {
  await configureXrayPlugin(
    config,
    {
        jira: {
            projectKey: "MY_PROJECT_KEY",
            url: "MY_PROJECT_URL",
            testExecutionIssueKey: "MY_PROJECT_TEST_EXECUTION_ISSUE_KEY"
        },
    }
  );
  await addXrayResultUpload(on);

  return config
}

I'm running the test with:

cypress run --env JIRA_PROJECT_KEY='RPF',JIRA_USERNAME='<MY_EMAIL>',JIRA_API_TOKEN='<MY_API_TOKEN>',XRAY_CLIENT_ID='<MY_CLIENT_ID>',XRAY_CLIENT_SECRET='<MY_CLIENT_SECRET>''

Warning: `Skipping result upload for test`

Description

When both Cypress and Cucumber specs are in use, the plugin seemingly tries to look for Jira issue keys in Cucumber scenario titles, although it should look through the scenario tags instead. In other words, the plugin mistakenly treats Cucumber results upload as Cypress results upload.

Feature file:

Feature: Testing a single scenario

    @TEST_CYPLUG-25
    Scenario: Single scenario test
        Given Something
        When Something happens
        Then Something should happen

Spec file:

describe("CYPLUG-43 template spec", () => {
    it("passes", () => {
        cy.visit("https://example.cypress.io");
    });
});

Output:

│ Cypress Xray Plugin │ WARNING │ Skipping result upload for test: Testing a single scenario Single scenario test
│ Cypress Xray Plugin │ WARNING │
│ Cypress Xray Plugin │ WARNING │   No test issue keys found in title of test: Single scenario Single scenario test
│ Cypress Xray Plugin │ WARNING │   You can target existing test issues by adding a corresponding issue key:
│ Cypress Xray Plugin │ WARNING │
│ Cypress Xray Plugin │ WARNING │   it("CYPLUG-123 Testing a single scenario Single scenario test", () => {
│ Cypress Xray Plugin │ WARNING │     // ...
│ Cypress Xray Plugin │ WARNING │   });
│ Cypress Xray Plugin │ WARNING │
│ Cypress Xray Plugin │ WARNING │   For more information, visit:
│ Cypress Xray Plugin │ WARNING │   - https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/guides/targetingExistingIssues/

Cypress version

13.6.1

Plugin version

6.0.0

Jira/Xray type

Server

Configuration

import * as preprocessor from "@badeball/cypress-cucumber-preprocessor";
import * as createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { defineConfig } from "cypress";
import fix from "cypress-on-fix";
import { addXrayResultUpload, configureXrayPlugin, syncFeatureFile } from "cypress-xray-plugin";

module.exports = defineConfig({
    video: false,
    chromeWebSecurity: false,
    e2e: {
        supportFile: false,
        experimentalStudio: true,
        specPattern: "**/*.{feature,features,cy.js,cy.ts}",
        async setupNodeEvents(on, config) {
            const fixedOn = fix(on);
            await configureXrayPlugin(config, {
                jira: {
                    projectKey: "CYP",
                    url: "https://xray-demo3.getxray.app",
                    testExecutionIssueSummary: `Execution ${new Date().toLocaleString()}`,
                    attachVideos: true,
                },
                xray: {
                    uploadResults: true,
                    testEnvironments: ["DEV"],
                },
                cucumber: {
                    featureFileExtension: ".feature",
                    uploadFeatures: true,
                },
                plugin: {
                    debug: false,
                },
            });
            await preprocessor.addCucumberPreprocessorPlugin(fixedOn, config);
            await addXrayResultUpload(fixedOn);
            fixedOn("file:preprocessor", async (file: Cypress.FileObject) => {
                syncFeatureFile(file);
                const cucumberPlugin = createBundler({
                    plugins: [createEsbuildPlugin.createEsbuildPlugin(config)],
                });
                return cucumberPlugin(file);
            });

            return config;
        },
    },
});

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

`filename.replaceAll` is not a function in Bamboo build

I'm facing with a problem while trying to upload the results to Jira in a Bamboo build created to run e2e tests.

The message shown is the following:
githubscreenshot

I have a Warning message "filename.replaceAll is not a function" in all the function where I put it the label to link with the Jira ticket.

Add way to disambiguate multiple tags in feature files

Hello,

I have already implemented a Cypress Cucumber Test Automation Framework running with all test scenarios each of them have one or more tags. Some Scenarios have the same Ticket Tag because I test them on different languages. On Bamboo I had solved this issue with a language Tag, so therefore I had 2 separate builds running one for each tag/language. Now I want to do the same with the cypress-xray-plugin, but I get a fail when running the command npx cypress run --env tags="@EN" JIRA_API_TOKEN="PATToken" with the error: Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported.

What did I do wrong?

If I leave the tag out I get an error that I have multiple tests with same tag. Also I have an issue with another plugin cy-verify-downloads which works perfectly in open mode.

Failed to fetch Jira field ID for field with name: summary

I'm getting the following error:

Successfully retrieved data for 209 fields
│ Cypress Xray Plugin │ INFO    │ Authenticating to: https://xray.cloud.getxray.app/api/v2/authenticate...
│ Cypress Xray Plugin │ ERROR   │ Failed to fetch issue summaries
│ Cypress Xray Plugin │ ERROR   │ ┊ Failed to fetch Jira field ID for field with name: summary
│ Cypress Xray Plugin │ ERROR   │ ┊ Make sure the field actually exists
Authentication successful.
│ Cypress Xray Plugin │ INFO    │ Retrieving test types...
│ Cypress Xray Plugin │ SUCCESS │ Successfully retrieved test types for 1 issues
│ Cypress Xray Plugin │ WARNING │ Skipping result upload for test: Login / Common RPF-1462 Check correct behavior forgot password flow
│ Cypress Xray Plugin │ WARNING │ ┊ 
│ Cypress Xray Plugin │ WARNING │ ┊ Summary of corresponding issue is missing: RPF-1462
│ Cypress Xray Plugin │ WARNING │ ┊
│ Cypress Xray Plugin │ WARNING │ No native Cypress tests were executed. Skipping native upload.
│ Cypress Xray Plugin │ WARNING │ Execution results import was skipped. Skipping remaining tasks

I'm on version 4.0.1, my test RPF-1462 exists in Xray and has a summary field called summary, the default one from Jira

Unable to customize summary when uploading results

Hello!

I have the plugin successfully configured and uploading results, but I am attempting to provide a custom value for the "Summary" field (for example) of my XRay test execution without success. I have tried using the command line, the cypress.env.json file, the cypress.config.js file, and setting the env object directly in an example as described in the Cypress docs. I always get the same result, which is the default test execution summary "Execution results [timestamp]" with the default description containing the Cypress version and the browser version. I had the same issue when attempting to customize the description field.

Latest example that I expect to customize the summary field:

it(
    "PRJ-12345 My Example Test",
    {
      tags: ["@smoke", "@slow"],
      env: {
        JIRA_FIELDS_SUMMARY: 'test summary'
      }
    },
...
}

Result:

Screenshot 2023-10-26 at 5 02 57 PM

Am I correctly understanding how to use this feature? Am I missing something obvious? I have confirmed in each case that the environment variable is set via Cypress.env(). Happy to provide any other details for troubleshooting.

Cypress version: 11.2.0
Plugin version: 5.2.0
Node version: 18.12.0

I appreciate the plugin and any assistance here.

Emails from Jira say changes were made on Xray ticket when none were made

Hello,

First of all I want to tell you that the xray plugin configuration is up on Bamboo CI/CD running. There we have set the plugin true on Bamboo and false in the cypress configuration.
However I receive each time the test execution is running hundrets of emails that all my test tickets had changes in their titles.
Screenshot 2023-10-12 112510

In the logs i also see this:

build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ Resetting issue summary of issue: TC-2872
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ ┊ 
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ ┊   Summary pre sync:  Test UI: Bitmasken als Projektadministrator anzeigen
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ ┊   Summary post sync: Bitmasken als Projektadministrator anzeigen
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ ┊
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ Editing issue...
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ Request:  /appl/bamboo-agent/xml-data/build-dir/TC-TCF1354-RET/frontend/trustcenter/logs/1696936828255_PUT_https_devstack.vwgroup.com_jira_rest_api_2_issue_TC_2872_request.json
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ Response: /appl/bamboo-agent/xml-data/build-dir/TC-TCF1354-RET/frontend/trustcenter/logs/1696936828950_PUT_https_devstack.vwgroup.com_jira_rest_api_2_issue_TC_2872_response.json
build  10-Oct-2023 13:20:28  │ Cypress Xray Plugin │ DEBUG   │ Successfully edited issue: TC-2872

It looks like Test UI: is deleted and then re edited.

Test steps being deleted although `XRAY_STEPS_UPDATE` is `false`

Test step information is being deleted from Jira Test issues even though the environment variable XRAY_STEPS_UPDATE is set to false. I'm using cypress 12.14.0 and cypress-xray-plugin 4.0.3. Is there a way we can keep the manually written test steps without updating or deleting them when we send in a new test execution from the plugin?

Generic test definitions are removed on results upload

Also, if I target generic tests, the test definition is cleared as well. Could you please tell me what can be the problem?

Originally posted by @ztarsoly in #209


I can reproduce the problem and have identified the bug/missing piece.

However, I have never worked with generic tests, so I could use some input on how to approach this @ztarsoly.

Would you like to be able to:

  1. keep existing test definitions?
  2. change test definitions through the plugin?

I don't really know what to do with them.

Add option to choose Jira API version

Would be interesting to have a key in plugin configuration object to choose the jira api version?

something like

plugin: {
  jiraApiVersion: 2,
  debug: true
}

For some reason the plugin is working locally, but isn't in CI, only the 3.3.3 plugin version, that apparently uses the version 2 JIRA API.

I have set up all credentials needed.
screen-plugin

But even so I got the summary error:
image

Code snippet not shown when test fails

In continuation to the issue 79, I made a test fail on purpose to see how the results will be shown.
No code snipet is shown just a screenshot is uploaded with no further information.
2023-06-26 18_30_56-Execute Test TC-2451 - DevStack Jira — Mozilla Firefox

Error: `Failed to configure Xray client: Jira cloud credentials detected, but the provided Xray credentials are not Xray cloud credentials`

Description

Command used to run:

npx cypress run --env JIRA_USERNAME="", JIRA_API_TOKEN="",XRAY_CLIENT_ID="",XRAY_CLIENT_SECRET=""

jira token created based out: https://docs.searchunify.com/Content/Content-Sources/Atlassian-Jira-Confluence-Authentication-Create-API-Token.htm#:~:text=Log%20into%20Jira%20Software%20or,Click%20Create%20API%20token.

Xray credential created: https://docs.getxray.app/display/XRAYCLOUD/Global+Settings%3A+API+Keys

I am getting this error:

Error: Failed to configure Xray client: Jira cloud credentials detected, but the provided Xray credentials are not Xray cloud credentials
You can find all configurations currently supported at: https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/configuration/authentication/
    at initClients (C:\Cypress_project\node_modules\cypress-xray-plugin\src\context.js:238:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async configureXrayPlugin (C:\Cypress_project\node_modules\cypress-xray-plugin\src\plugin.js:37:18)
    at async setupNodeEvents (C:\Cypress_project\cypress.config.js:7:7)

Cypress version

13.6.0

Plugin version

5.2.1

Jira/Xray type

Cloud

Configuration

No response

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.

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.