ACS-8614: Remove old search layout protractor e2e (#10104)

This commit is contained in:
Denys Vuika
2024-08-20 08:36:36 -04:00
committed by GitHub
parent 4807f10827
commit 04e2b16f66
22 changed files with 0 additions and 3735 deletions

View File

@@ -17,4 +17,3 @@
export * from './document-list.page';
export * from './breadcrumb/public-api';
export * from './search/public-api';

View File

@@ -1,133 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ElementFinder, protractor } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class NumberRangeFilterPage {
fromInput = '[data-automation-id="number-range-from-input"]';
toInput = '[data-automation-id="number-range-to-input"]';
applyButton = '[data-automation-id="number-range-btn-apply"]';
clearButton = '[data-automation-id="number-range-btn-clear"]';
fromErrorInvalid = '[data-automation-id="number-range-from-error-invalid"]';
fromErrorRequired = '[data-automation-id="number-range-from-error-required"]';
toErrorInvalid = '[data-automation-id="number-range-to-error-invalid"]';
toErrorRequired = '[data-automation-id="number-range-to-error-required"]';
filter: ElementFinder;
constructor(filter: ElementFinder) {
this.filter = filter;
}
async clearFromField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.fromInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.fromInput));
}
async getFromNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.$(this.fromInput));
}
async putFromNumber(value): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.$(this.fromInput), value);
await this.filter.$(this.fromInput).sendKeys(protractor.Key.ENTER);
}
async getFromErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.fromErrorRequired));
}
async checkFromErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorRequired));
}
async getFromErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.fromErrorInvalid));
}
async checkFromErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorInvalid));
}
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromInput));
}
async clearToField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.toInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.toInput));
}
async getToNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.$(this.toInput));
}
async putToNumber(value): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.$(this.toInput), value);
await this.filter.$(this.toInput).sendKeys(protractor.Key.ENTER);
}
async getToErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.toErrorRequired));
}
async checkToErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorRequired));
}
async getToErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.$(this.toErrorInvalid));
}
async checkToErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorInvalid));
}
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toInput));
}
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.applyButton));
}
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton));
}
async checkApplyButtonIsEnabled(): Promise<boolean> {
return this.filter.$(this.applyButton).isEnabled();
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkNoErrorMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorRequired));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorRequired));
}
}

View File

@@ -1,24 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export * from './search-categories.page';
export * from './number-range-filter.page';
export * from './search-check-list.page';
export * from './search-radio.page';
export * from './search-slider.page';
export * from './search-sorting-picker.page';
export * from './search-text.page';

View File

@@ -1,70 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ElementFinder } from 'protractor';
import { SearchTextPage } from './search-text.page';
import { SearchCheckListPage } from './search-check-list.page';
import { SearchRadioPage } from './search-radio.page';
import { NumberRangeFilterPage } from './number-range-filter.page';
import { SearchSliderPage } from './search-slider.page';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCategoriesPage {
static checkListFiltersPage(filter: ElementFinder): SearchCheckListPage {
return new SearchCheckListPage(filter);
}
static textFiltersPage(filter: ElementFinder): SearchTextPage {
return new SearchTextPage(filter);
}
static radioFiltersPage(filter: ElementFinder): SearchRadioPage {
return new SearchRadioPage(filter);
}
static numberRangeFilter(filter: ElementFinder): NumberRangeFilterPage {
return new NumberRangeFilterPage(filter);
}
static sliderFilter(filter: ElementFinder): SearchSliderPage {
return new SearchSliderPage(filter);
}
async checkFilterIsDisplayed(filter: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(filter);
}
async clickFilter(filter: ElementFinder): Promise<void> {
await BrowserActions.click(filter.$(' .mat-expansion-panel-header'));
}
async clickFilterHeader(filter: ElementFinder): Promise<void> {
const fileSizeFilterHeader = filter.$(' .mat-expansion-panel-header');
await BrowserActions.click(fileSizeFilterHeader);
}
async checkFilterIsCollapsed(filter: ElementFinder) {
const elementClass = await BrowserActions.getAttribute(filter, 'class');
expect(elementClass).not.toContain('mat-expanded');
}
async checkFilterIsExpanded(filter: ElementFinder) {
const elementClass = await BrowserActions.getAttribute(filter, 'class');
expect(elementClass).toContain('mat-expanded');
}
}

View File

