Skip to content

Instantly share code, notes, and snippets.

@danemacaulay
Created July 29, 2014 05:23
Show Gist options
  • Save danemacaulay/b05071c9e47029ead264 to your computer and use it in GitHub Desktop.
Save danemacaulay/b05071c9e47029ead264 to your computer and use it in GitHub Desktop.
udpated spec file
/*global describe: true, browser: true, element: true, it: true, by: true, expect: true */
/**
* Created by IsukapalliS on 6/20/2014.
*/
var loginURL = 'https://qa.hoovers.com/H/private/mobile/html/index.html#/login/';
var homepage = 'https://qa.hoovers.com/H/private/mobile/html/index.html#/';
var chickenSearch = 'https://qa.hoovers.com/H/private/mobile/html/index.html#/search/companies/chicken/list';
browser.get(loginURL);
describe ('Login', function() {
'use strict';
function login(username, password) {
browser.get(loginURL);
// $('.css #selector') is shorthand for element(by.css('.css #selector');
$('#login-username').sendKeys(username);
$('#login-password').sendKeys(password);
$('#login-submit').click();
}
it('should fail with derpa derp credentials', function(){
login('derpa', 'derp');
expect(browser.getCurrentUrl()).toEqual(loginURL);
});
it('should redirect to app homepage', function(){
login('fullaccess', 'password');
expect(browser.getCurrentUrl()).toEqual(homepage);
});
});
describe ('Search', function() {
'use strict';
browser.get(homepage);
it('should redirect to the proper url', function(){
$('.icon.icon-search').click();
$('#search-find').sendKeys('chicken');
$('button[data-ng-click="submit(searchForm)"]').click();
expect(browser.getCurrentUrl()).toEqual(chickenSearch);
});
it('should show the right chicken results', function(){
// this is breaking with selenium, spinner just spins...
// hard to debug in firefox, no chrome support :(
// browser.debugger();
// wait until the result set is back
// browser.wait(function () {
// return $('.dnb-block-company-slat').isPresent();
// });
var list = element.all(by.repeater('company in companySummaries'));
expect(list.count()).toEqual(15);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment