Questions tagged [cucumberjs]

The Cucumber project is a Behavior Driven Development (BDD) tool originally designed to work with Ruby. However, since its inception its popularity has grown and there have been implementations of Cucumber written for different languages including Java, .Net, Flex, and JavaScript.

Cucumber understands a language named Gherkin which allows features and specs to be written in a plain text format. It is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented.

Gherkin serves two purposes — documentation and automated tests. The third is a bonus feature — when it yells in red it’s talking to you, telling you what code you should write.

Gherkin’s grammar is defined in the Treetop grammar that is part of the Cucumber codebase. The grammar exists in different flavours for many spoken languages (37 at the time of writing), so that your team can use the keywords in your own language.

848 questions
29
votes
4 answers

Unable to execute protractor, getting "Could not find update-config.json" error message

When I'm trying to execute my .js file, I'm getting the error below: [14:49:13] I/launcher - Running 1 instances of WebDriver [14:49:13] I/direct - Using ChromeDriver directly... [14:49:13] E/direct - Error code: 135 [14:49:13]…
KAK
  • 905
  • 4
  • 14
  • 33
16
votes
3 answers

Using Cucumber.js with Jest

I am using Jest for my unit tests and I'm in the process of integrating Cucumber.js for running specs written in Gherkin. I have it all set up and it's working, but I am running into one problem: How can I use Jest's expect? I could use chai's, but…
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
15
votes
5 answers

Proper usage of cucumber with typescript?

I was following a tutorial but the setup is really bad. Basically it uses typescript to convert .ts files to .js. So basically pollutes your whole source code with .js files around. So as soon as you import your .ts file from source code, all…
Totty.js
  • 15,563
  • 31
  • 103
  • 175
15
votes
4 answers

Cucumber HTML report with Protractor

I am using Protractor with Cucumber (js). I would like to generate report files just like with the Cucumber-JVM version. I have seen examples when using Protractor with Jasmine, but practically nothing with Cucumber. How do you generate reports when…
Pedro Lopez
  • 2,236
  • 2
  • 19
  • 27
13
votes
6 answers

How to debug Cucumber in Visual Studio Code (VSCode)?

I was trying to debug Cucumber scenarios in Visual Studio code and made below changes in the launch.json. { "name": "e2e", "type": "node", "request": "launch", "program":…
11
votes
4 answers

How to configure Protractor to use Cucumber

As of 0.20.1 Cucumber is now fully supported in Protractor but I'm battling to find any documentation on how to configure it properly. Any idea how you would setup world.js? I have found this example at…
dex
  • 275
  • 1
  • 4
  • 10
9
votes
3 answers

Tags Protractor + Jasmine to run set of suites

I'm trying to figure out a way to use in the same way, or better said, similar way, the tagging options that cucumberJS has with protractor, but with Jasmine, is there a way to tag the different scenarios, like: @smoke, @regression, etc.. and then…
Bruno Soko
  • 624
  • 6
  • 20
9
votes
1 answer

What is the proper way to use Protractor with SystemJS?

This problem should apply to requirejs as well. The specifics: Protractor SystemJS loading ES6 BabelJS transpiled system modules Cucumber.js Chai, chai-as-promised The reason I'm asking is because I have just a couple very basic cucumber tests and…
Mike Haas
  • 2,273
  • 3
  • 25
  • 30
9
votes
2 answers

Automatic Step Generation in cucumber javascript using javascript

I am using javascript for cucumber javascript for automation.My concern is can i generate .js file for step definitions automatically? as of now am copy pasting them(steps) from command line window so can I skip it and directly generate the step…
hghgh
  • 91
  • 1
  • 3
8
votes
1 answer

How do I use Cucumber with my ESM (ECMA Module Loader) Project?

I have a simple project that is basically... export class Application{ constructor(...){ ... } async run(){ console.log("I Ran!"); } } I want to run this using Cukes so I follow these steps and get this working (notice the .cjs…
Jackie
  • 21,969
  • 32
  • 147
  • 289
8
votes
1 answer

Cypress Cucumber - How do I make my steps run in order?

Relative newbie to Javascript / Cypress here. I am running some tests using the Cypress Cucumber.js plugin. The issue is that I cannot make my steps run in order - the 'Then' steps run before the 'Given etc, due to the asynchronous nature of js.…
KZNKatana
  • 103
  • 1
  • 6
8
votes
2 answers

cucumber-js and Chai how to expect if element with given selector exist in DOM

I have a problem with cucumberjs. I cannot find a way to ensure that element with given selector is presented into DOM. I'm using cucumberjs with Chai. https://github.com/cucumber/cucumber-js isPresent returns object - no matter if the element…
Georgi Naumov
  • 4,160
  • 4
  • 40
  • 62
8
votes
2 answers

Cucumber JS Get current Feature / Scenario / Step in World

How can i get current Feature, Scenario and Step in World? I tried this way but I only have the Scenario name and description : module.exports = function () { /** * Before each scenario */ this.Before(function (scenario, callback)…
rbaaboud
  • 131
  • 1
  • 8
7
votes
1 answer

"Error: Cannot use import statement outside a module" in Cucumber-JS step definition w/ typescript

I am getting the following error: command: npx cucumber-js .\cucumber-e2e\ import { Given, When, Then } from '@cucumber/cucumber'; ^^^^^^ SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:352:18) at…
Victor
  • 907
  • 2
  • 17
  • 42
7
votes
1 answer

Path mapping with typescript doesn't work with cucumber test runner

When running cucumber-js with my typescript project, path remapping fails. Using relative paths is fine but unforgivably ugly. E.g. import ... from "@src/..." fails, while import ... from "../../../foo.ts" works fine. My project looks something like…
Nino Walker
  • 2,742
  • 22
  • 30
1
2 3
56 57