mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
899f190da7
* 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.
22 lines
685 B
TypeScript
22 lines
685 B
TypeScript
import {browser} from 'protractor';
|
|
import {getElement, FinderResult} from './query';
|
|
|
|
/**
|
|
* Presses a single key or a sequence of keys.
|
|
*/
|
|
export function pressKeys(...keys: string[]): void {
|
|
let actions = browser.actions();
|
|
actions.sendKeys.call(actions, keys).perform();
|
|
}
|
|
|
|
/**
|
|
* Clicks an element at a specific point. Useful if there's another element
|
|
* that covers part of the target and can catch the click.
|
|
*/
|
|
export function clickElementAtPoint(element: FinderResult, coords: Point): void {
|
|
let webElement = getElement(element).getWebElement();
|
|
browser.actions().mouseMove(webElement, coords).click().perform();
|
|
}
|
|
|
|
export interface Point { x: number; y: number; }
|