patthiel / wdio-jira-service

Webdriverio JIRA Service Integration
MIT License
12 stars 2 forks source link

Jira integration WebdriverIO > Getting error i.e. Couldn't initialise service “jira” #4

Open vipuljust opened 5 years ago

vipuljust commented 5 years ago

I am integrating wdio with Jira service and getting the following error

ERROR: Couldn't initialise service "jira". TypeError: JiraService is not a constructor at Object. (E:\Year\2019\Feb\27th Feb\node_modules\wdio-jira-service\index.js:3:18)

And using the WDIO version: 4.14.1

Reference url: https://www.npmjs.com/package/wdio-jira-service

if you want I can share my code.

Thanks.

pratyavi commented 5 years ago

@patthiel : I am also facing the same issue.

vipuljust commented 5 years ago

Any update?

patthiel commented 5 years ago

Hi both,

Are you certain you're using the correct version of WebdriverIO? This service is only compatible with version v4. You can confirm you have the correct version via: npx wdio -v from the base of your project.

patthiel commented 5 years ago

Also feel free to share your project in a a zip file. Happy to take a look

vipuljust commented 5 years ago

I am using the v4.14.1.

I am sharing my zip file. Kindly look at it. Please let me know how we can use jira in wdio.

Thanks in advance.

jira_Wdio.zip

patthiel commented 5 years ago

I published a small change that, in my testing, seemed to resolve the service initialization issue. Just to note: I've not tested this module with cucumber.

The goal was for a .spec.js test or a .feature with respect to cucumber, to exercise a test case ticket in JIRA by defining a global variable in the test like below:

describe('Example Test' () => {
  global.jiraIssue = 'M3-535';

  it('should succeed and update the issue status in JIRA to the Passed state', () => {
    expect(true).toBe(true);
  });

  // the service then fires the after hook from the wdio.conf.js and checks if this suite contained any failures. If not, it fires the test success id status to jira
 // if the test suite contains a failure, it fires a request to jira with the failure ID to update the issue to failed
});

And for you to have configured the jira issue with a Passed status and a Failed status.

vipuljust commented 5 years ago

Thanks for quick response.

As I am a novice to WDIO framework,

Can you please provide failure scenario example for Jira and how we can call WDIO runner Jira service from a .spec.js test or a .feature or in mocha.

Thanks in Advance.

patthiel commented 5 years ago

The above example i provided should work for a pass or failure scenario.

You just need to define in each spec a global.jiraIssue = "PROJECT-TICKET_NUMBER". You also need to provide in the wdio.conf.js the correct transition status ID's for a pass / failure. They're defined in the wdio config file as failureId and successId. You can get the transition ID's through JIRA's API here: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-getTransitions

the successId can be thought of as moving the issue to "Done" or "Complete" in JIRA, and the failureId is like "Rejected" or "Failed" in the workflow of a ticket.

vipuljust commented 5 years ago

Thanks you so much Now i can update Jira status.

How we can create new issue in Jira for failure scenarios.

patthiel commented 5 years ago

there's currently nothing in the integration that will automatically create an issue for a failure scenario, you're welcome to open a PR to add this though and i'd be happy to review!

vipuljust commented 5 years ago

Sure I will try to do...

fakhrealam01 commented 1 year ago

there's currently nothing in the integration that will automatically create an issue for a failure scenario, you're welcome to open a PR to add this though and i'd be happy to review!

Hi @patthiel, have you found any solution ? please update. Thankyou