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.
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
`async`/`await` in Protractor | ||
============================= | ||
|
||
`async`/`await` is an a feature that may or may not be added to javascript in | ||
the future. It is currently accessible via typescript if you compile using | ||
`tsc -t ES2015 <files>`. Protractor supports returning a promise at the end of | ||
an `it()` block, so it indirectly supports `async`/`await` (so long as your | ||
programming environment supports it). |
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,15 @@ | ||
// Because this file imports from protractor, you'll need to have it as a | ||
// project dependency. | ||
// | ||
// To run this example, run 'npm run tsc -t ES2015' to transpile the typescript | ||
// to javascript. run with 'protractor conf.js' | ||
import {Config} from 'protractor'; | ||
|
||
export let config: Config = { | ||
framework: 'jasmine', | ||
capabilities: { | ||
browserName: 'chrome' | ||
}, | ||
specs: [ 'spec.js' ], | ||
seleniumAddress: 'http://localhost:4444/wd/hub' | ||
}; |
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,13 @@ | ||
// Same process for importing and compiling at ../spec.ts, except you need to | ||
// pass the `-t ES2015` flag to `tsc`. | ||
import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor/globals'; | ||
|
||
describe('async function', function() { | ||
it('should wait on async function in conditional', async function() : Promise<any> { | ||
browser.get('http://www.angularjs.org'); | ||
let todoList = element.all(by.repeater('todo in todoList.todos')); | ||
if ((await todoList.count()) > 1) { | ||
expect(todoList.get(1).getText()).toEqual('build an angular app'); | ||
} | ||
}); | ||
}); |