admin管理员组文章数量:1391766
I saw some similar post to mine but I didn't find it helpful at all since none of them are using the cypress preprocessor.
I have a Scenario:
Scenario: Some scenario
Given ...
When ...
Then I should see "<task_field>" field as "<field_value>"
Examples:
| task_field | field_value |
| some_field1 | some_value1 |
| some_field2 | some_value2 |
| some_field3 | some_value3 |
The .js file has:
Then('I should see {string} field as {string}', (field, value ) => {
switch (field) {
case 'some_field1':
cy.get('.someClass1').contains(value)
break
case 'some_field2':
cy.get('.someClass2').contains(value)
break
case 'some_field3':
cy.get('.someClass3').contains(value)
break
default:
throw new Error(`Invalid field: ${field}`)
}
})
My goal is to check each some_field if it equals to some_value, but currently cypress throws me an error and it's not even giving me the option to execute the test:
Any help would be appreciated Cheers!
I saw some similar post to mine but I didn't find it helpful at all since none of them are using the cypress preprocessor.
I have a Scenario:
Scenario: Some scenario
Given ...
When ...
Then I should see "<task_field>" field as "<field_value>"
Examples:
| task_field | field_value |
| some_field1 | some_value1 |
| some_field2 | some_value2 |
| some_field3 | some_value3 |
The .js file has:
Then('I should see {string} field as {string}', (field, value ) => {
switch (field) {
case 'some_field1':
cy.get('.someClass1').contains(value)
break
case 'some_field2':
cy.get('.someClass2').contains(value)
break
case 'some_field3':
cy.get('.someClass3').contains(value)
break
default:
throw new Error(`Invalid field: ${field}`)
}
})
My goal is to check each some_field if it equals to some_value, but currently cypress throws me an error and it's not even giving me the option to execute the test:
Any help would be appreciated Cheers!
Share Improve this question edited Aug 5, 2020 at 18:32 antpngl92 asked Aug 5, 2020 at 17:58 antpngl92antpngl92 5344 silver badges14 bronze badges1 Answer
Reset to default 7After 2 hours of debugging I find out that I have forgotten to include Outline
world in the Scenario definition in order the test to be able to iterate through the data table.
So for future reference the fix from:
Scenario: Some scenario
Given ...
When ...
Then I should see "<task_field>" field as "<field_value>"
Examples:
| task_field | field_value |
| some_field1 | some_value1 |
| some_field2 | some_value2 |
| some_field3 | some_value3 |
Is to include in the first line Outline
:
Scenario Outline: Some scenario
Given ...
When ...
Then I should see "<task_field>" field as "<field_value>"
Examples:
| task_field | field_value |
| some_field1 | some_value1 |
| some_field2 | some_value2 |
| some_field3 | some_value3 |
I think is been a long day for me. Hope this helps to someone with a similar issue!
本文标签: javascriptcypresscucumberpreprocessor DatatablesStack Overflow
版权声明:本文标题:javascript - cypress-cucumber-preprocessor Datatables - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744772450a2624420.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论