How to use tags in my functional script Cucumber.js?

How to use tags in my functional script?

How to find out the script that calls my function?

Actually, I have one scenario:

Feature: create module feature As a admin I want to use create module @createModule Given I am logged as 'ADMIN' And I am on "/admin/create" Then The "book_id" field should be empty 

I would like to use my @createModule tag in my function. Then:

 this.Then(/^The "?([^"]*)"? field should be empty$/, function (el) { if (myModule === @createModule) { ... } else if { ... } return main_po.checkIsEmptyElement(this, el); }); 

I would like to get my @createModule tag to indicate a script or other alternative, I would like to know which scripts call my function.

It is decided:

I added:

 this.Before(function (scenario, callback) { var tags = scenario.getTags(); this.current_module = tags[0].getName(); callback(); }); 

and my function:

 this.Then(/^The "?([^"]*)"? field should be empty$/, function (el) { if (this.current_module === @createModule) { ... } else if { ... } return main_po.checkIsEmptyElement(this, el); }); 
+7
javascript protractor bdd cucumberjs
source share

No one has answered this question yet.

See related questions:

7728
How to redirect to another web page?
7649
How do JavaScript locks work?
7494
How to remove a specific element from an array in JavaScript?
7432
How to check if a string contains a substring in JavaScript?
7428
How to check if an element is hidden in jQuery?
6493
var functionName = function () {} vs function functionName () {}
5722
How to remove a property from a JavaScript object?
5129
How to return a response from an asynchronous call?
4829
How to include a javascript file in another javascript file?
2644
Is there an "exists" function for jQuery?

All Articles