thebrainfamily / cypress-cucumber-webpack-typescript-example Goto Github PK
View Code? Open in Web Editor NEWcypress cucumber webpack typescript example
cypress cucumber webpack typescript example
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):
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.
@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!
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 - - - - -
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 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.