forked from angular/jasminewd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(async/await): Support overwriting native promise with WebDriver'…
…s version See angular#61
- Loading branch information
Showing
6 changed files
with
54 additions
and
3 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,3 +1,3 @@ | ||
*.log | ||
node_modules | ||
spec/asyncAwaitSpec.js | ||
spec/asyncAwaitSpec*.js |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* This is a test for an experimental feature to make async/await work with the | ||
* webdriver control flow. You should not use this. | ||
*/ | ||
"use strict"; | ||
|
||
// Declare globals | ||
declare var describe; | ||
declare var it; | ||
declare var expect; | ||
declare var require; | ||
|
||
let webdriver = require('selenium-webdriver'), | ||
flow = webdriver.promise.controlFlow(); | ||
require('../index.js').init(flow, webdriver.promise.Promise); | ||
|
||
describe('async function', function() { | ||
let sharedVal: any; | ||
it('should wait on async functions', async function() { | ||
sharedVal = await webdriver.promise.fulfilled('a'); | ||
expect(sharedVal).toBe('a'); | ||
flow.timeout(1000); // The control flow needs to work for this. | ||
sharedVal = await webdriver.promise.fulfilled('b'); | ||
}); | ||
|
||
it('should have waited until the end of the last it() block', function() { | ||
expect(sharedVal).toBe('b'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"spec_dir": "spec", | ||
"spec_files": [ | ||
"asyncAwaitSpec_experimental.js" | ||
] | ||
} |