-
Notifications
You must be signed in to change notification settings - Fork 261
/
data-table-component.page.ts
618 lines (511 loc) · 24.4 KB
/
data-table-component.page.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element, protractor, ElementFinder, ElementArrayFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
const MAX_LOADING_TIME = 120000;
export class DataTableComponentPage {
rootElement: ElementFinder;
list: ElementArrayFinder;
contents: ElementArrayFinder;
tableBody: ElementFinder;
allColumns: ElementArrayFinder;
selectedRowNumber: ElementFinder;
allSelectedRows: ElementArrayFinder;
selectAll: ElementFinder;
copyColumnTooltip: ElementFinder;
emptyList: ElementFinder;
emptyListTitle: ElementFinder;
emptyListSubtitle: ElementFinder;
noContentContainer: ElementFinder;
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
this.contents = this.rootElement.$$('.adf-datatable-body span');
this.tableBody = this.rootElement.$$(`.adf-datatable-body`).first();
this.allColumns = this.rootElement.$$('div[data-automation-id*="auto_id_entry."]');
this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`);
this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`);
this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`);
this.copyColumnTooltip = this.rootElement.$(`adf-copy-content-tooltip span`);
this.emptyList = this.rootElement.$(`adf-empty-content`);
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
this.noContentContainer = $(`div[class*='adf-no-content-container']`);
}
geCellElementDetail(detail: string): ElementArrayFinder {
return $$(`adf-datatable div[title="${detail}"] span`);
}
async checkAllRowsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll);
}
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async uncheckAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async clickCheckbox(columnName: string, columnValue: string): Promise<void> {
const checkbox = this.getRowCheckbox(columnName, columnValue);
await BrowserActions.click(checkbox);
}
async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).$('input[aria-checked="true"]'));
}
async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]'));
}
getRowCheckbox(columnName: string, columnValue: string): ElementFinder {
return this.getRow(columnName, columnValue).$('mat-checkbox');
}
async checkNoRowIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
}
async getNumberOfSelectedRows(): Promise<number> {
return this.allSelectedRows.count();
}
async selectRow(columnName: string, columnValue: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const row = this.getRow(columnName, columnValue);
await BrowserActions.click(row);
}
async selectRowWithKeyboard(columnName: string, columnValue: string): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(columnName, columnValue);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async selectMultipleRows(columnName: string, items: string[]): Promise<void> {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await this.clearRowsSelection();
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
for (const item of items) {
await this.selectRow(columnName, item);
}
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async clearRowsSelection(): Promise<void> {
try {
const count = await this.getNumberOfSelectedRows();
if (count !== 0) {
await browser.refresh();
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}
} catch (error) {
Logger.error('------ clearSelection catch : ', error);
}
}
async checkRowIsSelected(columnName: string, columnValue: string): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
}
async checkRowIsNotSelected(columnName: string, columnValue: string): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
}
async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise<string> {
const row = this.getRow(identifyingColumn, identifyingValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.$(`div[title="${columnName}"] span`);
return BrowserActions.getText(rowColumn);
}
/**
* Check the list is sorted.
*
* @param sortOrder: 'ASC' if the list is await expected to be sorted ascending and 'DESC' for descending
* @param columnTitle: titleColumn column
* @param listType: 'string' for string typed lists and 'number' for number typed (int, float) lists
* @return 'true' if the list is sorted as await expected and 'false' if it isn't
*/
async checkListIsSorted(sortOrder: string, columnTitle: string, listType: string = 'STRING'): Promise<any> {
const column = $$(`div.adf-datatable-cell[title='${columnTitle}'] span`);
await BrowserVisibility.waitUntilElementIsVisible(column.first());
const initialList = [];
const length = await column.count();
for (let i = 0; i < length; i++) {
const text = await BrowserActions.getText(column.get(i));
if (text.length !== 0) {
initialList.push(text.toLowerCase());
}
}
let sortedList = [...initialList];
if (listType.toLocaleLowerCase() === 'string') {
sortedList = sortedList.sort();
} else if (listType.toLocaleLowerCase() === 'number') {
sortedList = sortedList.sort((a, b) => a - b);
} else if (listType.toLocaleLowerCase() === 'priority') {
sortedList = sortedList.sort(this.sortPriority);
}
if (['desc', 'descending'].includes(sortOrder.toLocaleLowerCase())) {
sortedList = sortedList.reverse();
}
return initialList.toString() === sortedList.toString();
}
sortPriority(a: string, b: string) {
if (a === b) {
return 0;
}
if (a.toLocaleLowerCase() === 'none') {
return -1;
}
if (a.toLocaleLowerCase() === 'low') {
if (b === 'none') {
return 1;
} else {
return -1;
}
}
if (a.toLocaleLowerCase() === 'normal') {
if (b.toLocaleLowerCase() === 'high') {
return -1;
} else {
return 1;
}
}
return 1;
}
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
await this.rightClickOnItem(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async getTooltip(columnName: string, columnValue: string): Promise<string> {
return BrowserActions.getAttribute(this.getCellElementByValue(columnName, columnValue), 'title');
}
async rightClickOnRowByIndex(index: number): Promise<void> {
const row = this.getRowByIndex(index);
await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async rightClickOnItem(columnName: string, columnValue: string): Promise<void> {
const row = this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row);
}
getFileHyperlink(filename: string): ElementFinder {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
}
async numberOfRows(): Promise<number> {
try {
await this.waitForFirstRow();
return this.rootElement.$$(this.rows).count();
} catch (e) {
return 0;
}
}
async waitForFirstRow(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first());
}
async getAllRowsColumnValues(column: string): Promise<string[]> {
let columnValues: string[] = [];
const columnLocator = $$(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title="${column}"] span`);
await BrowserVisibility.waitUntilElementIsPresent(await columnLocator.first(), 1000);
try {
await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000);
columnValues = await columnLocator
.filter(async (el) => el.isPresent())
.map(async (el) => el.getText());
} catch (error) {
Logger.log(error);
}
return columnValues;
}
async getRowsWithSameColumnValues(columnName: string, columnValue: string) {
const columnLocator = `div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`;
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(columnLocator).first());
return this.rootElement.$$(columnLocator).getText();
}
async doubleClickRow(columnName: string, columnValue: string): Promise<void> {
const row = this.getRow(columnName, columnValue);
await BrowserActions.click(row);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
async getFirstElementDetail(detail: string): Promise<string> {
const firstNode = $$(`adf-datatable div[title="${detail}"] span`).first();
return BrowserActions.getText(firstNode);
}
/**
* Sort the list by name column.
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
async sortByColumn(sortOrder: string, titleColumn: string): Promise<void> {
const locator = $(`div[data-automation-id="auto_id_${titleColumn}"]`);
await BrowserVisibility.waitUntilElementIsVisible(locator);
const result = await BrowserActions.getAttribute(locator, 'class');
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
await BrowserActions.click(locator);
}
}
} else {
if (result.includes('sorted-asc')) {
await BrowserActions.click(locator);
} else if (result.includes('sortable')) {
await BrowserActions.click(locator);
await BrowserActions.click(locator);
}
}
}
async checkContentIsDisplayed(columnName: string, columnValue: string, retry = 0): Promise<void> {
Logger.log(`Wait content is displayed ${columnName} ${columnValue} retry: ${retry}`);
const row = this.getCellElementByValue(columnName, columnValue);
try {
await BrowserVisibility.waitUntilElementIsVisible(row);
} catch (error) {
if (retry < 3) {
retry++;
await this.checkContentIsDisplayed(columnName, columnValue, retry);
} else {
throw error;
}
}
}
async checkContentIsNotDisplayed(columnName: string, columnValue: string, retry = 0): Promise<void> {
Logger.log(`Wait content is displayed ${columnName} ${columnValue} retry: ${retry}`);
const row = this.getCellElementByValue(columnName, columnValue);
try {
await BrowserVisibility.waitUntilElementIsNotVisible(row);
} catch (error) {
if (retry < 3) {
retry++;
await this.checkContentIsNotDisplayed(columnName, columnValue, retry);
} else {
throw error;
}
}
}
getRow(columnName: string, columnValue: string): ElementFinder {
return this.rootElement.all(by.xpath(`//div[starts-with(@title, '${columnName}')]//div[contains(@data-automation-id, '${columnValue}')]//ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]`)).first();
}
getRowByIndex(index: number): ElementFinder {
return this.rootElement.element(by.xpath(`//div[contains(@class,'adf-datatable-body')]//adf-datatable-row[contains(@class,'adf-datatable-row')][${index}]`));
}
async contentInPosition(position: number): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
return BrowserActions.getText(this.contents.get(position - 1));
}
getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder {
return this.rootElement.$$(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`).first();
}
async tableIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}
async waitTillContentLoaded(): Promise<void> {
if (await this.isSpinnerPresent()) {
Logger.log('wait datatable loading spinner disappear');
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
if (await this.isEmpty()) {
Logger.log('empty page');
} else {
await this.waitFirstElementPresent();
}
} else if (await this.isEmpty()) {
Logger.log('empty page');
} else {
try {
Logger.log('wait datatable loading spinner is present');
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), 2000);
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME);
} catch (error) {
}
if (await this.isEmpty()) {
Logger.log('empty page');
} else {
await this.waitFirstElementPresent();
}
}
}
async waitTillContentLoadedInfinitePagination(): Promise<void> {
await browser.sleep(500);
if (await this.isInfiniteSpinnerPresent()) {
Logger.log('wait datatable loading spinner disappear');
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-bar')));
if (await this.isEmpty()) {
Logger.log('empty page');
} else {
await this.waitFirstElementPresent();
}
} else {
try {
Logger.log('wait datatable loading spinner is present');
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-bar')));
} catch (error) {
}
if (await this.isEmpty()) {
Logger.log('empty page');
} else {
await this.waitFirstElementPresent();
}
}
}
async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_entry.${column}"]`));
}
async checkNoContentContainerIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
}
async getNumberOfColumns(): Promise<number> {
return this.allColumns.count();
}
async getNumberOfRows(): Promise<number> {
return this.list.count();
}
getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder {
return this.list.get(rowNumber).$$(`div[title="${columnName}"] span`).first();
}
getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder {
return this.getRow(rowColumn, rowContent).$(`div[title='${columnName}']`);
}
async selectRowByContent(content: string): Promise<void> {
const row = this.getCellByContent(content);
await BrowserActions.click(row);
}
async checkRowByContentIsSelected(folderName: string): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
}
async checkRowByContentIsNotSelected(folderName: string): Promise<void> {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(selectedRow);
}
getCellByContent(content: string): ElementFinder {
return this.rootElement.all(by.cssContainingText(`adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-datatable-cell']`, content)).first();
}
async checkCellByHighlightContent(content: string): Promise<void> {
const cell = this.rootElement.element(by.cssContainingText(`adf-datatable-row[class*='adf-datatable-row'] div[class*='adf-name-location-cell-name'] span.adf-highlight`, content));
await BrowserVisibility.waitUntilElementIsVisible(cell);
}
async clickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
}
async clickRowByContentCheckbox(name: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`));
await browser.actions().mouseMove(resultElement);
await BrowserActions.click(resultElement);
}
async checkRowContentIsDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async checkRowContentIsNotDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
}
async checkRowContentIsDisabled(content: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async doubleClickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async getCopyContentTooltip(): Promise<string> {
return BrowserActions.getText(this.copyColumnTooltip);
}
async copyContentTooltipIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip);
}
async mouseOverColumn(columnName: string, columnValue: string): Promise<void> {
const column = this.getCellElementByValue(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(column);
await browser.actions().mouseMove(column).perform();
}
async clickColumn(columnName: string, columnValue: string): Promise<void> {
await BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`);
}
async selectMultipleItems(names: string[]): Promise<void> {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
for (const name of names) {
await this.selectRowByContent(name);
}
await this.clearSelection();
}
async clearSelection(): Promise<void> {
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async getEmptyListText(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.rootElement.$('adf-custom-empty-content-template').getText();
}
return '';
}
async isEmpty(): Promise<boolean> {
await browser.sleep(500);
let isDisplayed;
try {
isDisplayed = await this.emptyList.isDisplayed();
} catch (error) {
isDisplayed = false;
}
Logger.log(`empty page isDisplayed ${isDisplayed}`);
return isDisplayed;
}
async waitForEmptyState(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyList);
}
async getEmptyStateTitle(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.emptyListTitle.getText();
}
return '';
}
async getEmptyStateSubtitle(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.emptyListSubtitle.getText();
}
return '';
}
private async isSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-spinner')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async isInfiniteSpinnerPresent(): Promise<boolean> {
let isSpinnerPresent;
try {
isSpinnerPresent = await this.rootElement.element(by.tagName('mat-progress-bar')).isDisplayed();
} catch (error) {
isSpinnerPresent = false;
}
return isSpinnerPresent;
}
private async waitFirstElementPresent(): Promise<void> {
try {
Logger.log('wait first element is present');
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
} catch (error) {
Logger.log('Possible empty page');
}
}
}