This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait up to 3 seconds for angular to be found on the page, and if it i…
…sn't give a sane error message. Fixes issue #2.
- Loading branch information
Showing
2 changed files
with
93 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,63 @@ | ||
var webdriver = require('selenium-webdriver'); | ||
var protractor = require('./protractor.js'); | ||
var assert = require('assert'); | ||
var util = require('util'); | ||
|
||
var driver = new webdriver.Builder(). | ||
usingServer('http://localhost:4444/wd/hub'). | ||
withCapabilities({ | ||
'browserName': 'chrome', | ||
'version': '', | ||
'platform': 'ANY', | ||
'javascriptEnabled': true | ||
}).build(); | ||
|
||
driver.manage().timeouts().setScriptTimeout(10000); | ||
var ptor = protractor.wrapDriver(driver); | ||
describe('angularjs homepage', function() { | ||
var webdriver = require('selenium-webdriver'); | ||
var protractor = require('./protractor.js'); | ||
|
||
ptor.get('http://www.angularjs.org'); | ||
var driver = new webdriver.Builder(). | ||
usingServer('http://localhost:4444/wd/hub'). | ||
withCapabilities({ | ||
'browserName': 'chrome', | ||
'version': '', | ||
'platform': 'ANY', | ||
'javascriptEnabled': true | ||
}).build(); | ||
|
||
ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); | ||
driver.manage().timeouts().setScriptTimeout(10000); | ||
var ptor = protractor.wrapDriver(driver); | ||
|
||
ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). | ||
getText().then(function(text) { | ||
assert.equal('Hello Julie!', text); | ||
}); | ||
it('should greet using binding', function(done) { | ||
ptor.get('http://www.angularjs.org'); | ||
|
||
// Uncomment to see failures. | ||
// ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). | ||
// getText().then(function(text) { | ||
// assert.equal('Hello Jack!', text); | ||
// }); | ||
ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); | ||
|
||
ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). | ||
getText().then(function(text) { | ||
expect(text).toEqual('Hello Julie!'); | ||
done(); | ||
}); | ||
}, 10000); | ||
|
||
it('should greet using binding - #2', function(done) { | ||
ptor.get('http://www.angularjs.org'); | ||
|
||
ptor.findElement(protractor.By.input("yourName")).sendKeys("Jane"); | ||
|
||
ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). | ||
getText().then(function(text) { | ||
expect(text).toEqual('Hello Jane!'); | ||
done(); | ||
}); | ||
}, 10000); | ||
|
||
// Uncomment to see failures. | ||
it('should greet using binding - this one fails', function(done) { | ||
ptor.get('http://www.angularjs.org'); | ||
|
||
ptor.findElement(protractor.By.input("yourName")).sendKeys("Julie"); | ||
|
||
ptor.findElement(protractor.By.binding("Hello {{yourName}}!")). | ||
getText().then(function(text) { | ||
expect(text).toEqual('Hello Jack'); | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it('afterAll', function() { | ||
// This is a sad hack to do any shutdown of the server. | ||
// TODO(juliemr): Add afterall functionality to jasmine-node | ||
driver.quit(); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters