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); });
javascript protractor bdd cucumberjs
Jérémie chazelle
source share