Skip to content

Commit

Permalink
added e2e tests for workouts
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Jan 10, 2015
1 parent f1f6bcc commit 1c981a0
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/e2e/workouts/workouts_index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,36 @@ describe('workouts index', function(){
});

it('should display regime & load phases for regime', function(){
element(by.cssContainingText('option', 'Test Regime 1 - Bob')).click();
var regimeName = 'Test Regime 1 - Bob';

selectOptionByText(regimeName);

expect(element.all(by.css('select[ng-model="phase"] option')).count()).toBeGreaterThan(1);
expect(element(by.css('form > fieldset > legend')).isDisplayed()).toBeTruthy();
expect(element(by.css('form > fieldset > legend')).getText()).toEqual(regimeName);
});

it('should display a phase & all workouts for that phase', function(){
var regimeName = 'Test Regime 1 - Bob',
phaseName = 'Test Phase 1';

selectOptionByText(regimeName);
selectOptionByText(phaseName);

expect(element(by.css('form > fieldset > fieldset > legend')).isDisplayed()).toBeTruthy();
expect(element(by.css('form > fieldset > fieldset > legend')).getText()).toEqual(phaseName);

expect(element(by.css('form > fieldset > fieldset > fieldset > legend')).isDisplayed()).toBeTruthy();
expect(element(by.css('form > fieldset > fieldset > fieldset > legend')).getText()).toMatch(/Workouts/);
expect(element.all(by.repeater('workout in workouts')).count()).toBeGreaterThan(0);
});

});

function selectOptionByText(text){
element(by.cssContainingText('option', text)).click();
}

function loginAndGotoWorkouts(){
browser.get('/#/login');
element(by.model('user.email')).sendKeys('bob@aol.com');
Expand Down

0 comments on commit 1c981a0

Please sign in to comment.