GithubHelp home page GithubHelp logo

thebrainfamily / cypress-cucumber-webpack-typescript-example Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 24.0 93 KB

cypress cucumber webpack typescript example

Gherkin 4.31% JavaScript 79.14% TypeScript 16.54%

cypress-cucumber-webpack-typescript-example's People

Contributors

desm avatar lgandecki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cypress-cucumber-webpack-typescript-example's Issues

Bundle fails with nonGlobalStepDefinitions: true

I've forked this repo, brought the packages up to date, and changed the style of folder structures to be nonGlobal.

It is the last bit that causes the issue. When I was running as the default old style things are fine.

image

Webpack 5 support

Hey there!

I've been struggling a fair bit to get our stack working after some library upgrades. Basically the issue comes down to two separate issues (which I hope is simply us making a simple configuration mistake):


  1. We run the same Webpack version for Cypress in-line with our Angular version. Since we upgraded to Angular 12 which uses Webpack 5 in the background, it has stopped working with this cypress-cucumber-webpack-typescript-example configuration giving the error:
Error: Webpack Compilation Error
Cannot read property 'fallback' of undefined

We did follow some suggestions dictated in the main Cypress thread for Webpack 5 support. It works when having normal .spec files, but fails the moment we introduce cypress-cucumber-webpack and work with .feature files.

  1. We can circumvent Webpack using @cypress/browserify-preprocessor and then the tests run, but our tsconfig path aliases were not working properly once we did. We did not manage to get them working using custom babelrc settings so far, which is why we wanted to stick with Webpack (aside from the point we use Webpack more across our stack).

I have a minimal repo here (with a nice auto-generated repo-name ๐ŸŒ) with the issues and a basic example of how we run our stack.

https://github.com/raw3/psychic-guacamole

It would be great if we could get it working, since we really love working with .feature files and love the work you guys are doing! If there's any info missing or if there's anything I can do to help, feel free to let me know!

Is it possible to run All.features file within this example?

I am trying to figure out how to run All.features using typescript with cucumber config - did anybody try and manage to run it? I created All.features and added .features extension to cypress.json after cloning this repo but looks like something is still missing in the config because it does not execute any tests

~/D/c/c/c/integration> npm run testall        master!?

> [email protected] testall /Users/<***>/Desktop/cypress/cypress-cucumber-webpack-typescript-example
> cypress run --spec "**/*.features"


================================================================================

  (Run Starting)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Cypress:    3.7.0                                                                              โ”‚
  โ”‚ Browser:    Electron 73 (headless)                                                             โ”‚
  โ”‚ Specs:      1 found (All.features)                                                             โ”‚
  โ”‚ Searched:   **/*.features                                                                      โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  Running:  All.features                                                                    (1 of 1)


  0 passing (2ms)


  (Results)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Tests:        0                                                                                โ”‚
  โ”‚ Passing:      0                                                                                โ”‚
  โ”‚ Failing:      0                                                                                โ”‚
  โ”‚ Pending:      0                                                                                โ”‚
  โ”‚ Skipped:      0                                                                                โ”‚
  โ”‚ Screenshots:  0                                                                                โ”‚
  โ”‚ Video:        true                                                                             โ”‚
  โ”‚ Duration:     0 seconds                                                                        โ”‚
  โ”‚ Spec Ran:     All.features                                                                     โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


  (Video)

  -  Started processing:  Compressing to 32 CRF
  -  Finished processing: /Users/<***>/Desktop/cypress/cypress-cucumber-webpa    (0 seconds)
                          ck-typescript-example/cypress/videos/All.features.mp4


================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ โœ”  All.features                               1ms        -        -        -        -        - โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โœ”  All specs passed!                          1ms        -        -        -        -        -

local steps with typescript

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.