Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract .whenPageHasLoaded HOF.

  • Loading branch information...
commit f03d77503a03dfaed3ecb89f257ac26ab2096daa 1 parent 35adcb7
Miki Leskinen authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 spec/js/acceptance/foo-twitter-client-spec.js
View
17 spec/js/acceptance/foo-twitter-client-spec.js
@@ -4,26 +4,23 @@ describe('twitter client', function() {
describe('initial', function() {
it('has correct title', function() {
- browser.visit('http://localhost:8003/', function(error, browser) {
+ whenPageHasLoaded(function() {
expect(browser.text('title')).toEqual('Foo Twitter Client')
asyncSpecDone()
})
- asyncSpecWait()
})
it('has trends link', function() {
- browser.visit('http://localhost:8003/', function(error, browser) {
+ whenPageHasLoaded(function() {
expect(browser.text('.actions .showTrends')).toEqual('Trends')
asyncSpecDone()
})
- asyncSpecWait()
})
})
describe('when toggling trends link', function() {
it('shows and hides latest trends', function() {
- expect(browser.querySelectorAll('.trends .trend').length).toEqual(0)
- browser.visit('http://localhost:8003/', function(error, browser) {
+ whenPageHasLoaded(function() {
browser.clickLink('.showTrends', function(error, browser) {
expect(browser.querySelectorAll('.trends .trend').length).toEqual(10)
browser.clickLink('.showTrends', function(error, browser) {
@@ -32,7 +29,13 @@ describe('twitter client', function() {
})
})
})
- asyncSpecWait()
})
})
+
+ function whenPageHasLoaded(callback) {
+ browser.visit('http://localhost:8003/', function(error, browser) {
+ callback.call()
+ })
+ asyncSpecWait()
+ }
})
Please sign in to comment.
Something went wrong with that request. Please try again.