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.
chore(example): update the TypeScript example to be async / await (#5203
- Loading branch information
Showing
12 changed files
with
50 additions
and
140 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,4 +1,7 @@ | ||
*.js | ||
plugins.js | ||
spec.js | ||
specPageObjects.js | ||
angularPage.js | ||
*.d.ts | ||
node_modules | ||
tmp/ | ||
!asyncAwait/*.js | ||
package-lock.json |
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
// Because this file references protractor, you'll need to have it as a project | ||
// dependency to use 'protractor/globals'. Here is the full list of imports: | ||
// dependency to use 'protractor'. Here is the full list of imports: | ||
// | ||
// import {browser, element, by, By, $, $$, ExpectedConditions} | ||
// from 'protractor/globals'; | ||
// from 'protractor'; | ||
// | ||
import {browser, element, by} from 'protractor'; | ||
|
||
export class AngularHomepage { | ||
nameInput = element(by.model('yourName')); | ||
greeting = element(by.binding('yourName')); | ||
|
||
get() { | ||
browser.get('http://www.angularjs.org'); | ||
async get(): Promise<void> { | ||
await browser.get('http://www.angularjs.org'); | ||
} | ||
|
||
setName(name: string) { | ||
this.nameInput.sendKeys(name); | ||
async setName(name: string): Promise<void> { | ||
await this.nameInput.sendKeys(name); | ||
} | ||
|
||
// getGreeting returns a webdriver.promise.Promise.<string>. For simplicity | ||
// setting the return value to any | ||
getGreeting(): any { | ||
// getGreeting returns a native Promise<string> | ||
async getGreeting(): Promise<string> { | ||
return this.greeting.getText(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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