codeceptjs / codeceptjs/CodeceptJS

Test timeout doesn't work with BDD scenarios

Đang mở
#3,055 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug critical
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ả

#### What are you trying to achieve?
I would like to define a test timeout in order to prevent being stuck during the execution - native applications & websites can be down / blocked during the execution and I want to skip a test when it reaches a limit.

So I tried (without success) to use the 2 following features available in codeceptjs:
1. Timeout setting in the configuration file: https://codecept.io/configuration/#configuration
```
exports.config = {
...
timeout: 10000,
...
}
```
2. Dynamic timeout override by using advanced options: https://codecept.io/advanced/#test-options
```
Before((test) => {
test.timeout(10000);
});
```

#### What do you get instead?
- **Approach 1 - Timeout setting**: has no effect at all
- **Approach 2 - Dynamic timeout override**: test execution continues until the end and fails with timeout message if execution exceeds the threshold (see screenshot)

_Example: timeout set to 10s, execution ran in 36s before displaying the error message_

![image](https://user-images.githubusercontent.com/87313129/135439603-125642e1-2564-4b77-ad6c-c49ddac4032b.png)

### Details

* CodeceptJS version: 3.1.2
* NodeJS Version: 16.4.2
* Operating System: Mac OS
* Configuration file:

```js
exports.config = {
output: './output',
timeout: 10000,
helpers: {
Playwright: {
url: 'http://localhost',
show: true,
browser: 'chromium',
waitForNavigation: 'domcontentloaded'
},
ChaiWrapper: {
require: "codeceptjs-chai"
}
},
include: {},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features: './features/*.feature',
steps: './step_definitions/*.js'
},
plugins: {
screenshotOnFail: {
enabled: true
},
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
}
},
tests: './*_test.js',
name: 'cjs-training'
}
```

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.