How to use custom_steps.js in gherkin steps?
See original GitHub issueHello,
i’ve made a custom fonction to extend the I
custom_steps.js
'use strict';
module.exports = function () {
return actor({
waitForLoading: function (seconds = 10) {
this.waitForInvisible('div.loading', seconds);
}
});
}
codecept.json
"include": { "I": "./custom_steps.js" },
loginSteps.js
Given('i login with username {string} and password{string}', (username, password) => {
I.amOnPage('/');
I.fillField('input#username', username);
I.fillField('input#password', password);
I.click('#login-btn');
I.waitForLoading();
});
I got :
I.waitForLoading is not a function
It work when i do a classic scenario :
login_test.js
Feature('Toast');
Scenario('test something', (I) => {
I.amOnPage('/');
I.fillField('input#username', 'eeee');
I.fillField('input#password', 'xxxx');
I.click('#login-btn');
I.waitForLoading();
});
How can i make it work in gherkin steps ? Thank you !
Details
- CodeceptJS version: 1.4.6
- NodeJS Version: 10.14.0
- Operating System: windows 7 64 bits
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
How to use custom_steps.js in gherkin steps? #1353 - GitHub
Hello, i've made a custom fonction to extend the I custom_steps.js 'use strict'; module.exports = function () { return actor({ ...
Read more >Step Definitions - Cucumber Documentation
When Cucumber executes a Gherkin step in a scenario, it will look for a matching step definition to execute. To illustrate how this...
Read more >cucumber-step-definitions - npm
Start using cucumber-step-definitions in your project by running `npm i ... /project/features/step_definitions/form.js.
Read more >Nope, we created a test suite with cucumber-js and a lot of ...
... and it should work with react-testing-library as long as it's b. ... with cucumber-js and a lot of custom steps to support...
Read more >BDD in JavaScript: Getting Started with Cucumber and Gherkin
We got automatic parameterized tests by simply specifying how the step code is executed from the Gherkin files. This means that adding many...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this was a frustrating few hours of poking at the thing only to realise that none of the dependency injection features work in the BDD mode 😦
you could at least mention that in the docs
I worked it around by including customSteps at the top of step definition file (in your case loginSteps.js):
But in this case Gherkin steps are not displayed in console (and also in allure report) after running:
codeceptjs run --features --steps
which is not really cool.Please advise.