veggies icon indicating copy to clipboard operation
veggies copied to clipboard

Current snapshot implementation does not work with scenario outlines

Open plouc opened this issue 8 years ago • 2 comments

Steps to reproduce

Having a scenario like this:

    Scenario Outline: I get all posts filtered using '<filter>=<value>' directive
        Given I set request query
            | <filter> | <value> |
        When I GET /api/v1/posts/all
        Then response status code should be 200
        And response body should match snapshot

        Examples:
            | filter | value           |
            | title  | car industry    |

Current behavior

Running this test, I end up with the following error:

Error: Can not do a snapshot. Scenario not found in file test/functional/features/posts/get_posts.feature on line 13

Expected behavior

Test running :)

Environment

  • node version: 8.5.0
  • cucumber version: 2.3.1
  • @ekino/veggies version: 0.6.0

plouc avatar Feb 16 '18 04:02 plouc

Hello @plouc

if @bnadim is busy, I can have a try at this. I've been digging around and apparently, Snapshot class method extractScenarios only matches /^[\s]*Scenario:[\s]*(.*[^\s])[\s]*$/, so when it's a Scenario Outline it doesn't match. Moreover, the line number for a single scenario in the outline, is the line number where the example is specified.

Anyway, I can give it a shot if that doesn't bother you.

lelbil avatar Mar 01 '18 17:03 lelbil

@lelbil, no problem, depending on your planing of course :)

plouc avatar Mar 07 '18 06:03 plouc