@@ -1,175 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { element, by, ElementFinder, browser, protractor, By } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCheckListPage {
filter: ElementFinder;
inputBy = 'div[class*="mat-expansion-panel-content"] input';
showMoreBy = 'button[title="Show more"]';
showLessBy = 'button[title="Show less"]';
clearAllButton = 'button';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async clickCheckListOption(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='${option}'] input`);
await BrowserActions.click(result);
}
async checkChipIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip-row', option)).$('mat-icon'));
}
async checkChipIsNotDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip-row', option)).$('mat-icon'));
}
async removeFilterOption(option: string): Promise<void> {
const cancelChipButton = element(by.cssContainingText('mat-chip-row', option)).$('mat-icon');
await BrowserActions.click(cancelChipButton);
}
async filterBy(option: string): Promise<SearchCheckListPage> {
await this.checkSearchFilterInputIsDisplayed();
await this.searchInFilter(option);
await this.clickCheckListOption(option);
return this;
}
async enterFilterInputValue(option: string): Promise<SearchCheckListPage> {
await this.checkSearchFilterInputIsDisplayed();
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.$$(this.inputBy).first();
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
await inputElement.sendKeys(protractor.Key.ENTER);
return this;
}
async checkSearchFilterInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$$(this.inputBy).first());
}
async searchInFilter(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.$$(this.inputBy).first();
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showLessBy));
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showLessBy));
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showMoreBy));
}
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showMoreBy));
}
async clickShowMoreButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.$(this.showMoreBy));
if (visible) {
await BrowserActions.click(this.filter.$(this.showMoreBy));
await this.clickShowMoreButtonUntilIsNotDisplayed();
}
}
async clickShowLessButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.$(this.showLessBy));
if (visible) {
await BrowserActions.click(this.filter.$(this.showLessBy));
await this.clickShowLessButtonUntilIsNotDisplayed();
}
}
async getBucketNumberOfFilterType(option: string): Promise<any> {
const fileTypeFilter = this.filter.$$('mat-checkbox[data-automation-id*=".' + option + '"] div').first();
await BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const valueOfBucket = await BrowserActions.getText(fileTypeFilter);
const numberOfBucket = valueOfBucket.split('(')[1];
const totalNumberOfBucket = numberOfBucket.split(')')[0];
return totalNumberOfBucket.trim();
}
async checkCheckListOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkCheckListAutocompleteOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = element(By.css(`mat-option[data-automation-id='option-${option}']`));
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkCheckListOptionIsNotSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsNotVisible(result);
}
async checkCheckListOptionIsSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkClearAllButtonIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(this.clearAllButton);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async clickClearAllButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.$(this.clearAllButton);
await BrowserActions.click(result);
}
async getCheckListOptionsNumberOnPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const checkListOptions = this.filter.$$('.checklist mat-checkbox');
return checkListOptions.count();
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.showMoreBy));
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.showLessBy));
}
}

View File

@@ -1,75 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, ElementFinder, $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchRadioPage {
filter: ElementFinder;
showMoreButton = $('adf-search-radio button[title="Show more"]');
showLessButton = $('adf-search-radio button[title="Show less"]');
constructor(filter: ElementFinder) {
this.filter = filter;
}
async checkFilterRadioButtonIsDisplayed(filterName: string): Promise<void> {
const filterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(filterType);
}
async checkFilterRadioButtonIsChecked(filterName: string): Promise<void> {
const selectedFilterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"][class*="checked"]`);
await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
async clickFilterRadioButton(filterName: string): Promise<void> {
await browser.executeScript(`document.querySelector('[data-automation-id="search-radio-${filterName}"] input').click();`);
}
async getRadioButtonsNumberOnPage(): Promise<number> {
const radioButtons = $$('mat-radio-button');
return radioButtons.count();
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showMoreButton);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.showMoreButton);
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.showLessButton);
}
}

View File

@@ -1,79 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchSliderPage {
filter: ElementFinder;
slider = 'mat-slider[data-automation-id="slider-range"]';
clearButton = 'button[data-automation-id="slider-btn-clear"]';
sliderWithThumbLabel = 'mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async getMaxValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'max');
}
async getMinValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'min');
}
async getValue() {
return BrowserActions.getAttribute(this.filter.$(this.slider).$('input'), 'aria-valuetext');
}
async setValue(value: number): Promise<void> {
const elem = this.filter.$(this.slider).$('.mdc-slider__thumb-knob');
await BrowserVisibility.waitUntilElementIsVisible(elem);
await browser.actions().mouseMove(elem, { x: 0, y: 0 }).perform();
await browser.actions().mouseDown().mouseMove({x: value * 7, y: 0}).mouseUp().perform();
}
async checkSliderIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.slider));
}
async checkSliderIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.slider));
}
async checkSliderWithThumbLabelIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.sliderWithThumbLabel));
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsEnabled() {
return this.filter.$(this.clearButton).isEnabled();
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkClearButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.clearButton));
}
}

