codeceptjs / codeceptjs/CodeceptJS

How to use custom_steps.js in gherkin steps?

Ouverte
#1,353 7 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
4.2k
Forks
757
Merge moyen
2 j 9 h
PR mergées (30 j)
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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.