codeceptjs / codeceptjs/CodeceptJS

How to use custom_steps.js in gherkin steps?

Offen
#1,353 7 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
4.2k
Forks
757
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
16

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.