View File

@@ -1,91 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class SearchSortingPickerPage {
sortingDropdown = new DropdownPage($('.adf-sorting-picker .mat-mdc-select-arrow'));
orderArrow = $('adf-sorting-picker button mat-icon');
async sortBy(sortOrder: string, sortType: string | RegExp): Promise<void> {
await this.sortingDropdown.clickDropdown();
const selectedSortingOption = element(by.cssContainingText('.mdc-list-item__primary-text', sortType));
await BrowserActions.click(selectedSortingOption);
await this.sortByOrder(sortOrder);
}
/**
* Sort the list by name column.
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
async sortByOrder(sortOrder: string): Promise<any> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (result !== 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
} else {
if (result === 'arrow_upward') {
await browser.executeScript(`document.querySelector('adf-sorting-picker button mat-icon').click();`);
}
}
}
async clickSortingOption(option: string): Promise<void> {
const selectedSortingOption = element(by.cssContainingText('.mdc-list-item__primary-text', option));
await BrowserActions.click(selectedSortingOption);
}
async checkOptionIsDisplayed(option: string): Promise<void> {
await this.sortingDropdown.checkOptionIsDisplayed(option);
}
async checkOptionIsNotDisplayed(option: string): Promise<void> {
await this.sortingDropdown.checkOptionIsNotDisplayed(option);
}
async checkOptionsDropdownIsDisplayed(): Promise<void> {
await this.sortingDropdown.checkOptionsPanelIsDisplayed();
}
async checkSortingDropdownIsDisplayed(): Promise<void> {
await this.sortingDropdown.checkDropdownIsVisible();
}
async clickSortingDropdown(): Promise<void> {
await this.sortingDropdown.clickDropdown();
}
async checkOrderArrowIsDownward(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
const result = await BrowserActions.getText(this.orderArrow);
return result !== 'arrow_upward';
}
async checkOrderArrowIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.orderArrow);
}
}

View File

@@ -1,36 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { protractor, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchTextPage {
filter: ElementFinder;
inputBy = 'input';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async searchByName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserActions.clearSendKeys(this.filter.$(this.inputBy), name);
await this.filter.$(this.inputBy).sendKeys(protractor.Key.ENTER);
}
}

View File

@@ -16,85 +16,9 @@
*/
import { browser, ElementFinder } from 'protractor';
import * as path from 'path';
import * as fs from 'fs';
import { BrowserActions } from '../utils/browser-actions';
const JS_BIND_INPUT = (target) => {
const input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
const x = rect.left + (rect.width >> 1);
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
const JS_BIND_INPUT_FOLDER = (target) => {
const input: any = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.multiple = true;
input.webkitdirectory = true;
input.addEventListener('change', () => {
target.scrollIntoView(true);
const rect = target.getBoundingClientRect();
const x = rect.left + (rect.width >> 1);
const y = rect.top + (rect.height >> 1);
const data = { files: input.files };
['dragenter', 'dragover', 'drop'].forEach((name) => {
const mouseEvent: any = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(name, !0, !0, window, 0, 0, 0, x, y, !1, !1, !1, !1, 0, null);
mouseEvent.dataTransfer = data;
target.dispatchEvent(mouseEvent);
});
document.body.removeChild(input);
}, false);
document.body.appendChild(input);
return input;
};
export class DropActions {
static async dropFile(dropArea, filePath) {
const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, filePath));
fs.accessSync(absolutePath, fs.constants.F_OK);
const elem = await dropArea.getWebElement();
const input: any = await browser.executeScript(JS_BIND_INPUT, elem);
return input.sendKeys(absolutePath);
}
static async dropFolder(dropArea, folderPath) {
const absolutePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, folderPath));
fs.accessSync(absolutePath, fs.constants.F_OK);
const elem = await dropArea.getWebElement();
const input: any = await browser.executeScript(JS_BIND_INPUT_FOLDER, elem);
return input.sendKeys(absolutePath);
}
static async dragAndDrop(elementToDrag: ElementFinder, locationToDragTo: ElementFinder, locationOffset = { x: 230, y: 280 }) {
await BrowserActions.click(elementToDrag);
await browser.actions().mouseDown(elementToDrag).mouseMove(locationToDragTo, locationOffset).mouseUp().perform();