diff --git a/spec/altRoot/findelements_spec.js b/spec/altRoot/findelements_spec.js index 0c2717ef9..94501705a 100644 --- a/spec/altRoot/findelements_spec.js +++ b/spec/altRoot/findelements_spec.js @@ -1,24 +1,22 @@ var util = require('util'); describe('finding elements when ng-app is nested', function() { - var ptor; describe('in forms', function() { - ptor = protractor.getInstance(); beforeEach(function() { - ptor.get('app/alt_root_index.html#/form'); + browser.get('app/alt_root_index.html#/form'); }); it('should find an element by binding', function() { - var greeting = ptor.findElement(protractor.By.binding('{{greeting}}')); + var greeting = element(by.binding('{{greeting}}')); expect(greeting.getText()).toEqual('Hiya'); }); it('should find elements outside of angular', function() { - var outside = ptor.findElement(protractor.By.id('outside-ng')); - var inside = ptor.findElement(protractor.By.id('inside-ng')); + var outside = element(by.id('outside-ng')); + var inside = element(by.id('inside-ng')); expect(outside.getText()).toEqual('{{1 + 2}}'); expect(inside.getText()).toEqual('3'); diff --git a/spec/login/viaConfigConf.js b/spec/login/viaConfigConf.js index a6c49cc7e..1fc7e2804 100644 --- a/spec/login/viaConfigConf.js +++ b/spec/login/viaConfigConf.js @@ -15,18 +15,17 @@ exports.config = { }, onPrepare: function() { - var ptor = protractor.getInstance(); - ptor.driver.get('http://localhost:8000/app/login.html'); + browser.driver.get('http://localhost:8000/app/login.html'); - ptor.driver.findElement(protractor.By.id('username')).sendKeys('Jane'); - ptor.driver.findElement(protractor.By.id('password')).sendKeys('1234'); - ptor.driver.findElement(protractor.By.id('clickme')).click(); + browser.driver.findElement(by.id('username')).sendKeys('Jane'); + browser.driver.findElement(by.id('password')).sendKeys('1234'); + browser.driver.findElement(by.id('clickme')).click(); // Login takes some time, so wait until it's done. // For the test app's login, we know it's done when it redirects to // index.html. - ptor.wait(function() { - return ptor.driver.getCurrentUrl().then(function(url) { + browser.driver.wait(function() { + return browser.driver.getCurrentUrl().then(function(url) { return /index/.test(url); }); }); diff --git a/spec/login/viaConfigSpec.js b/spec/login/viaConfigSpec.js index 999702611..8f96b7eb4 100644 --- a/spec/login/viaConfigSpec.js +++ b/spec/login/viaConfigSpec.js @@ -1,18 +1,12 @@ describe('pages with login', function() { - var ptor; - - beforeEach(function() { - ptor = protractor.getInstance(); - }) - it('should log in with a non-Angular page', function() { - ptor.get('http://localhost:8000/app/index.html'); + browser.get('http://localhost:8000/app/index.html'); - var angularElement = ptor.findElement(protractor.By.input('url')); + var angularElement = element(by.input('url')); expect(angularElement.getAttribute('value')).toEqual('/fastcall'); // Make sure the cookie is still set. - ptor.manage().getCookie('testcookie').then(function(cookie) { + browser.manage().getCookie('testcookie').then(function(cookie) { expect(cookie.value).toEqual('Jane-1234'); }); }); diff --git a/spec/login/viaTestSpec.js b/spec/login/viaTestSpec.js index 2a2718198..e418bc0fa 100644 --- a/spec/login/viaTestSpec.js +++ b/spec/login/viaTestSpec.js @@ -1,39 +1,33 @@ describe('pages with login', function() { - var ptor; - - beforeEach(function() { - ptor = protractor.getInstance(); - }) - it('should log in with a non-Angular page', function() { - ptor.driver.get('http://localhost:8000/app/login.html'); + browser.driver.get('http://localhost:8000/app/login.html'); - ptor.driver.findElement(protractor.By.id('username')).sendKeys('Jane'); - ptor.driver.findElement(protractor.By.id('password')).sendKeys('1234'); - ptor.driver.findElement(protractor.By.id('clickme')).click(); + browser.driver.findElement(by.id('username')).sendKeys('Jane'); + browser.driver.findElement(by.id('password')).sendKeys('1234'); + browser.driver.findElement(by.id('clickme')).click(); // Login takes some time, so wait until it's done. // For the test app's login, we know it's done when it redirects to // index.html. - ptor.wait(function() { - return ptor.driver.getCurrentUrl().then(function(url) { + browser.wait(function() { + return browser.driver.getCurrentUrl().then(function(url) { return /index/.test(url); }); }); // The login should have set a cookie. Make sure it's there. - ptor.manage().getCookie('testcookie').then(function(cookie) { + browser.manage().getCookie('testcookie').then(function(cookie) { expect(cookie.value).toEqual('Jane-1234'); }); - ptor.get('http://localhost:8000/app/index.html'); + browser.get('http://localhost:8000/app/index.html'); - var angularElement = ptor.findElement(protractor.By.input('url')); + var angularElement = element(by.input('url')); expect(angularElement.getAttribute('value')).toEqual('/fastcall'); // Make sure the cookie is still set. - ptor.manage().getCookie('testcookie').then(function(cookie) { + browser.manage().getCookie('testcookie').then(function(cookie) { expect(cookie.value).toEqual('Jane-1234'); }); }); diff --git a/spec/onPrepare/onPrepare_spec.js b/spec/onPrepare/onPrepare_spec.js index 39cb31b86..64df791a9 100644 --- a/spec/onPrepare/onPrepare_spec.js +++ b/spec/onPrepare/onPrepare_spec.js @@ -1,18 +1,6 @@ -describe('tests that use the shortcuts set by the onPrepare in the config', +describe('onPrepare function in the config', function() { - beforeEach(function() { - // ptor is in the globals thanks to the onPrepare callback function in the - // config. - ptor.get('app/index.html#/form'); - }); - - it('should find an element using elem instead of findElement', function() { - var greeting = ptor.elem(protractor.By.binding('{{greeting}}')); - expect(greeting.getText()).toEqual('Hiya'); - }); - - it('should find an element using the global by function', function() { - var greeting = ptor.elem(by.binding('{{greeting}}')); - expect(greeting.getText()).toEqual('Hiya'); + it('should have a special variable set in onPrepare', function() { + expect(browser.params.password).toEqual('12345'); }); }); diff --git a/spec/onPrepare/startup.js b/spec/onPrepare/startup.js index a91b9a061..560f52a0f 100644 --- a/spec/onPrepare/startup.js +++ b/spec/onPrepare/startup.js @@ -1,5 +1 @@ -var ptor = protractor.getInstance(); -ptor.elem = ptor.findElement; -ptor.elems = ptor.findElements; -global.by = protractor.By; -global.ptor = ptor; +browser.params.password = '12345'; diff --git a/spec/onPrepareConf.js b/spec/onPrepareConf.js index 55f11c7e6..c3695c367 100644 --- a/spec/onPrepareConf.js +++ b/spec/onPrepareConf.js @@ -17,10 +17,6 @@ exports.config = { baseUrl: 'http://localhost:8000', onPrepare: function() { - var ptor = protractor.getInstance(); - ptor.elem = ptor.findElement; - ptor.elems = ptor.findElements; - global.by = protractor.By; - global.ptor = ptor; + browser.params.password = '12345'; } };