Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 2.01 KB

README.md

File metadata and controls

52 lines (36 loc) · 2.01 KB

protractor-jasmine-cucumber

Deprecated at Dealer.com

Given minimal adoption of this package at Dealer.com we have decided to deprecate it. We are embracing cucumberjs and finding it to be good enough.

If you would like to continue this repo, let us know and we can link to your fork and give you access to publish to it on npm.

Getting Started

npm install protractor-jasmine-cucumber --save-dev

Require at the top of your protractor.conf.js file

var cucumber = require('protractor-jasmine-cucumber');	

And use the helper function to inject the runner into your suites

suites: {
    suite1 : cucumber.injectFiles('*-specs.js', '*-steps*.js')
}

Create a feature file

var feature = require('protractor-jasmine-cucumber').feature;

feature('IM9 Navigation: Navigation and Context Switching')
.scenario('should be able to navigate to the LLP')
    .when('I choose "Lifecycles" in the navigation')
    .then('the url hash should be "/lifecycle"')
    .and('the active tab should be "Lifecycles"')

And a steps file

var featureSteps = require('protractor-jasmine-cucumber').featureSteps;

featureSteps('IM9 Navigation:')
.when('I choose "(Lifecycles|Vehicles)" in the navigation', function(navThing){
    var index = navThing === 'Lifecycles' ? 0 : 1;
    element.all(by.repeater('ctx in contexts')).get(index).$('a').click();
})
.then('the url hash should be "(.*)"', function(expectedHash){
	expect(browser.getCurrentUrl()).toContain(expectedHash);
})
.then('the active tab should be "(.*)"', function(expextedTabText){
    expect(element(by.css('.context-tabs li.active a')).getText()).toBe(expextedTabText);
})

Note: this steps file assumes that the onprepare in protractor.conf.js already got the browser to the app.

See jasmine-cucumber for more about how to use jasmine-cucumber.

Also see karma-jasmine-cucumber for use with karma.