codeceptjs / codeceptjs/CodeceptJS

Difficulties using dataTables in gherkin scenarios

Aperta
#2,420 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
4.2k
Fork
757
Merge medio
2g 9h
PR unite (30g)
16

Descrizione

#### 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'
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.