codeceptjs / codeceptjs/CodeceptJS

Difficulties using dataTables in gherkin scenarios

オープン
#2,420 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
4.2k
フォーク
757
平均マージ
2日 9時間
マージ済み PR(30日)
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。