-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
🤔 What's the problem you're trying to solve?
I want to be able to go to definition from the Given today is <day> line in the following setup:
friday.feature
Feature: Is it Friday yet?
Everybody wants to know when it's Friday
Scenario Outline: Today is or is not Friday
Given today is <day>
When I ask whether it's Friday yet
Then I should be told "<answer>"
Examples:
| day | answer |
| Friday | TGIF |
| Sunday | Nope |steps.js
import { strictEqual } from 'assert'
import { Given, When, Then, defineParameterType } from '@cucumber/cucumber';
defineParameterType({
regexp: /Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday/,
name: 'day',
transformer: s => s
})
function isItFriday(today) {
if (today === "Friday") {
return "TGIF";
} else {
return "Nope";
}
}
Given('today is {day}', function(givenDay) {
this.today = givenDay;
});
When('I ask whether it\'s Friday yet', function() {
this.actualAnswer = isItFriday(this.today);
});
Then('I should be told {string}', function(expectedAnswer) {
strictEqual(this.actualAnswer, expectedAnswer);
});✨ What's your proposed solution?
Plug in the values of the first scenario into the step and match using that.
⛏ Have you considered any alternatives or workarounds?
No response
📚 Any additional context?
No response
Metadata
Metadata
Assignees
Labels
No labels