Menu
  • HOME
  • TAGS

Cucumber JS Get current Feature / Scenario / Step in World

javascript,cucumber,cucumberjs

Ok, So I finally found this solution: create a Context object called in hooks. hooks.js file: var context = require(process.cwd() + '/src/e2e/support/context'); module.exports = function Hooks() { this.BeforeFeature(function (event, callback) { context.setCurrentFeature(event.getPayloadItem('feature')); callback(); }); this.BeforeScenario(function (event, callback) { context.setCurrentScenario(event.getPayloadItem('scenario')); callback(); }); this.BeforeStep(function (event, callback) {...

Protractor-Cucumber: how to wait in hooks (After)

protractor,cucumberjs

Try something like this, where some_locator is a locator for an element you expect to be displayed when the logout is complete: browser.ignoreSynchronization = true; browser.wait(function() { return element(<some_locator>).isDisplayed(); }, 30000); Here's more info on wait() and isDisplayed(). If you're using Protractor with Cucumber-JS you might also want to check...

Using Protractor with loops to fill in a form getting data from a Cucumber.js table

protractor,cucumberjs

Your loop is enqueuing promises, so the loop finishes before any "clicking" or sending of keys happens. You need to invoke callback after all the promises have resolved. I see two solutions (I think). You could keep track of the promises in an array, and then use protractor.promise.all (see http://spin.atomicobject.com/2014/12/17/asynchronous-testing-protractor-angular/)...

Cucumber.js and resources

javascript,cucumberjs

You should try this as a good starting point. It has instructions and offered cucumber.js steps. You can simply include it along with cucumber.js. Follow the instructions and it should work. https://github.com/AllegiantAir/cucumber-defaults...

Cucumber.js debugging in IntelliJ

debugging,intellij-idea,bdd,cucumberjs

Instead of using the cucumber.js plugin, I used the run/debug configuration of node.js. I just set the run config of the node.js plugin like that -> JavaScript file: node_modules/.bin/cucumber.js (any path to the cucumber.js file)...

Error using Protractor 2.1.0 with CucumberJS

angularjs,cucumber,protractor,cucumberjs

This was the result of a bug in Protractor, which was fixed by this pull request. To use that particular commit, change your package.json to include: "devDependencies": { "cucumber": "0.4.9", "protractor": "git+https://github.com/angular/protractor.git#0262268fa43b9eefac815d986740efa07bb15818" }, ...

Check text in a DOM element using Protractor

angularjs,protractor,cucumberjs

Does: expect(el.getText()).to.eventually.contain("some interesting string"); work? I believe you need the .eventually to wait for a promise to resolve, and you need the .getText() to get at the content of the div. See the chai-as-promised stuff at the head of the cucumber sample....

BeforeFeature hook get Feature name

javascript,protractor,cucumberjs

I finally got the feature name: event.getPayloadItem('feature').getName() Same for scenarios, steps, etc. https://github.com/cucumber/cucumber-js/issues/200...

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

javascript,protractor,chai,cucumberjs

Almost all functions in Protractor return promises that will resolve into the values you actually want to test against. So if you're just trying to do something like the following, it will always fail because it's asserting on the promise object returned by isPresent: expect(element.isPresent()).to.be.false I would recommend using the...

How does one use Q.all with chai-as-promised?

protractor,q,cucumberjs,chai-as-promised

Answering my own question: .should comes from the "should" assertions style - http://chaijs.com/guide/styles/#should. You need to run: chai.should(); after var Q = require('q'); but before Q.all([]).should.notify...: var Q = require('q'); var chai = require('chai'); var chaiAsPromised = require('chai-as-promised'); // *************** chai.should(); // *************** chai.use(chaiAsPromised); it("should all be well", function (done)...

SetTimeout and recursivity with cucumber

javascript,settimeout,cucumberjs

You have to pass the function as a parameter to setTimeout, that means no parenthesis at the end of f. What you are doing right now is calling f and passing it's return value to setTimeout. You can pass arguments to f as the third argument of setTimeout. Your call...

How to configure Protractor to use Cucumber

protractor,cucumberjs

I have created a sample project to show how to configure Protractor with Cucumber and make use of the World. The World is a place to share commonalities between different scenarios so that you can keep you code organised. Actually, all you need is to create your world.js file in...