source: trip-planner-front/node_modules/@angular/cdk/esm2015/testing/protractor/protractor-element.js

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

initial commit

  • Property mode set to 100644
File size: 36.2 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, TestKey, } from '@angular/cdk/testing';
10import { browser, Button, by, Key } from 'protractor';
11/** Maps the `TestKey` constants to Protractor's `Key` constants. */
12const keyMap = {
13 [TestKey.BACKSPACE]: Key.BACK_SPACE,
14 [TestKey.TAB]: Key.TAB,
15 [TestKey.ENTER]: Key.ENTER,
16 [TestKey.SHIFT]: Key.SHIFT,
17 [TestKey.CONTROL]: Key.CONTROL,
18 [TestKey.ALT]: Key.ALT,
19 [TestKey.ESCAPE]: Key.ESCAPE,
20 [TestKey.PAGE_UP]: Key.PAGE_UP,
21 [TestKey.PAGE_DOWN]: Key.PAGE_DOWN,
22 [TestKey.END]: Key.END,
23 [TestKey.HOME]: Key.HOME,
24 [TestKey.LEFT_ARROW]: Key.ARROW_LEFT,
25 [TestKey.UP_ARROW]: Key.ARROW_UP,
26 [TestKey.RIGHT_ARROW]: Key.ARROW_RIGHT,
27 [TestKey.DOWN_ARROW]: Key.ARROW_DOWN,
28 [TestKey.INSERT]: Key.INSERT,
29 [TestKey.DELETE]: Key.DELETE,
30 [TestKey.F1]: Key.F1,
31 [TestKey.F2]: Key.F2,
32 [TestKey.F3]: Key.F3,
33 [TestKey.F4]: Key.F4,
34 [TestKey.F5]: Key.F5,
35 [TestKey.F6]: Key.F6,
36 [TestKey.F7]: Key.F7,
37 [TestKey.F8]: Key.F8,
38 [TestKey.F9]: Key.F9,
39 [TestKey.F10]: Key.F10,
40 [TestKey.F11]: Key.F11,
41 [TestKey.F12]: Key.F12,
42 [TestKey.META]: Key.META
43};
44/** Converts a `ModifierKeys` object to a list of Protractor `Key`s. */
45function toProtractorModifierKeys(modifiers) {
46 const result = [];
47 if (modifiers.control) {
48 result.push(Key.CONTROL);
49 }
50 if (modifiers.alt) {
51 result.push(Key.ALT);
52 }
53 if (modifiers.shift) {
54 result.push(Key.SHIFT);
55 }
56 if (modifiers.meta) {
57 result.push(Key.META);
58 }
59 return result;
60}
61/**
62 * A `TestElement` implementation for Protractor.
63 * @deprecated
64 * @breaking-change 13.0.0
65 */
66export class ProtractorElement {
67 constructor(element) {
68 this.element = element;
69 }
70 /** Blur the element. */
71 blur() {
72 return __awaiter(this, void 0, void 0, function* () {
73 return browser.executeScript('arguments[0].blur()', this.element);
74 });
75 }
76 /** Clear the element's input (for input and textarea elements only). */
77 clear() {
78 return __awaiter(this, void 0, void 0, function* () {
79 return this.element.clear();
80 });
81 }
82 click(...args) {
83 return __awaiter(this, void 0, void 0, function* () {
84 yield this._dispatchClickEventSequence(args, Button.LEFT);
85 });
86 }
87 rightClick(...args) {
88 return __awaiter(this, void 0, void 0, function* () {
89 yield this._dispatchClickEventSequence(args, Button.RIGHT);
90 });
91 }
92 /** Focus the element. */
93 focus() {
94 return __awaiter(this, void 0, void 0, function* () {
95 return browser.executeScript('arguments[0].focus()', this.element);
96 });
97 }
98 /** Get the computed value of the given CSS property for the element. */
99 getCssValue(property) {
100 return __awaiter(this, void 0, void 0, function* () {
101 return this.element.getCssValue(property);
102 });
103 }
104 /** Hovers the mouse over the element. */
105 hover() {
106 return __awaiter(this, void 0, void 0, function* () {
107 return browser.actions()
108 .mouseMove(yield this.element.getWebElement())
109 .perform();
110 });
111 }
112 /** Moves the mouse away from the element. */
113 mouseAway() {
114 return __awaiter(this, void 0, void 0, function* () {
115 return browser.actions()
116 .mouseMove(yield this.element.getWebElement(), { x: -1, y: -1 })
117 .perform();
118 });
119 }
120 sendKeys(...modifiersAndKeys) {
121 return __awaiter(this, void 0, void 0, function* () {
122 const first = modifiersAndKeys[0];
123 let modifiers;
124 let rest;
125 if (typeof first !== 'string' && typeof first !== 'number') {
126 modifiers = first;
127 rest = modifiersAndKeys.slice(1);
128 }
129 else {
130 modifiers = {};
131 rest = modifiersAndKeys;
132 }
133 const modifierKeys = toProtractorModifierKeys(modifiers);
134 const keys = rest.map(k => typeof k === 'string' ? k.split('') : [keyMap[k]])
135 .reduce((arr, k) => arr.concat(k), [])
136 // Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),
137 // so avoid it if no modifier keys are required.
138 .map(k => modifierKeys.length > 0 ? Key.chord(...modifierKeys, k) : k);
139 return this.element.sendKeys(...keys);
140 });
141 }
142 /**
143 * Gets the text from the element.
144 * @param options Options that affect what text is included.
145 */
146 text(options) {
147 return __awaiter(this, void 0, void 0, function* () {
148 if (options === null || options === void 0 ? void 0 : options.exclude) {
149 return browser.executeScript(_getTextWithExcludedElements, this.element, options.exclude);
150 }
151 // We don't go through Protractor's `getText`, because it excludes text from hidden elements.
152 return browser.executeScript(`return (arguments[0].textContent || '').trim()`, this.element);
153 });
154 }
155 /** Gets the value for the given attribute from the element. */
156 getAttribute(name) {
157 return __awaiter(this, void 0, void 0, function* () {
158 return browser.executeScript(`return arguments[0].getAttribute(arguments[1])`, this.element, name);
159 });
160 }
161 /** Checks whether the element has the given class. */
162 hasClass(name) {
163 return __awaiter(this, void 0, void 0, function* () {
164 const classes = (yield this.getAttribute('class')) || '';
165 return new Set(classes.split(/\s+/).filter(c => c)).has(name);
166 });
167 }
168 /** Gets the dimensions of the element. */
169 getDimensions() {
170 return __awaiter(this, void 0, void 0, function* () {
171 const { width, height } = yield this.element.getSize();
172 const { x: left, y: top } = yield this.element.getLocation();
173 return { width, height, left, top };
174 });
175 }
176 /** Gets the value of a property of an element. */
177 getProperty(name) {
178 return __awaiter(this, void 0, void 0, function* () {
179 return browser.executeScript(`return arguments[0][arguments[1]]`, this.element, name);
180 });
181 }
182 /** Sets the value of a property of an input. */
183 setInputValue(value) {
184 return __awaiter(this, void 0, void 0, function* () {
185 return browser.executeScript(`arguments[0].value = arguments[1]`, this.element, value);
186 });
187 }
188 /** Selects the options at the specified indexes inside of a native `select` element. */
189 selectOptions(...optionIndexes) {
190 return __awaiter(this, void 0, void 0, function* () {
191 const options = yield this.element.all(by.css('option'));
192 const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.
193 if (options.length && indexes.size) {
194 // Reset the value so all the selected states are cleared. We can
195 // reuse the input-specific method since the logic is the same.
196 yield this.setInputValue('');
197 for (let i = 0; i < options.length; i++) {
198 if (indexes.has(i)) {
199 // We have to hold the control key while clicking on options so that multiple can be
200 // selected in multi-selection mode. The key doesn't do anything for single selection.
201 yield browser.actions().keyDown(Key.CONTROL).perform();
202 yield options[i].click();
203 yield browser.actions().keyUp(Key.CONTROL).perform();
204 }
205 }
206 }
207 });
208 }
209 /** Checks whether this element matches the given selector. */
210 matchesSelector(selector) {
211 return __awaiter(this, void 0, void 0, function* () {
212 return browser.executeScript(`
213 return (Element.prototype.matches ||
214 Element.prototype.msMatchesSelector).call(arguments[0], arguments[1])
215 `, this.element, selector);
216 });
217 }
218 /** Checks whether the element is focused. */
219 isFocused() {
220 return __awaiter(this, void 0, void 0, function* () {
221 return this.element.equals(browser.driver.switchTo().activeElement());
222 });
223 }
224 /**
225 * Dispatches an event with a particular name.
226 * @param name Name of the event to be dispatched.
227 */
228 dispatchEvent(name, data) {
229 return __awaiter(this, void 0, void 0, function* () {
230 return browser.executeScript(_dispatchEvent, name, this.element, data);
231 });
232 }
233 /** Dispatches all the events that are part of a click event sequence. */
234 _dispatchClickEventSequence(args, button) {
235 return __awaiter(this, void 0, void 0, function* () {
236 let modifiers = {};
237 if (args.length && typeof args[args.length - 1] === 'object') {
238 modifiers = args.pop();
239 }
240 const modifierKeys = toProtractorModifierKeys(modifiers);
241 // Omitting the offset argument to mouseMove results in clicking the center.
242 // This is the default behavior we want, so we use an empty array of offsetArgs if
243 // no args remain after popping the modifiers from the args passed to this function.
244 const offsetArgs = (args.length === 2 ?
245 [{ x: args[0], y: args[1] }] : []);
246 let actions = browser.actions()
247 .mouseMove(yield this.element.getWebElement(), ...offsetArgs);
248 for (const modifierKey of modifierKeys) {
249 actions = actions.keyDown(modifierKey);
250 }
251 actions = actions.click(button);
252 for (const modifierKey of modifierKeys) {
253 actions = actions.keyUp(modifierKey);
254 }
255 yield actions.perform();
256 });
257 }
258}
259/**
260 * Dispatches an event with a particular name and data to an element.
261 * Note that this needs to be a pure function, because it gets stringified by
262 * Protractor and is executed inside the browser.
263 */
264function _dispatchEvent(name, element, data) {
265 const event = document.createEvent('Event');
266 event.initEvent(name);
267 if (data) {
268 // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
269 Object.assign(event, data);
270 }
271 // This type has a string index signature, so we cannot access it using a dotted property access.
272 element['dispatchEvent'](event);
273}
274//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdHJhY3Rvci1lbGVtZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay90ZXN0aW5nL3Byb3RyYWN0b3IvcHJvdHJhY3Rvci1lbGVtZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7QUFFSCxPQUFPLEVBQ0wsNEJBQTRCLEVBSTVCLE9BQU8sR0FHUixNQUFNLHNCQUFzQixDQUFDO0FBQzlCLE9BQU8sRUFBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUUsRUFBaUIsR0FBRyxFQUFDLE1BQU0sWUFBWSxDQUFDO0FBRW5FLG9FQUFvRTtBQUNwRSxNQUFNLE1BQU0sR0FBRztJQUNiLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxVQUFVO0lBQ25DLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxHQUFHO0lBQ3RCLENBQUMsT0FBT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