codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.11k stars 722 forks source link

Codeceptjs cloud xray helper not mapping the configured steps in the test case #4454

Closed Naveen-web-spec closed 1 month ago

Naveen-web-spec commented 1 month ago

Integrate codeceptjs results into Xray/jira with each test steps mapped to the test case

Xray_step1 configured in Codeceptjs test not properly send the result to expected test step.

$ npx codeceptjs run ./tests/login_test.js --steps --verbose


nodeInfo: 16.17.0 osInfo: Windows 10 10.0.19045 cpuInfo: (24) x64 12th Gen Intel(R) Core(TM) i7-12850HX chromeInfo: master_preferences edgeInfo: Chromium (117.0.2045.36) firefoxInfo: undefined safariInfo: N/A If you need more detailed info, just run this: npx codeceptjs info


CodeceptJS v3.6.5 #StandWithUkraine Using test root "C:\Users\naveenkumark\Documents\Automation\X-ray_test" Helpers: Playwright Plugins: xrayImport, commentStep

login -- [1] Starting recording promises Timeouts: » [Session] Starting singleton browser session test something @TEST_WPCLDX-361 On step1:
I am on page "http://localhost:9090/ui/" » [Browser:Info] [UserManager] getUser: user not found in storage[UserManager] getUser: user not found in storage I $fill field "input", "logon-username", "HubAdministrator" I click "input[test-id="logon-username"]" I fill field "input[test-id="logon-username"]", "HubAdministrator" On step2:
I see "Log in to Altair SLC Hub" √ OK in 2054ms

OK | 1 passed // 2s

Provide test source code if related

Details

codeceptjs.config.js

const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure')
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins

exports.config = {
  tests: './tests/**/*.ts',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true
    },
  },
  autoLogin: {
    enabled: true,
    saveToFile: true,
    inject: 'loginAs',
    users: {
      // instructions for loginAs('HubAdministrator')
      HubAdministrator: {
        login: async (I) => await I.login(),
      }
    }
  },
  plugins: {
    screenshotOnFail: {
      enabled: false,
      uniqueScreenshotNames: true,
    },
     // Custom plugin integrates CodeceptJS test results in to Xray test management tool.
    xrayImport: {
      require: 'codeceptjs-xray-cloud-helper',
      enabled: true, 
      debug: true,
      projectKey: 'WPCLDX',
      testExecutionAssigneeUserId: '',
      importToExistingTestExecution: true,
      existingTestExecutionKey: 'WPCLDX-326',
      testExecutionPlanKey: '',
      testExecutionVersion: '',
      testExecutionRevision: '',
      testExecutionEnvironments:[],
      testExecutionSummary: '',
      testExecutionDescription: '',
      testExecutionSendEvidenceOnFail: false,
      createNewJiraTest: false,
      timeout: 60000,
      xrayClientId: 'XXXXX',
      xraySecret: 'XXXX'
    },
      // Custom plugin to update the steps in Xray test
    commentStep: {
      enabled: true,
      registerGlobal: 'xray_'
      }
    },
  include: {
    I: './steps_file'
  },
  name: 'X-ray_test'
}
kobenguyent commented 1 month ago

I guess this plugin issue may need to be handled here https://github.com/saadichouaib/codeceptjs-xray-cloud-helper/issues

Naveen-web-spec commented 1 month ago

To be precise the issue results I have added some more details

Xray snippet Capture

Code snippet Capture1

Here xraystep2 suppose to be I.see('Log in to Altair SLC Hub') but the method/function called before is considered them as a step2 updating them in the jira and Xraystep3 is not at all configured in the test.

Does this problem handled and fixed ? If yes can you please help me to get the package

kobenguyent commented 1 month ago

I would suggest you create an issue in the repo of plugin owner. They would definitely have better ideas to get you out of the troubles.