Skip to content

Instantly share code, notes, and snippets.

@rafaelportela
Last active August 29, 2015 14:06
Show Gist options
  • Save rafaelportela/c14c493419d707b38262 to your computer and use it in GitHub Desktop.
Save rafaelportela/c14c493419d707b38262 to your computer and use it in GitHub Desktop.
[Protractor Meetup] (angular/tests/spec.js) Test spec file
homePage = require('./Pages/homepage.js');
describe('Angularjs Search feature',function() {
describe('Search page', function() {
beforeEach(function(){
browser.get('http://localhost:8000/');
});
it('should have a title',function() {
expect(homePage.getPageTitle()).toEqual('Artist Directory');
});
it('should search for artist', function() {
homePage.searchArtist('Barot');
expect(homePage.artistName()).toEqual('Barot Bellingham');
homePage.selectArtist('Barot Bellingham');
expect(homePage.verifyText()).toContain('portraiture');
});
iit('should seach and sort results', function(){
element(by.model('query')).sendKeys('Jo');
var AscList = element.all(by.repeater('item in artists'));
element.all(by.model('direction')).get(1).click();
var descList = element.all(by.repeater('item in artists'));
expect(AscList[0]).toEqual(descList[descList -1]);
expect(AscList[AscList.length - 1]).toEqual(descList[0]);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment