source: trip-planner-front/node_modules/@angular/cdk/esm2015/testing/selenium-webdriver/selenium-web-driver-element.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 34.9 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { __awaiter } from "tslib";
9import { _getTextWithExcludedElements } from '@angular/cdk/testing';
10import * as webdriver from 'selenium-webdriver';
11import { getSeleniumWebDriverModifierKeys, seleniumWebDriverKeyMap } from './selenium-webdriver-keys';
12/** A `TestElement` implementation for WebDriver. */
13export class SeleniumWebDriverElement {
14 constructor(element, _stabilize) {
15 this.element = element;
16 this._stabilize = _stabilize;
17 }
18 /** Blur the element. */
19 blur() {
20 return __awaiter(this, void 0, void 0, function* () {
21 yield this._executeScript(((element) => element.blur()), this.element());
22 yield this._stabilize();
23 });
24 }
25 /** Clear the element's input (for input and textarea elements only). */
26 clear() {
27 return __awaiter(this, void 0, void 0, function* () {
28 yield this.element().clear();
29 yield this._stabilize();
30 });
31 }
32 click(...args) {
33 return __awaiter(this, void 0, void 0, function* () {
34 yield this._dispatchClickEventSequence(args, webdriver.Button.LEFT);
35 yield this._stabilize();
36 });
37 }
38 rightClick(...args) {
39 return __awaiter(this, void 0, void 0, function* () {
40 yield this._dispatchClickEventSequence(args, webdriver.Button.RIGHT);
41 yield this._stabilize();
42 });
43 }
44 /** Focus the element. */
45 focus() {
46 return __awaiter(this, void 0, void 0, function* () {
47 yield this._executeScript((element) => element.focus(), this.element());
48 yield this._stabilize();
49 });
50 }
51 /** Get the computed value of the given CSS property for the element. */
52 getCssValue(property) {
53 return __awaiter(this, void 0, void 0, function* () {
54 yield this._stabilize();
55 return this.element().getCssValue(property);
56 });
57 }
58 /** Hovers the mouse over the element. */
59 hover() {
60 return __awaiter(this, void 0, void 0, function* () {
61 yield this._actions().mouseMove(this.element()).perform();
62 yield this._stabilize();
63 });
64 }
65 /** Moves the mouse away from the element. */
66 mouseAway() {
67 return __awaiter(this, void 0, void 0, function* () {
68 yield this._actions().mouseMove(this.element(), { x: -1, y: -1 }).perform();
69 yield this._stabilize();
70 });
71 }
72 sendKeys(...modifiersAndKeys) {
73 return __awaiter(this, void 0, void 0, function* () {
74 const first = modifiersAndKeys[0];
75 let modifiers;
76 let rest;
77 if (typeof first !== 'string' && typeof first !== 'number') {
78 modifiers = first;
79 rest = modifiersAndKeys.slice(1);
80 }
81 else {
82 modifiers = {};
83 rest = modifiersAndKeys;
84 }
85 const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);
86 const keys = rest.map(k => typeof k === 'string' ? k.split('') : [seleniumWebDriverKeyMap[k]])
87 .reduce((arr, k) => arr.concat(k), [])
88 // webdriver.Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),
89 // so avoid it if no modifier keys are required.
90 .map(k => modifierKeys.length > 0 ? webdriver.Key.chord(...modifierKeys, k) : k);
91 yield this.element().sendKeys(...keys);
92 yield this._stabilize();
93 });
94 }
95 /**
96 * Gets the text from the element.
97 * @param options Options that affect what text is included.
98 */
99 text(options) {
100 return __awaiter(this, void 0, void 0, function* () {
101 yield this._stabilize();
102 if (options === null || options === void 0 ? void 0 : options.exclude) {
103 return this._executeScript(_getTextWithExcludedElements, this.element(), options.exclude);
104 }
105 // We don't go through the WebDriver `getText`, because it excludes text from hidden elements.
106 return this._executeScript((element) => (element.textContent || '').trim(), this.element());
107 });
108 }
109 /** Gets the value for the given attribute from the element. */
110 getAttribute(name) {
111 return __awaiter(this, void 0, void 0, function* () {
112 yield this._stabilize();
113 return this._executeScript((element, attribute) => element.getAttribute(attribute), this.element(), name);
114 });
115 }
116 /** Checks whether the element has the given class. */
117 hasClass(name) {
118 return __awaiter(this, void 0, void 0, function* () {
119 yield this._stabilize();
120 const classes = (yield this.getAttribute('class')) || '';
121 return new Set(classes.split(/\s+/).filter(c => c)).has(name);
122 });
123 }
124 /** Gets the dimensions of the element. */
125 getDimensions() {
126 return __awaiter(this, void 0, void 0, function* () {
127 yield this._stabilize();
128 const { width, height } = yield this.element().getSize();
129 const { x: left, y: top } = yield this.element().getLocation();
130 return { width, height, left, top };
131 });
132 }
133 /** Gets the value of a property of an element. */
134 getProperty(name) {
135 return __awaiter(this, void 0, void 0, function* () {
136 yield this._stabilize();
137 return this._executeScript((element, property) => element[property], this.element(), name);
138 });
139 }
140 /** Sets the value of a property of an input. */
141 setInputValue(newValue) {
142 return __awaiter(this, void 0, void 0, function* () {
143 yield this._executeScript((element, value) => element.value = value, this.element(), newValue);
144 yield this._stabilize();
145 });
146 }
147 /** Selects the options at the specified indexes inside of a native `select` element. */
148 selectOptions(...optionIndexes) {
149 return __awaiter(this, void 0, void 0, function* () {
150 yield this._stabilize();
151 const options = yield this.element().findElements(webdriver.By.css('option'));
152 const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.
153 if (options.length && indexes.size) {
154 // Reset the value so all the selected states are cleared. We can
155 // reuse the input-specific method since the logic is the same.
156 yield this.setInputValue('');
157 for (let i = 0; i < options.length; i++) {
158 if (indexes.has(i)) {
159 // We have to hold the control key while clicking on options so that multiple can be
160 // selected in multi-selection mode. The key doesn't do anything for single selection.
161 yield this._actions().keyDown(webdriver.Key.CONTROL).perform();
162 yield options[i].click();
163 yield this._actions().keyUp(webdriver.Key.CONTROL).perform();
164 }
165 }
166 yield this._stabilize();
167 }
168 });
169 }
170 /** Checks whether this element matches the given selector. */
171 matchesSelector(selector) {
172 return __awaiter(this, void 0, void 0, function* () {
173 yield this._stabilize();
174 return this._executeScript((element, s) => (Element.prototype.matches || Element.prototype.msMatchesSelector)
175 .call(element, s), this.element(), selector);
176 });
177 }
178 /** Checks whether the element is focused. */
179 isFocused() {
180 return __awaiter(this, void 0, void 0, function* () {
181 yield this._stabilize();
182 return webdriver.WebElement.equals(this.element(), this.element().getDriver().switchTo().activeElement());
183 });
184 }
185 /**
186 * Dispatches an event with a particular name.
187 * @param name Name of the event to be dispatched.
188 */
189 dispatchEvent(name, data) {
190 return __awaiter(this, void 0, void 0, function* () {
191 yield this._executeScript(dispatchEvent, name, this.element(), data);
192 yield this._stabilize();
193 });
194 }
195 /** Gets the webdriver action sequence. */
196 _actions() {
197 return this.element().getDriver().actions();
198 }
199 /** Executes a function in the browser. */
200 _executeScript(script, ...var_args) {
201 return __awaiter(this, void 0, void 0, function* () {
202 return this.element().getDriver().executeScript(script, ...var_args);
203 });
204 }
205 /** Dispatches all the events that are part of a click event sequence. */
206 _dispatchClickEventSequence(args, button) {
207 return __awaiter(this, void 0, void 0, function* () {
208 let modifiers = {};
209 if (args.length && typeof args[args.length - 1] === 'object') {
210 modifiers = args.pop();
211 }
212 const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);
213 // Omitting the offset argument to mouseMove results in clicking the center.
214 // This is the default behavior we want, so we use an empty array of offsetArgs if
215 // no args remain after popping the modifiers from the args passed to this function.
216 const offsetArgs = (args.length === 2 ?
217 [{ x: args[0], y: args[1] }] : []);
218 let actions = this._actions().mouseMove(this.element(), ...offsetArgs);
219 for (const modifierKey of modifierKeys) {
220 actions = actions.keyDown(modifierKey);
221 }
222 actions = actions.click(button);
223 for (const modifierKey of modifierKeys) {
224 actions = actions.keyUp(modifierKey);
225 }
226 yield actions.perform();
227 });
228 }
229}
230/**
231 * Dispatches an event with a particular name and data to an element. Note that this needs to be a
232 * pure function, because it gets stringified by WebDriver and is executed inside the browser.
233 */
234function dispatchEvent(name, element, data) {
235 const event = document.createEvent('Event');
236 event.initEvent(name);
237 // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
238 Object.assign(event, data || {});
239 element.dispatchEvent(event);
240}
241//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZW5pdW0td2ViLWRyaXZlci1lbGVtZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4v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