Closed wawagit closed 6 years ago
Thank you :-)
This is fixed in the newest version of https://github.com/TheBrainFamily/cypress-cucumber-preprocessor by @fcurella , you can see an example here:
( if you have more questions/issues related to the plugin please open an issue in the other repo :-) let's keep this one for the example purpose - which I think at this point is not even necessary, with CI and tests in the plugin repo itself )
@lgandecki I don't see any data table in the links you've provided. 🤔
Did you mean to link to this? https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/cypress/integration/DataTable.feature
When I try to use this though it doesn't work.
My feature file:
Feature: Being a plugin handling Scenario Outline
As a cucumber cypress plugin which handles Scenario Outline
I want to allow people to write Scenario Outline tests and run it in cypress
Scenario Outline: Using Scenario Outlines
When I add <provided number> and <another provided number>
Then I verify that the result is equal the <provided>
Examples:
| provided number | another provided number | provided |
| 1 | 2 | 3 |
| 100 | 200 | 300 |
Steps:
import { When } from "cypress-cucumber-preprocessor/steps";
export let data = ''
When(`I add {int} and {int}`, async (int1, int2) => {
console.log('ok when ', int1, ' ', int2)
})
import { Then } from "cypress-cucumber-preprocessor/steps";
Then(`I verify that the result is equal the {int}`, async (int3) => {
console.log('then ', int3)
})
Results in Error: "Timed out retrying: Expected to find element: table, but never found it."
It would be nice if there was any mention of this at all in the README...
That error seems unrelated. The feature file you found is run on CI on every commit and merge to make sure that functionality works. You can find step definitons of that .feature file as well in the same repo
@lgandecki I don't see any data table in the links you've provided. 🤔
Did you mean to link to this? https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/cypress/integration/DataTable.feature
When I try to use this though it doesn't work.
My feature file:
Feature: Being a plugin handling Scenario Outline As a cucumber cypress plugin which handles Scenario Outline I want to allow people to write Scenario Outline tests and run it in cypress Scenario Outline: Using Scenario Outlines When I add <provided number> and <another provided number> Then I verify that the result is equal the <provided> Examples: | provided number | another provided number | provided | | 1 | 2 | 3 | | 100 | 200 | 300 |
Steps:
import { When } from "cypress-cucumber-preprocessor/steps"; export let data = '' When(`I add {int} and {int}`, async (int1, int2) => { console.log('ok when ', int1, ' ', int2) })
import { Then } from "cypress-cucumber-preprocessor/steps"; Then(`I verify that the result is equal the {int}`, async (int3) => { console.log('then ', int3) })
Results in Error: "Timed out retrying: Expected to find element: table, but never found it."
you should remove "Examples:"
Can we add the functionality to include the Examples:
? Currently, I need to comment the word Examples:
as workaround:
Feature: Being a plugin handling Scenario Outline
As a cucumber cypress plugin which handles Scenario Outline
I want to allow people to write Scenario Outline tests and run it in cypress
Scenario Outline: Using Scenario Outlines
When I add <provided number> and <another provided number>
Then I verify that the result is equal the <provided>
#Examples:
| provided number | another provided number | provided |
| 1 | 2 | 3 |
| 100 | 200 | 300 |
If we cannot do this now, at least can we a useful debugging error message if we use the word Examples:
?
Before everything, thank you Łukasz for your work! It's amazing 🥇
I was just wondering if I could use scenario including a Datatable, like this for example:
The scenario
The step definition
But when I do that Cypress displays an AssertionError :
table seems to be undefined. Did I do something wrong?