Prettier upgrade and e2e type checks (#1522)

* upgrade prettier

* noImplicitAny rule

* fix type

* update tsconfig

* upgrade to 150 print width
This commit is contained in:
Denys Vuika
2020-07-14 10:03:23 +01:00
committed by GitHub
parent 32793ea7b0
commit ddc6f36ab4
339 changed files with 5170 additions and 8763 deletions

View File

@@ -64,18 +64,12 @@ export class CommentsTab extends Component {
}
private async getCommentListItem() {
return browser.wait(
until.elementLocated(this.commentListItem),
BROWSER_WAIT_TIMEOUT / 2
);
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 browser.wait(until.elementLocated(by.id(`adf-comment-${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
}
return this.getCommentListItem();
}
@@ -86,9 +80,7 @@ export class CommentsTab extends Component {
async isCommentUserAvatarDisplayed(commentId?: string) {
const commentElement = await this.getCommentById(commentId);
return browser.isElementPresent(
commentElement.findElement(this.commentUserAvatar)
);
return browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
}
async getCommentText(commentId?: string) {

View File

@@ -25,11 +25,7 @@
import { by, browser, ElementFinder } from 'protractor';
import { Component } from '../component';
import {
isPresentAndEnabled,
isPresentAndDisplayed,
waitForVisibility
} from '../../utilities/utils';
import { isPresentAndEnabled, isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils';
export class ContentMetadata extends Component {
expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded');
@@ -37,20 +33,10 @@ export class ContentMetadata extends Component {
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`
);
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);
@@ -66,14 +52,14 @@ export class ContentMetadata extends Component {
async getVisiblePropertiesLabels(): Promise<string[]> {
return this.allByCss('.adf-property-label')
.filter(async elem => elem.isDisplayed())
.map(async elem => elem.getText());
.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 => {
.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;

View File

@@ -26,11 +26,7 @@
import { by, browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing';
import { Component } from '../component';
import {
waitForPresence,
waitForStaleness,
typeText
} from '../../utilities/utils';
import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils';
export class LibraryMetadata extends Component {
metadataTabContent = this.byCss('.mat-card-content');
@@ -38,21 +34,9 @@ export class LibraryMetadata extends Component {
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
);
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');
@@ -66,9 +50,7 @@ export class LibraryMetadata extends Component {
private getFieldByName(fieldName: string) {
const wrapper = this.getLabelWrapper(fieldName);
return wrapper
.element(by.xpath('..'))
.element(by.css('.mat-input-element'));
return wrapper.element(by.xpath('..')).element(by.css('.mat-input-element'));
}
private async isFieldDisplayed(fieldName: string) {
@@ -158,9 +140,7 @@ export class LibraryMetadata extends Component {
async isVisibilityEnabled() {
const wrapper = this.getLabelWrapper('Visibility');
const field = wrapper
.element(by.xpath('..'))
.element(by.css('.mat-select'));
const field = wrapper.element(by.xpath('..')).element(by.css('.mat-select'));
return field.isEnabled();
}

View File

@@ -29,11 +29,7 @@ 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';
import { waitForVisibility, waitForInvisibility, waitForPresence } from '../../utilities/utils';
export class InfoDrawer extends Component {
commentsTab = new CommentsTab('adf-info-drawer');
@@ -44,15 +40,9 @@ export class InfoDrawer extends Component {
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'
);
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);
@@ -130,10 +120,7 @@ export class InfoDrawer extends Component {
try {
await this.getTabByTitle('Comments').click();
await this.commentsTab.waitForCommentsContainer();
await Promise.all([
waitForVisibility(this.commentsTab.component),
waitForInvisibility(this.propertiesTab.component)
]);
await Promise.all([waitForVisibility(this.commentsTab.component), waitForInvisibility(this.propertiesTab.component)]);
} catch (error) {
Logger.error('--- info-drawer clickCommentsTab catch error: ', error);
}