codeceptjs / codeceptjs/CodeceptJS

How to use custom_steps.js in gherkin steps?

未关闭
#1,353 7 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
4.2k
派生
757
平均合并
2 天 9 小时
30 天内合并 PR
16

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。