codeceptjs / codeceptjs/CodeceptJS

How to use custom_steps.js in gherkin steps?

Open
#1,353 7 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.2k
Forks
757
Avg merge
2d 9h
Merged PRs (30d)
16

Description

Hello,

i've made a custom fonction to extend the I

custom_steps.js
```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
```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
```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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.