mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-3392] Create aca-testing-shared project to be reused in ADW (#1480)
* Move e2e framework to aca-shared/testing * * Update e2e suites imports from @alfresco/aca-shared/testing * Remove testing framework from 'e2e' directory * Move e2e testing framework to `aca-testing-shared` project
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './info-drawer-comments-tab';
|
||||
export * from './info-drawer-metadata-content';
|
||||
export * from './info-drawer-metadata-library';
|
||||
export * from './info-drawer';
|
@@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, browser, until } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { waitForVisibility, typeText } from '../../utilities/utils';
|
||||
|
||||
export class CommentsTab extends Component {
|
||||
commentsContainer = this.byCss('.adf-comments-container');
|
||||
commentsHeader = this.byCss('.adf-comments-header');
|
||||
commentTextarea = this.byCss('.adf-comments-input-container textarea');
|
||||
addCommentButton = this.byCss('button.adf-comments-input-add');
|
||||
commentListItem = by.css('.adf-comment-list-item');
|
||||
commentUserAvatar = by.id('comment-user-icon');
|
||||
commentUser = by.id('comment-user');
|
||||
commentText = by.id('comment-message');
|
||||
commentTime = by.id('comment-time');
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-comments', ancestor);
|
||||
}
|
||||
|
||||
async waitForCommentsContainer() {
|
||||
await waitForVisibility(this.commentsContainer);
|
||||
}
|
||||
|
||||
async getCommentsTabHeaderText(): Promise<string> {
|
||||
return this.commentsHeader.getText();
|
||||
}
|
||||
|
||||
async isCommentTextAreaDisplayed(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.commentTextarea);
|
||||
}
|
||||
|
||||
async isAddCommentButtonEnabled(): Promise<boolean> {
|
||||
const present = await browser.isElementPresent(this.addCommentButton);
|
||||
if (present) {
|
||||
return this.addCommentButton.isEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private async getCommentListItem() {
|
||||
return browser.wait(
|
||||
until.elementLocated(this.commentListItem),
|
||||
BROWSER_WAIT_TIMEOUT / 2
|
||||
);
|
||||
}
|
||||
|
||||
async getCommentById(commentId?: string) {
|
||||
if (commentId) {
|
||||
return browser.wait(
|
||||
until.elementLocated(by.id(`adf-comment-${commentId}`)),
|
||||
BROWSER_WAIT_TIMEOUT / 2
|
||||
);
|
||||
}
|
||||
return this.getCommentListItem();
|
||||
}
|
||||
|
||||
async isCommentDisplayed(commentId?: string) {
|
||||
return browser.isElementPresent(await this.getCommentById(commentId));
|
||||
}
|
||||
|
||||
async isCommentUserAvatarDisplayed(commentId?: string) {
|
||||
const commentElement = await this.getCommentById(commentId);
|
||||
return browser.isElementPresent(
|
||||
commentElement.findElement(this.commentUserAvatar)
|
||||
);
|
||||
}
|
||||
|
||||
async getCommentText(commentId?: string) {
|
||||
const commentElement = await this.getCommentById(commentId);
|
||||
const message = await commentElement.findElement(this.commentText);
|
||||
return message.getText();
|
||||
}
|
||||
|
||||
async getCommentUserName(commentId?: string): Promise<string> {
|
||||
const commentElement = await this.getCommentById(commentId);
|
||||
const user = await commentElement.findElement(this.commentUser);
|
||||
return user.getText();
|
||||
}
|
||||
|
||||
async getCommentTime(commentId?: string): Promise<string> {
|
||||
const commentElement = await this.getCommentById(commentId);
|
||||
const time = await commentElement.findElement(this.commentTime);
|
||||
return time.getText();
|
||||
}
|
||||
|
||||
async getNthCommentId(index: number): Promise<string> {
|
||||
const list = this.allByCss('.adf-comment-list-item');
|
||||
return list.get(index - 1).getAttribute('id');
|
||||
}
|
||||
|
||||
async typeComment(text: string): Promise<void> {
|
||||
await typeText(this.commentTextarea, text);
|
||||
}
|
||||
|
||||
async clickAddButton(): Promise<void> {
|
||||
await this.addCommentButton.click();
|
||||
}
|
||||
|
||||
async getCommentTextFromTextArea(): Promise<string> {
|
||||
return this.commentTextarea.getAttribute('value');
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, browser, ElementFinder } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
isPresentAndEnabled,
|
||||
isPresentAndDisplayed,
|
||||
waitForVisibility
|
||||
} from '../../utilities/utils';
|
||||
|
||||
export class ContentMetadata extends Component {
|
||||
expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded');
|
||||
propertyList = this.byCss('.adf-property-list');
|
||||
propertyListElements = this.allByCss('.adf-property');
|
||||
propertyValue = this.byCss('.adf-property-value');
|
||||
editPropertiesButton = this.byCss(`button[title='Edit']`);
|
||||
lessInfoButton = this.byCssText(
|
||||
`[data-automation-id='meta-data-card-toggle-expand']`,
|
||||
'Less information'
|
||||
);
|
||||
moreInfoButton = this.byCssText(
|
||||
`[data-automation-id='meta-data-card-toggle-expand']`,
|
||||
'More information'
|
||||
);
|
||||
imagePropertiesPanel = this.byCss(
|
||||
`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`
|
||||
);
|
||||
expandedImagePropertiesPanel = this.byCss(
|
||||
`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`
|
||||
);
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-content-metadata-card', ancestor);
|
||||
}
|
||||
|
||||
async isPropertiesListExpanded(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.expandedPanel);
|
||||
}
|
||||
|
||||
async waitForImagePropertiesPanelToExpand(): Promise<void> {
|
||||
await waitForVisibility(this.expandedImagePropertiesPanel);
|
||||
}
|
||||
|
||||
async getVisiblePropertiesLabels(): Promise<string[]> {
|
||||
return this.allByCss('.adf-property-label')
|
||||
.filter(async elem => elem.isDisplayed())
|
||||
.map(async elem => elem.getText());
|
||||
}
|
||||
|
||||
async getVisiblePropertiesValues() {
|
||||
return this.allByCss('.adf-property-value')
|
||||
.filter(async elem => elem.isDisplayed())
|
||||
.map(async elem => {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.getElementValue(elem);
|
||||
});
|
||||
}
|
||||
|
||||
async isEditPropertiesButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.editPropertiesButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.lessInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.moreInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonDisplayed(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.moreInfoButton);
|
||||
}
|
||||
|
||||
async isImagePropertiesPanelDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.imagePropertiesPanel);
|
||||
}
|
||||
|
||||
private async getElementValue(elem: ElementFinder): Promise<string> {
|
||||
const tagName = await elem.getTagName();
|
||||
|
||||
if (tagName === 'input' || tagName === 'textarea') {
|
||||
return elem.getAttribute('value');
|
||||
}
|
||||
|
||||
return elem.getText();
|
||||
}
|
||||
}
|
@@ -0,0 +1,241 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import {
|
||||
waitForPresence,
|
||||
waitForStaleness,
|
||||
typeText
|
||||
} from '../../utilities/utils';
|
||||
|
||||
export class LibraryMetadata extends Component {
|
||||
metadataTabContent = this.byCss('.mat-card-content');
|
||||
metadataTabAction = this.byCss('.mat-card-actions .mat-button');
|
||||
fieldLabelWrapper = this.byCss('.mat-form-field-label-wrapper');
|
||||
fieldInput = this.byCss('.mat-input-element');
|
||||
visibilityDropDown = this.component.element(by.css('.mat-select'));
|
||||
visibilityPublic = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Public',
|
||||
browser
|
||||
);
|
||||
visibilityPrivate = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Private',
|
||||
browser
|
||||
);
|
||||
visibilityModerated = this.byCssText(
|
||||
'.mat-option .mat-option-text',
|
||||
'Moderated',
|
||||
browser
|
||||
);
|
||||
hint = this.byCss('.mat-hint');
|
||||
error = this.byCss('.mat-error');
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('app-library-metadata-form', ancestor);
|
||||
}
|
||||
|
||||
private getLabelWrapper(label: string) {
|
||||
return this.byCssText('.mat-form-field-label-wrapper', label);
|
||||
}
|
||||
|
||||
private getFieldByName(fieldName: string) {
|
||||
const wrapper = this.getLabelWrapper(fieldName);
|
||||
return wrapper
|
||||
.element(by.xpath('..'))
|
||||
.element(by.css('.mat-input-element'));
|
||||
}
|
||||
|
||||
private async isFieldDisplayed(fieldName: string) {
|
||||
return browser.isElementPresent(this.getFieldByName(fieldName));
|
||||
}
|
||||
|
||||
private async isInputEnabled(fieldName: string) {
|
||||
return this.getFieldByName(fieldName).isEnabled();
|
||||
}
|
||||
|
||||
private async getValueOfField(fieldName: string) {
|
||||
return this.getFieldByName(fieldName).getText();
|
||||
}
|
||||
|
||||
private async enterTextInInput(fieldName: string, text: string) {
|
||||
const input = this.getFieldByName(fieldName);
|
||||
await typeText(input, text);
|
||||
}
|
||||
|
||||
private getButton(button: string) {
|
||||
return this.byCssText('.mat-card-actions .mat-button', button);
|
||||
}
|
||||
|
||||
private async isButtonDisplayed(button: string) {
|
||||
return browser.isElementPresent(this.getButton(button));
|
||||
}
|
||||
|
||||
private async isButtonEnabled(button: string) {
|
||||
return this.getButton(button).isEnabled();
|
||||
}
|
||||
|
||||
private async clickButton(button: string) {
|
||||
await this.getButton(button).click();
|
||||
}
|
||||
|
||||
async waitForVisibilityDropDownToClose() {
|
||||
await waitForStaleness(browser.$('.mat-option .mat-option-text'));
|
||||
}
|
||||
|
||||
async isMessageDisplayed() {
|
||||
return browser.isElementPresent(this.hint);
|
||||
}
|
||||
|
||||
async getMessage() {
|
||||
return this.hint.getText();
|
||||
}
|
||||
|
||||
async isErrorDisplayed() {
|
||||
return browser.isElementPresent(this.error);
|
||||
}
|
||||
|
||||
async getError() {
|
||||
return this.error.getText();
|
||||
}
|
||||
|
||||
async isNameDisplayed() {
|
||||
return this.isFieldDisplayed('Name');
|
||||
}
|
||||
|
||||
async isNameEnabled() {
|
||||
return this.isInputEnabled('Name');
|
||||
}
|
||||
|
||||
async getName(): Promise<string> {
|
||||
return this.getValueOfField('Name');
|
||||
}
|
||||
|
||||
async enterName(name: string): Promise<void> {
|
||||
await this.enterTextInInput('Name', name);
|
||||
}
|
||||
|
||||
async isDescriptionDisplayed() {
|
||||
return this.isFieldDisplayed('Description');
|
||||
}
|
||||
|
||||
async isDescriptionEnabled() {
|
||||
return this.isInputEnabled('Description');
|
||||
}
|
||||
|
||||
async getDescription(): Promise<string> {
|
||||
return this.getValueOfField('Description');
|
||||
}
|
||||
|
||||
async enterDescription(desc: string) {
|
||||
await this.enterTextInInput('Description', desc);
|
||||
}
|
||||
|
||||
async isVisibilityEnabled() {
|
||||
const wrapper = this.getLabelWrapper('Visibility');
|
||||
const field = wrapper
|
||||
.element(by.xpath('..'))
|
||||
.element(by.css('.mat-select'));
|
||||
return field.isEnabled();
|
||||
}
|
||||
|
||||
async isVisibilityDisplayed() {
|
||||
return this.isFieldDisplayed('Visibility');
|
||||
}
|
||||
|
||||
async getVisibility(): Promise<string> {
|
||||
return this.getValueOfField('Visibility');
|
||||
}
|
||||
|
||||
async setVisibility(visibility: string) {
|
||||
const val = visibility.toLowerCase();
|
||||
|
||||
await this.visibilityDropDown.click();
|
||||
await waitForPresence(this.visibilityDropDown);
|
||||
|
||||
if (val === 'public') {
|
||||
await this.visibilityPublic.click();
|
||||
} else if (val === 'private') {
|
||||
await this.visibilityPrivate.click();
|
||||
} else if (val === 'moderated') {
|
||||
await this.visibilityModerated.click();
|
||||
} else {
|
||||
Logger.error('----- invalid visibility', val);
|
||||
}
|
||||
|
||||
await this.waitForVisibilityDropDownToClose();
|
||||
}
|
||||
|
||||
async isLibraryIdDisplayed() {
|
||||
return this.isFieldDisplayed('Library ID');
|
||||
}
|
||||
|
||||
async isLibraryIdEnabled() {
|
||||
return this.isInputEnabled('Library ID');
|
||||
}
|
||||
|
||||
async getLibraryId() {
|
||||
return this.getValueOfField('Library ID');
|
||||
}
|
||||
|
||||
async isEditLibraryPropertiesEnabled() {
|
||||
return this.isButtonEnabled('Edit');
|
||||
}
|
||||
|
||||
async isEditLibraryPropertiesDisplayed() {
|
||||
return this.isButtonDisplayed('Edit');
|
||||
}
|
||||
|
||||
async clickEditLibraryProperties() {
|
||||
await this.clickButton('Edit');
|
||||
}
|
||||
|
||||
async isUpdateEnabled() {
|
||||
return this.isButtonEnabled('Update');
|
||||
}
|
||||
|
||||
async isUpdateDisplayed() {
|
||||
return this.isButtonDisplayed('Update');
|
||||
}
|
||||
|
||||
async clickUpdate() {
|
||||
await this.clickButton('Update');
|
||||
}
|
||||
|
||||
async isCancelEnabled() {
|
||||
return this.isButtonEnabled('Cancel');
|
||||
}
|
||||
|
||||
async isCancelDisplayed() {
|
||||
return this.isButtonDisplayed('Cancel');
|
||||
}
|
||||
|
||||
async clickCancel() {
|
||||
await this.clickButton('Cancel');
|
||||
}
|
||||
}
|
141
projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts
Executable file
141
projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts
Executable file
@@ -0,0 +1,141 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import { CommentsTab } from './info-drawer-comments-tab';
|
||||
import { LibraryMetadata } from './info-drawer-metadata-library';
|
||||
import { ContentMetadata } from './info-drawer-metadata-content';
|
||||
import {
|
||||
waitForVisibility,
|
||||
waitForInvisibility,
|
||||
waitForPresence
|
||||
} from '../../utilities/utils';
|
||||
|
||||
export class InfoDrawer extends Component {
|
||||
commentsTab = new CommentsTab('adf-info-drawer');
|
||||
aboutTab = new LibraryMetadata('adf-info-drawer');
|
||||
propertiesTab = new ContentMetadata('adf-info-drawer');
|
||||
header = this.byCss('.adf-info-drawer-layout-header');
|
||||
headerTitle = this.byCss('.adf-info-drawer-layout-header-title');
|
||||
tabLabel = this.byCss('.mat-tab-label-content');
|
||||
tabLabelsList = this.allByCss('.mat-tab-label-content');
|
||||
tabActiveLabel = this.byCss('.mat-tab-label-active');
|
||||
tabActiveContent = this.byCss(
|
||||
'.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab'
|
||||
);
|
||||
nextButton = this.byCss(
|
||||
'.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron'
|
||||
);
|
||||
previousButton = this.byCss(
|
||||
'.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
|
||||
);
|
||||
|
||||
constructor(ancestor?: string) {
|
||||
super('adf-info-drawer', ancestor);
|
||||
}
|
||||
|
||||
async waitForInfoDrawerToOpen() {
|
||||
await waitForPresence(this.header);
|
||||
}
|
||||
|
||||
async isOpen() {
|
||||
return browser.isElementPresent(this.header);
|
||||
}
|
||||
|
||||
async isEmpty() {
|
||||
return !(await browser.isElementPresent(by.css('.adf-info-drawer-tabs')));
|
||||
}
|
||||
|
||||
getTabByTitle(title: string) {
|
||||
return this.byCssText('.mat-tab-label-content', title);
|
||||
}
|
||||
|
||||
async getTabsCount(): Promise<number> {
|
||||
return this.allByCss('.mat-tab-label-content').count();
|
||||
}
|
||||
|
||||
async isTabPresent(title: string) {
|
||||
return this.getTabByTitle(title).isPresent();
|
||||
}
|
||||
|
||||
async isTabDisplayed(title: string): Promise<boolean> {
|
||||
if (await browser.isElementPresent(this.getTabByTitle(title))) {
|
||||
return this.getTabByTitle(title).isDisplayed();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async getTabTitle(index: number): Promise<string> {
|
||||
return this.tabLabelsList.get(index - 1).getAttribute('innerText');
|
||||
}
|
||||
|
||||
async getActiveTabTitle(): Promise<string> {
|
||||
return this.tabActiveLabel.getText();
|
||||
}
|
||||
|
||||
async clickTab(title: string) {
|
||||
await this.getTabByTitle(title).click();
|
||||
}
|
||||
|
||||
async getComponentIdOfTab(): Promise<string> {
|
||||
return this.tabActiveContent.getAttribute('data-automation-id');
|
||||
}
|
||||
|
||||
async getHeaderTitle(): Promise<string> {
|
||||
return this.headerTitle.getText();
|
||||
}
|
||||
|
||||
async isAboutTabDisplayed() {
|
||||
return this.isTabDisplayed('About');
|
||||
}
|
||||
|
||||
async isPropertiesTabDisplayed() {
|
||||
return this.isTabDisplayed('Properties');
|
||||
}
|
||||
|
||||
async isPropertiesTabActive() {
|
||||
return (await this.getActiveTabTitle()) === 'PROPERTIES';
|
||||
}
|
||||
|
||||
async isCommentsTabDisplayed() {
|
||||
return this.isTabDisplayed('Comments');
|
||||
}
|
||||
|
||||
async clickCommentsTab() {
|
||||
try {
|
||||
await this.getTabByTitle('Comments').click();
|
||||
await this.commentsTab.waitForCommentsContainer();
|
||||
await Promise.all([
|
||||
waitForVisibility(this.commentsTab.component),
|
||||
waitForInvisibility(this.propertiesTab.component)
|
||||
]);
|
||||
} catch (error) {
|
||||
Logger.error('--- info-drawer clickCommentsTab catch error: ', error);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user