codeceptjs / codeceptjs/CodeceptJS

Difficulties using dataTables in gherkin scenarios

Đang mở
#2,420 0 bình luận 0 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ả

#### What are you trying to achieve?
Let us assume a gherkin step like:
```feature
Then the user with the following details should be visible on the webUI:
| name | Kiran Parajuli |
| email | test@test.com |
| age | 20 |
```
Now to parse this dataTable `codeceptJs` provides three features:
- raw()
- rows()
- hashes()

I'm trying to achieve my dataTable from the gherkin scenario to the step definition like
```node
{
name: "Kiran Parajuli",
email: "test@test.com",
age: 20
}
```

#### What do you get instead?
Using provided methods for dataTables results are:
- raw()
```
[
[ 'name', 'Kiran Parajuli' ],
[ 'email', 'test@test.com' ],
[ 'age', '20' ]
]
```
- rows()
```
[ [ 'email', 'test@test.com' ], [ 'age', '20' ] ]
```
- hashes()
```
[
{ name: 'email', 'Kiran Parajuli': 'test@test.com' },
{ name: 'age', 'Kiran Parajuli': '20' }
]
```
From the above results and the expected result, `raw()` provides a very narrowingly satisfying result.

> Provide console output if related. Use `--verbose` mode for more details.

```bash
# paste output here
```

> Provide test source code if related

```js
// paste test
```

### Details

* CodeceptJS version:2.6.5
* NodeJS Version:v12.7.0
* Operating System:Ubuntu
* puppeteer
* Configuration file:

```js
exports.config = {
output: './output',
helpers: {
Puppeteer: {
url: 'http://localhost:3000',
show: true,
windowSize: '1200x900'
},
"AssertWrapper" : {
"require": "codeceptjs-assert"
}
},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features: './features/*.feature',
steps: ['./step_definitions/steps.js']
},
plugins: {
screenshotOnFail: {
enabled: true
},
retryFailedStep: {
enabled: true
}
},
tests: './*_test.js',
name: 'react-hooks'
}
```

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.