alexkrechik / VSCucumberAutoComplete

Cucumber (Gherkin) Full Support Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete
MIT License
332 stars 79 forks source link

Get Behat type Steps #268

Open marcosvfranco opened 5 years ago

marcosvfranco commented 5 years ago

Buddy, I need to get Steps implemented as smartSteps on .feature files like

@smartStep
Scenario: I am on page
    Given I refresh the browser session
    And I am on "${site_url}/${catalog_page_url}"
    And I wait at most 10 seconds until "${content_loaded}"

This is how Behat automates the scenario

So I need to click on "get definition" of this line"

Given I am on page

And the extension takes me to the line of the implementation of the smartStep

@smartStep
Scenario: I am on page
    Given I refresh the browser session
    And I am on "${site_url}/${catalog_page_url}"
    And I wait at most 10 seconds until "${content_loaded}"

I tried to customize somethings but I didn't get a good solution. I tried to enhanced your RegEx to /^((?:[^'"\/]?[^\w])|.{0})(Scenario: |Given|When|Then|And|But|defineStep|Step|@Step)[^\/'"`\w\s]?(\/|'|"|`|\b)([^\3]+)\3/i

But it didn't work.

Hope that you can enhance this.

alexkrechik commented 5 years ago

Hey! Could you please sent step definition lines for And I am on "${site_url}/${catalog_page_url}" and Given I am on page ?

marcosvfranco commented 5 years ago

This is php implementations, and it's built-in, I will try to search here and return you ASAP.

jpenna commented 4 years ago

The syntax is as follows. I'm not sure this will be helpful, if it isn't, tell me and I will build a functional snippet.

test.feature

Scenario: Stripe customer.card.updated
    Given I have a connected giving account
    And a customer with a source exists
    When a customer.card.updated event is received
    Then the response should be successful
    And the saved payment should be updated

StepDefinition.php


/**
 * @When /^a charge.dispute.created event is received$/
 */
public function aChargeDisputeCreatedEventIsReceived()
{
    print('received');
}

/**
 * @Then we respond with "bad request"
 */
public function weRespondWithBadRequest()
{
    $this->assertBadRequestResponse();
}