Files
angular__angular/e2e/util/query.ts
T
Kristiyan Kostadinov 899f190da7 test: add class with e2e test utilities (#2070)
* test: add class with e2e test utilities

* Adds a class that simplifies some common and hard to remember Protractor expressions.
* Refactors the existing tests to use the new utilities.

Fixes #2025.

* Add types to the e2e utils and fix the selector on the dialog tests.

* Remove unnecessary rounding.

* Remove `any` cast.

* Simplify the slide toggle tests.

* Split the E2E utils class into smaller files.

* Fix a leftover.
2017-01-18 14:13:48 -08:00

19 lines
531 B
TypeScript

import {ElementFinder, by, element, ProtractorBy, browser} from 'protractor';
/**
* Normalizes either turning a selector into an
* ElementFinder or returning the finder itself.
*/
export function getElement(el: FinderResult): ElementFinder {
return typeof el === 'string' ? element(by.css(el)) : el;
}
/**
* Waits for an element to be rendered.
*/
export function waitForElement(selector: string) {
return browser.isElementPresent(by.css(selector) as ProtractorBy);
}
export type FinderResult = ElementFinder | string;