codeceptjs / codeceptjs/CodeceptJS

How to use custom_steps.js in gherkin steps?

Đang mở
#1,353 7 bình luận 5 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.