Skip to content

Instantly share code, notes, and snippets.

@ferclaverino
Created March 13, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferclaverino/1281202ca030e40843c4 to your computer and use it in GitHub Desktop.
Save ferclaverino/1281202ca030e40843c4 to your computer and use it in GitHub Desktop.
search scenario
Feature: Home
Como comprador
Quiero buscar teléfonos
Scenario: Busqueda de xoom
Given Estoy en "phones"
When Yo busco "xoom"
Then Veo "2" resultados
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
this.Given(/^Estoy en "([^"]*)"$/, function(arg1, callback) {
browser.get('http://angular.github.io/angular-phonecat/step-12/app/#/' + arg1);
callback();
});
this.Then(/^El título es "([^"]*)"$/, function(arg1, callback) {
expect(browser.getTitle()).to.eventually.equal(arg1).and.notify(callback);
});
this.When(/^Yo busco "([^"]*)"$/, function(arg1, callback) {
element(by.model('query')).sendKeys(arg1);
callback();
});
this.Then(/^Veo "([^"]*)" resultados$/, function(arg1, callback) {
var rows = element.all(by.repeater('phone in phones'));
expect(rows.count()).to.eventually.equal(parseInt(arg1)).and.notify(callback);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment