3

For my project, I am moving the code to the async/await model, thus disabling the control flow.

While doing this, I am having persistent problems with the callbacks() and async tasks being either going in pending or failing more often than not.

This problem particularly escalates when using Scenario Outlines with Cucumber.

For example, I have this feature that needs to be tested

    Feature: Creation of a new Document

@CreateDocument
Scenario Outline: User is able to create a new Doc
Given User navigates to XYZ Homepage
And waits for the loader to finish loading
And User clicks on New Doc button
When New Doc window opens up
And User enters client name as "<clientName>"
And User enters lop title as "<DocumentName>"
Then new Document page should appear


Examples:
  |clientName         |DocumentName               |
  |Jackel Corportation|New Doc For Normal Markets |

The steps are implemented as

//only giving the failing steps

    When(/User enters client name as Jackel Corporation$/, async() =>{
   await (demo = createlop.enter_lop_clientname('Jackel Corporation'));
  });


    When(/^And User enters lop title as New LOP For Normal Markets$/,async ()=>{
    await (demo1 = createlop.enter_lop_title('New LOP For Normal Markets'));
  });

The enter client name step passes while the next one fails with the error that it is undefined and needs to be implemented. Is there a specific reason for this? I don't think this is an issue with async/await architecture, since in my other steps, it is working fine.

What is the issue underlying here?

| improve this question | | | | |
1

Well it's a howler really. The steps contain the word And which should not be implemented in the step definition.

My Step def should really be

    When(/^User enters lop title as New LOP For Normal Markets$/,async ()=>{
    await (demo1 = createlop.enter_lop_title('New LOP For Normal Markets'));
  });

And not the one that I posted in my question.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.