Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Missing step definition" when applying multiple step attributes to single step #55

Closed
jcoliz opened this issue Jun 4, 2022 · 1 comment · Fixed by #59
Closed

"Missing step definition" when applying multiple step attributes to single step #55

jcoliz opened this issue Jun 4, 2022 · 1 comment · Fixed by #59

Comments

@jcoliz
Copy link
Member

jcoliz commented Jun 4, 2022

Hi. In the comments for issue #25, @michalkovy notes that it is possible to allow a single step to function both as (say) a Given and When step.

We could potentially have such attribute but you can do the same today by writing:

let [<Given; When; Then>] ``I have defined a step definition`` () = ()1

However, this is not working for me today in 2.0.2.

This is what I have:

let [<Given; When>] ``user launches site`` (page: IPage) (uri: Uri) = 
    page.GotoAsync(uri.ToString()) |> Async.AwaitTask |> Async.RunSynchronously
Scenario: Root loads OK
    When user launches site
    Then page loaded ok

Scenario: Home page loads OK via navbar
    Given user launches site
    When clicking Home on navbar
    Then page title reads "Home"

This is what TickSpec has to say:

    TickSpec.StepException : Missing step definition on line 4 in Site is alive and healthy
	"When user launches site"

Note that the Given step still works fine.

I can work around it by duplicating the step, but yuck.

This workaround does work:

let [<When>] ``DUPLICATE user launches site`` (page: IPage) (uri: Uri) = 
    ``user launches site`` page uri
Scenario: Root loads OK
    When DUPLICATE user launches site
    Then page loaded ok
@jcoliz
Copy link
Member Author

jcoliz commented Jul 30, 2022

@mchaloupka Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants