codeceptjs / codeceptjs/CodeceptJS
Difficulties using dataTables in gherkin scenarios
- 主要语言
- JavaScript
- 星标
- 4.2k
- 派生
- 757
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 16
描述
#### 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'
}
```
贡献指南
评估
这个 Issue 还没有评估数据。