Skip to content

Commit

Permalink
refactor(tests): e2e tests updated for 1.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Nov 24, 2014
1 parent 9ea64f8 commit bea9b9d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -20,3 +20,5 @@ libpeerconnection.log
scripts/Chromedriver

scripts/chromedriver_2.9.zip

scripts/chromedriver_2.10.zip
8 changes: 4 additions & 4 deletions app/modules/auth/tests/e2e/signIn.test.js
Expand Up @@ -4,19 +4,19 @@ describe('e2e: signIn', function() {
var ptor;
beforeEach(function() {
ptor = protractor.getInstance();
ptor.get( '/signIn?redirect=users' );
ptor.get( '/signIn' );
});

it('should signIn with the default user account', function() {
var username = element( by.model( 'credentials.username' ) );
var password = element( by.model( 'credentials.password' ) );

username.sendKeys( 'user1234@email.com' );
password.sendKeys( '1234' );
username.sendKeys( 'default@cleverstack.io' );
password.sendKeys( 'clever' );
ptor.findElement( protractor.By.css( 'button[type="submit"]' ) ).click();

expect( ptor.findElement( protractor.By.tagName('h1') ).getText() )
.toEqual( 'Users' );
.toEqual( 'Homepage' );

});

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/nav.test.js
Expand Up @@ -6,12 +6,12 @@ describe('e2e: navigation', function() {
ptor = protractor.getInstance();

beforeEach(function() {
link = element(by.css('.navbar ul.nav li a[href="/login"]'));
link = element(by.css('.navbar a[href="/signIn"]'));
link.click();
});

it('should navigate to the /login page when clicking', function() {
expect(ptor.getCurrentUrl()).toMatch(/\/login/);
it('should navigate to the /signIn page when clicking', function() {
expect(ptor.getCurrentUrl()).toMatch(/\/signIn/);
});

//todo: not implemented yet
Expand Down
16 changes: 8 additions & 8 deletions tests/e2e/pages.test.js
Expand Up @@ -7,18 +7,18 @@ describe('e2e: pages', function() {
ptor = protractor.getInstance();
});

it('check the login page is accasible from the homepage and has a form', function() {
element(by.css('a[href="/login"]')).click();
expect(ptor.getCurrentUrl()).toMatch(/\/login/);
it('check the signIn page is accasible from the homepage and has a form', function() {
element(by.css('a[href="/signIn"]')).click();
expect(ptor.getCurrentUrl()).toMatch(/\/signIn/);
expect(ptor.findElement(protractor.By.tagName('form')).getAttribute('id'))
.toMatch('login');
.toMatch('signIn');
});

it('check the register page is accasible from the homepage and has a form', function() {
element(by.css('a[href="/register"]')).click();
expect(ptor.getCurrentUrl()).toMatch(/\/register/);
it('check the signUp page is accasible from the homepage and has a form', function() {
element(by.css('a[href="/signUp"]')).click();
expect(ptor.getCurrentUrl()).toMatch(/\/signUp/);
expect(ptor.findElement(protractor.By.tagName('form')).getAttribute('id'))
.toMatch('registration');
.toMatch('signup');
});

});

0 comments on commit bea9b9d

Please sign in to comment.