|
1 | 1 | 'use strict'; // necessary for es6 output in node |
2 | 2 |
|
3 | | -import { protractor, browser, element, by } from 'protractor/globals'; |
4 | | -import { ElementFinder } from 'protractor'; |
| 3 | +import { protractor, browser, element, by, ElementFinder } from 'protractor'; |
5 | 4 |
|
6 | 5 | const nameSuffix = 'X'; |
7 | 6 |
|
@@ -45,7 +44,8 @@ function heroTests() { |
45 | 44 | }); |
46 | 45 |
|
47 | 46 | it('shows selected hero details', async () => { |
48 | | - await element(by.cssContainingText('li', targetHero.name)).click(); |
| 47 | + // await element(by.cssContainingText('li', targetHero.name)).click(); |
| 48 | + await <Promise<void>>(<any>(element(by.cssContainingText('li', targetHero.name)).click())); |
49 | 49 | let page = getPageElts(); |
50 | 50 | let hero = await heroFromDetail(page.heroDetail); |
51 | 51 | expect(hero.id).toEqual(targetHero.id); |
@@ -91,9 +91,11 @@ function getPageElts() { |
91 | 91 |
|
92 | 92 | async function heroFromDetail(detail: ElementFinder): Promise<Hero> { |
93 | 93 | // Get hero id from the first <div> |
94 | | - let _id = await detail.all(by.css('div')).first().getText(); |
| 94 | + // let _id = await detail.all(by.css('div')).first().getText(); |
| 95 | + let _id = await <Promise<string>>(<any>(detail.all(by.css('div')).first().getText())); |
95 | 96 | // Get name from the h2 |
96 | | - let _name = await detail.element(by.css('h4')).getText(); |
| 97 | + // let _name = await detail.element(by.css('h4')).getText(); |
| 98 | + let _name = await <Promise<string>>(<any>( detail.element(by.css('h4')).getText())); |
97 | 99 | return { |
98 | 100 | id: +_id.substr(_id.indexOf(' ') + 1), |
99 | 101 | name: _name.substr(0, _name.lastIndexOf(' ')) |
|
0 commit comments