TheBrainFamily / cypress-cucumber-webpack-typescript-example

cypress cucumber webpack typescript example
40 stars 24 forks source link

local steps with typescript #1

Closed jogelin closed 5 years ago

jogelin commented 5 years ago

Hi,

First of all, thank you for this sample ! It's really clean to have a loader in the webpack config !

However I see on the repo cypress-cucumber-preprocessor a way to have local/common steps by specifying "nonGlobalStepDefinitions": true but I can't make it work with typescript...

/cypress
    |- integration
    |    |- main.feature
    |    |- main.ts
main.feature

Feature: The main page

  I want to open the search page

  Background:
    Given I open the desktop application

  @focus
  Scenario: Opening the search page
    Then I see "Title" in the title
main.ts

const { When, Then, Given } = require('cypress-cucumber-preprocessor/steps');

Given(/^I open the desktop application$/, () => {
  cy.viewport(1280, 1024);
  cy.visit(Cypress.env('url'));
});

Given(/^I open the mobile application$/, () => {
  cy.viewport(360, 640);
  cy.visit(Cypress.env('url'));
});

Then(/^I see "([^"]*)" in the title$/, (text: string) => {
  cy.title().should('eq', text);
});
Error: Step implementation missing for: I open the desktop application

Could you help me ?

jogelin commented 5 years ago

ok, fixed....

I just misunderstanding the folder/files naming conventions...