codeceptjs / codeceptjs/CodeceptJS

Difficulties using dataTables in gherkin scenarios

Abierto
#2,420 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
757
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.