|
1 |
| -var webdriver = require('selenium-webdriver'); |
2 |
| -var protractor = require('./protractor.js'); |
3 |
| -var assert = require('assert'); |
4 | 1 | var util = require('util');
|
5 | 2 |
|
6 |
| -var driver = new webdriver.Builder(). |
7 |
| - usingServer('http://localhost:4444/wd/hub'). |
8 |
| - withCapabilities({ |
9 |
| - 'browserName': 'chrome', |
10 |
| - 'version': '', |
11 |
| - 'platform': 'ANY', |
12 |
| - 'javascriptEnabled': true |
13 |
| - }).build(); |
14 | 3 |
|
15 |
| -driver.manage().timeouts().setScriptTimeout(10000); |
16 |
| -var ptor = protractor.wrapDriver(driver); |
| 4 | +describe('angularjs homepage', function() { |
| 5 | + var webdriver = require('selenium-webdriver'); |
| 6 | + var protractor = require('./protractor.js'); |
17 | 7 |
|
18 |
| -ptor.get('http://www.angularjs.org'); |
| 8 | + var driver = new webdriver.Builder(). |
| 9 | + usingServer('http://localhost:4444/wd/hub'). |
| 10 | + withCapabilities({ |
| 11 | + 'browserName': 'chrome', |
| 12 | + 'version': '', |
| 13 | + 'platform': 'ANY', |
| 14 | + 'javascriptEnabled': true |
| 15 | + }).build(); |
19 | 16 |
|
20 |
| -ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); |
| 17 | + driver.manage().timeouts().setScriptTimeout(10000); |
| 18 | + var ptor = protractor.wrapDriver(driver); |
21 | 19 |
|
22 |
| -ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). |
23 |
| - getText().then(function(text) { |
24 |
| - assert.equal('Hello Julie!', text); |
25 |
| - }); |
| 20 | + it('should greet using binding', function(done) { |
| 21 | + ptor.get('http://www.angularjs.org'); |
26 | 22 |
|
27 |
| -// Uncomment to see failures. |
28 |
| -// ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). |
29 |
| -// getText().then(function(text) { |
30 |
| -// assert.equal('Hello Jack!', text); |
31 |
| -// }); |
| 23 | + ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); |
| 24 | + |
| 25 | + ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). |
| 26 | + getText().then(function(text) { |
| 27 | + expect(text).toEqual('Hello Julie!'); |
| 28 | + done(); |
| 29 | + }); |
| 30 | + }, 10000); |
| 31 | + |
| 32 | + it('should greet using binding - #2', function(done) { |
| 33 | + ptor.get('http://www.angularjs.org'); |
| 34 | + |
| 35 | + ptor.findElement(protractor.By.input("yourName")).sendKeys("Jane"); |
| 36 | + |
| 37 | + ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). |
| 38 | + getText().then(function(text) { |
| 39 | + expect(text).toEqual('Hello Jane!'); |
| 40 | + done(); |
| 41 | + }); |
| 42 | + }, 10000); |
| 43 | + |
| 44 | + // Uncomment to see failures. |
| 45 | + it('should greet using binding - this one fails', function(done) { |
| 46 | + ptor.get('http://www.angularjs.org'); |
| 47 | + |
| 48 | + ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); |
| 49 | + |
| 50 | + ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). |
| 51 | + getText().then(function(text) { |
| 52 | + expect(text).toEqual('Hello Jack'); |
| 53 | + done(); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
| 57 | + |
| 58 | + it('afterAll', function() { |
| 59 | + // This is a sad hack to do any shutdown of the server. |
| 60 | + // TODO(juliemr): Add afterall functionality to jasmine-node |
| 61 | + driver.quit(); |
| 62 | + }) |
| 63 | +}); |
0 commit comments