From 57c15a7542f00bbd99ed4166359264902e9f2346 Mon Sep 17 00:00:00 2001 From: Cristina Jalba Date: Wed, 18 Mar 2020 13:41:51 +0200 Subject: [PATCH] [AAE-1772]Add CardSelectItemPage PO (#5555) * Add CardSelectItemPage PO * no message --- .../card-view/card-view-select-item.page.ts | 45 +++++++++++++++++++ .../lib/core/pages/card-view/public-api.ts | 1 + 2 files changed, 46 insertions(+) create mode 100644 lib/testing/src/lib/core/pages/card-view/card-view-select-item.page.ts diff --git a/lib/testing/src/lib/core/pages/card-view/card-view-select-item.page.ts b/lib/testing/src/lib/core/pages/card-view/card-view-select-item.page.ts new file mode 100644 index 0000000000..0b7097070e --- /dev/null +++ b/lib/testing/src/lib/core/pages/card-view/card-view-select-item.page.ts @@ -0,0 +1,45 @@ +/*! + * @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 { element, by, ElementFinder, Locator } from 'protractor'; +import { BrowserVisibility } from '../../utils/public-api'; +import { DropdownPage } from '../../../material/pages/dropdown.page'; + +export class CardSelectItemPage { + + rootElement: ElementFinder; + labelLocator: Locator = by.css('div[data-automation-id*="card-select-label"]'); + dropdown: DropdownPage; + + constructor(label: string = 'fileSource') { + this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-selectitem`)); + this.dropdown = new DropdownPage(this.rootElement.element(by.css('mat-select'))); + } + + async checkLabelIsPresent(): Promise { + const labelElement: ElementFinder = this.rootElement.element(this.labelLocator); + await BrowserVisibility.waitUntilElementIsPresent(labelElement); + } + + async getSelectedOptionText(): Promise { + return this.dropdown.getSelectedOptionText(); + } + + async selectDropdownOption(option: string): Promise { + await this.dropdown.selectDropdownOption(option); + } +} diff --git a/lib/testing/src/lib/core/pages/card-view/public-api.ts b/lib/testing/src/lib/core/pages/card-view/public-api.ts index 24b8e3eb86..aea0895523 100644 --- a/lib/testing/src/lib/core/pages/card-view/public-api.ts +++ b/lib/testing/src/lib/core/pages/card-view/public-api.ts @@ -18,3 +18,4 @@ export * from './card-view-text-item.page'; export * from './card-view-boolean-item.page'; export * from './card-view-date-item.page'; +export * from './card-view-select-item.page';