mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1884] e2e shared file and refactor custom sources (#5506)
* fix lint e2e shared file and refactor custom sources additional tests for search chip list (#5523) * modify wait startegy * fix metadata problem * improve method retry * login before to execute call * login before to execute call
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<adf-toolbar>
|
||||
<adf-toolbar-title>
|
||||
<mat-form-field>
|
||||
<mat-select [(ngModel)]="selectedSource">
|
||||
<mat-select [(ngModel)]="selectedSource" data-automation-id="custom-sources-select">
|
||||
<mat-option *ngFor="let source of sources" [value]="source.value">
|
||||
{{ source.title }}
|
||||
</mat-option>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { LoginPage, BrowserActions, StringUtil } from '@alfresco/adf-testing';
|
||||
import { ContentServicesPage } from '../../pages/adf/content-services.page';
|
||||
import { CreateLibraryDialogPage } from '../../pages/adf/dialog/create-library-dialog.page';
|
||||
import { CustomSources } from '../../pages/adf/demo-shell/custom-sources.page';
|
||||
import { CustomSourcesPage } from '../../pages/adf/demo-shell/custom-sources.page';
|
||||
import { AcsUserModel } from '../../models/ACS/acs-user.model';
|
||||
import { browser } from 'protractor';
|
||||
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
@@ -29,7 +29,7 @@ describe('Create library directive', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const contentServicesPage = new ContentServicesPage();
|
||||
const createLibraryDialog = new CreateLibraryDialogPage();
|
||||
const customSourcesPage = new CustomSources();
|
||||
const customSourcesPage = new CustomSourcesPage();
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
|
||||
const visibility = {
|
||||
|
@@ -23,7 +23,7 @@ import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
import { browser } from 'protractor';
|
||||
import { FileModel } from '../../models/ACS/file.model';
|
||||
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||
import { CustomSources } from '../../pages/adf/demo-shell/custom-sources.page';
|
||||
import { CustomSourcesPage } from '../../pages/adf/demo-shell/custom-sources.page';
|
||||
import { TrashcanPage } from '../../pages/adf/trashcan.page';
|
||||
|
||||
describe('Favorite directive', () => {
|
||||
@@ -32,7 +32,7 @@ describe('Favorite directive', () => {
|
||||
const contentServicesPage = new ContentServicesPage();
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
const acsUser = new AcsUserModel();
|
||||
const customSourcesPage = new CustomSources();
|
||||
const customSourcesPage = new CustomSourcesPage();
|
||||
const trashcanPage = new TrashcanPage();
|
||||
const contentListPage = contentServicesPage.getDocumentList();
|
||||
const contentNodeSelector = new ContentNodeSelectorDialogPage();
|
||||
|
@@ -21,7 +21,7 @@ import {
|
||||
LocalStorageUtil,
|
||||
NotificationHistoryPage,
|
||||
UploadActions,
|
||||
ViewerPage
|
||||
ViewerPage, ApiUtil
|
||||
} from '@alfresco/adf-testing';
|
||||
import { ContentServicesPage } from '../../pages/adf/content-services.page';
|
||||
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||
@@ -29,7 +29,8 @@ import { ShareDialogPage } from '../../pages/adf/dialog/share-dialog.page';
|
||||
import { AcsUserModel } from '../../models/ACS/acs-user.model';
|
||||
import { FileModel } from '../../models/ACS/file.model';
|
||||
import { browser } from 'protractor';
|
||||
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiCompatibility as AlfrescoApi, SharedLinkEntry, SharedLinkPaging } from '@alfresco/js-api';
|
||||
import { CustomSourcesPage } from '../../pages/adf/demo-shell/custom-sources.page';
|
||||
|
||||
describe('Share file', () => {
|
||||
|
||||
@@ -42,6 +43,7 @@ describe('Share file', () => {
|
||||
const contentListPage = contentServicesPage.getDocumentList();
|
||||
const shareDialog = new ShareDialogPage();
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
const customSourcesPage = new CustomSourcesPage();
|
||||
const viewerPage = new ViewerPage();
|
||||
const notificationHistoryPage = new NotificationHistoryPage();
|
||||
const acsUser = new AcsUserModel();
|
||||
@@ -53,6 +55,23 @@ describe('Share file', () => {
|
||||
|
||||
let nodeId;
|
||||
|
||||
const waitForShareLink = async (nodeIdSharedFile: string) => {
|
||||
const predicate = (sharedLinkPaging: SharedLinkPaging) => {
|
||||
const sharedLink = sharedLinkPaging.list.entries.find((sharedLinkEntry: SharedLinkEntry) => {
|
||||
return sharedLinkEntry.entry.nodeId === nodeIdSharedFile;
|
||||
});
|
||||
|
||||
return sharedLink !== null;
|
||||
};
|
||||
|
||||
const apiCall = async () => {
|
||||
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||
return this.alfrescoJsApi.core.sharedlinksApi.findSharedLinks();
|
||||
};
|
||||
|
||||
return ApiUtil.waitForApi(apiCall, predicate, 10, 2000);
|
||||
};
|
||||
|
||||
beforeAll(async () => {
|
||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||
@@ -199,5 +218,20 @@ describe('Share file', () => {
|
||||
await BrowserActions.getUrl(sharedLink);
|
||||
await viewerPage.checkFileNameIsDisplayed(pngFileModel.name);
|
||||
});
|
||||
|
||||
it('[C260153] Should shared files listed in share files custom resources', async () => {
|
||||
await contentListPage.selectRow(pngFileModel.name);
|
||||
await contentServicesPage.clickShareButton();
|
||||
await shareDialog.checkDialogIsDisplayed();
|
||||
await shareDialog.clickShareLinkButton();
|
||||
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
|
||||
await waitForShareLink(nodeId);
|
||||
|
||||
await customSourcesPage.navigateToCustomSources();
|
||||
await customSourcesPage.selectSharedLinksSourceType();
|
||||
await customSourcesPage.checkRowIsDisplayed(pngFileModel.name);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -612,7 +612,7 @@ export class ContentServicesPage {
|
||||
}
|
||||
|
||||
async selectGridSortingFromDropdown(sortingOption): Promise<void> {
|
||||
await this.sortingDropdown.clickDropdownWithOption(sortingOption);
|
||||
await this.sortingDropdown.selectDropdownOption(sortingOption);
|
||||
}
|
||||
|
||||
async checkRowIsDisplayed(rowName): Promise<void> {
|
||||
@@ -630,7 +630,7 @@ export class ContentServicesPage {
|
||||
}
|
||||
|
||||
async selectSite(siteName: string): Promise<void> {
|
||||
await this.siteListDropdown.clickDropdownWithOption(siteName);
|
||||
await this.siteListDropdown.selectDropdownOption(siteName);
|
||||
}
|
||||
|
||||
async clickDownloadButton(): Promise<void> {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing';
|
||||
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
|
||||
import { by, element, ElementFinder } from 'protractor';
|
||||
import { NavigationBarPage } from '../navigation-bar.page';
|
||||
|
||||
@@ -35,17 +35,12 @@ const column = {
|
||||
status: 'Status'
|
||||
};
|
||||
|
||||
export class CustomSources {
|
||||
|
||||
export class CustomSourcesPage {
|
||||
dataTable: DataTableComponentPage = new DataTableComponentPage();
|
||||
navigationBarPage: NavigationBarPage = new NavigationBarPage();
|
||||
|
||||
toolbar: ElementFinder = element(by.css('app-custom-sources .adf-toolbar-title'));
|
||||
sourceTypeDropdown: ElementFinder = element(by.css('div[class*="select-arrow"]>div'));
|
||||
|
||||
getSourceType(option): ElementFinder {
|
||||
return element(by.cssContainingText('.cdk-overlay-pane span', `${option}`));
|
||||
}
|
||||
selectModeDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="custom-sources-select"]')));
|
||||
|
||||
async waitForToolbarToBeVisible(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
|
||||
@@ -56,18 +51,16 @@ export class CustomSources {
|
||||
await this.waitForToolbarToBeVisible();
|
||||
}
|
||||
|
||||
async clickOnSourceType(): Promise<void> {
|
||||
await BrowserActions.click(this.sourceTypeDropdown);
|
||||
}
|
||||
|
||||
async selectMySitesSourceType(): Promise<void> {
|
||||
await this.clickOnSourceType();
|
||||
await BrowserActions.click(this.getSourceType(source.mySites));
|
||||
await this.selectModeDropdown.selectDropdownOption(source.mySites);
|
||||
}
|
||||
|
||||
async selectFavoritesSourceType(): Promise<void> {
|
||||
await this.clickOnSourceType();
|
||||
await BrowserActions.click(this.getSourceType(source.favorites));
|
||||
await this.selectModeDropdown.selectDropdownOption(source.favorites);
|
||||
}
|
||||
|
||||
async selectSharedLinksSourceType(): Promise<void> {
|
||||
await this.selectModeDropdown.selectDropdownOption(source.sharedLinks);
|
||||
}
|
||||
|
||||
checkRowIsDisplayed(rowName): Promise<void> {
|
||||
|
@@ -129,7 +129,7 @@ export class DataTablePage {
|
||||
}
|
||||
|
||||
async selectSelectionMode(selectionMode): Promise<void> {
|
||||
await this.selectModeDropdown.clickDropdownWithOption(selectionMode);
|
||||
await this.selectModeDropdown.selectDropdownOption(selectionMode);
|
||||
}
|
||||
|
||||
getRowCheckbox(rowNumber: string): ElementFinder {
|
||||
|
@@ -36,11 +36,11 @@ export class ProcessListDemoPage {
|
||||
}
|
||||
|
||||
async selectSorting(sortingOption: string): Promise<void> {
|
||||
await this.sortDropdown.clickDropdownWithOption(sortingOption);
|
||||
await this.sortDropdown.selectDropdownOption(sortingOption);
|
||||
}
|
||||
|
||||
async selectStateFilter(stateOption: string): Promise<void> {
|
||||
await this.stateDropdown.clickDropdownWithOption(stateOption);
|
||||
await this.stateDropdown.selectDropdownOption(stateOption);
|
||||
}
|
||||
|
||||
async addAppId(appId): Promise<void> {
|
||||
|
@@ -139,7 +139,7 @@ export class TaskListDemoPage {
|
||||
}
|
||||
|
||||
async selectState(state): Promise<void> {
|
||||
await this.stateDropdown.clickDropdownWithOption(state);
|
||||
await this.stateDropdown.selectDropdownOption(state);
|
||||
}
|
||||
|
||||
getAllProcessDefinitionIds(): Promise<any> {
|
||||
|
@@ -66,15 +66,15 @@ export class NotificationPage {
|
||||
}
|
||||
|
||||
async selectHorizontalPosition(selectItem): Promise<void> {
|
||||
await this.horizontalPositionDropdown.clickDropdownWithOption(selectItem);
|
||||
await this.horizontalPositionDropdown.selectDropdownOption(selectItem);
|
||||
}
|
||||
|
||||
async selectVerticalPosition(selectItem): Promise<void> {
|
||||
await this.verticalPositionDropdown.clickDropdownWithOption(selectItem);
|
||||
await this.verticalPositionDropdown.selectDropdownOption(selectItem);
|
||||
}
|
||||
|
||||
async selectDirection(selectItem): Promise<void> {
|
||||
await this.directionDropdown.clickDropdownWithOption(selectItem);
|
||||
await this.directionDropdown.selectDropdownOption(selectItem);
|
||||
}
|
||||
|
||||
async clickNotificationButton(): Promise<void> {
|
||||
|
@@ -58,7 +58,7 @@ export class AttachFormPage {
|
||||
}
|
||||
|
||||
async selectAttachFormOption(option): Promise<void> {
|
||||
await this.attachFormDropdown.clickDropdownWithOption(option);
|
||||
await this.attachFormDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async clickCancelButton(): Promise<void> {
|
||||
|
@@ -63,7 +63,7 @@ export class StartTaskDialogPage {
|
||||
}
|
||||
|
||||
async selectForm(form): Promise<void> {
|
||||
await this.selectFormDropdown.clickDropdownWithOption(form);
|
||||
await this.selectFormDropdown.selectDropdownOption(form);
|
||||
}
|
||||
|
||||
async clickStartButton(): Promise<void> {
|
||||
|
@@ -113,7 +113,7 @@ export class TaskDetailsPage {
|
||||
}
|
||||
|
||||
async selectAttachFormOption(option): Promise<void> {
|
||||
await this.attachFormDropdown.clickDropdownWithOption(option);
|
||||
await this.attachFormDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async checkCancelAttachFormIsDisplayed(): Promise<void> {
|
||||
|
@@ -125,7 +125,7 @@ export class FormFields {
|
||||
}
|
||||
|
||||
async selectForm(formName): Promise<void> {
|
||||
await this.selectFormDropdown.clickDropdownWithOption(formName);
|
||||
await this.selectFormDropdown.selectDropdownOption(formName);
|
||||
}
|
||||
|
||||
async selectFormFromDropDown(formName): Promise<void> {
|
||||
|
@@ -47,7 +47,7 @@ export class SettingsPage {
|
||||
}
|
||||
|
||||
async setProvider(option): Promise<void> {
|
||||
await this.providerDropdown.clickDropdownWithOption(option);
|
||||
await this.providerDropdown.selectDropdownOption(option);
|
||||
await this.providerDropdown.checkOptionIsSelected(option);
|
||||
}
|
||||
|
||||
|
52
lib/testing/src/lib/core/structure/api.util.ts
Normal file
52
lib/testing/src/lib/core/structure/api.util.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2005-2019 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
export type ApiResultPredicate<T> = (result: T) => boolean;
|
||||
export type ApiCall<T> = () => Promise<T>;
|
||||
|
||||
export class ApiUtil {
|
||||
static async waitForApi<T>(apiCall: ApiCall<T>, predicate: ApiResultPredicate<T>, retry: number = 30, delay: number = 1000) {
|
||||
const apiCallWithPredicateChecking = async () => {
|
||||
const apiCallResult = await apiCall();
|
||||
if (predicate(apiCallResult)) {
|
||||
return Promise.resolve(apiCallResult);
|
||||
} else {
|
||||
return Promise.reject(apiCallResult);
|
||||
}
|
||||
};
|
||||
|
||||
return ApiUtil.retryCall(apiCallWithPredicateChecking, retry, delay);
|
||||
}
|
||||
|
||||
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
|
||||
const pause = duration => new Promise(res => setTimeout(res, duration));
|
||||
|
||||
const run = retries => {
|
||||
return fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
|
||||
};
|
||||
|
||||
return run(retry);
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
import { browser } from 'protractor';
|
||||
import { ModelingAPI } from './modeling-api';
|
||||
import { NodeEntry, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { UtilApi } from './utilapi';
|
||||
import { ApiUtil } from './api.util';
|
||||
import { E2eRequestApiHelper, E2eRequestApiHelperOptions } from './e2e-request-api.helper';
|
||||
import * as fs from 'fs';
|
||||
import { StringUtil } from '../utils/string.util';
|
||||
@@ -123,7 +123,7 @@ export class Project {
|
||||
};
|
||||
const apiCall = () => this.searchProjects();
|
||||
|
||||
return UtilApi.waitForApi(apiCall, predicate);
|
||||
return ApiUtil.waitForApi(apiCall, predicate);
|
||||
}
|
||||
|
||||
private getRandomName(): string {
|
||||
|
@@ -16,6 +16,6 @@
|
||||
*/
|
||||
|
||||
export * from './api';
|
||||
export * from './utilapi';
|
||||
export * from './api.util';
|
||||
export * from './deployment-api';
|
||||
export * from './modeling-api';
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export type ApiResultPredicate<T> = (result: T) => boolean;
|
||||
export type ApiCall<T> = () => Promise<T>;
|
||||
|
||||
export class UtilApi {
|
||||
static async waitForApi<T>(apiCall: ApiCall<T>, predicate: ApiResultPredicate<T>) {
|
||||
const apiCallWithPredicateChecking = async () => {
|
||||
const apiCallResult = await apiCall();
|
||||
if (predicate(apiCallResult)) {
|
||||
return Promise.resolve(apiCallResult);
|
||||
} else {
|
||||
return Promise.reject(apiCallResult);
|
||||
}
|
||||
};
|
||||
|
||||
return UtilApi.retryCall(apiCallWithPredicateChecking);
|
||||
}
|
||||
|
||||
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
|
||||
const pause = (duration: number) => new Promise((res) => setTimeout(res, duration));
|
||||
|
||||
const run = (retries: number) => {
|
||||
return fn().catch((err) => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
|
||||
};
|
||||
|
||||
return run(retry);
|
||||
}
|
||||
}
|
@@ -19,17 +19,9 @@ export class StringUtil {
|
||||
|
||||
static generatePasswordString(length: number = 8): string {
|
||||
let text = '';
|
||||
const possibleUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const possibleLowerCase = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const lowerCaseLimit = Math.floor(length / 2);
|
||||
|
||||
for (let i = 0; i < lowerCaseLimit; i++) {
|
||||
text += possibleLowerCase.charAt(Math.floor(Math.random() * possibleLowerCase.length));
|
||||
}
|
||||
|
||||
for (let i = 0; i < length - lowerCaseLimit; i++) {
|
||||
text += possibleUpperCase.charAt(Math.floor(Math.random() * possibleUpperCase.length));
|
||||
}
|
||||
text += StringUtil.generateRandomCharset(lowerCaseLimit, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||
text += StringUtil.generateRandomCharset(length - lowerCaseLimit, 'abcdefghijklmnopqrstuvwxyz');
|
||||
|
||||
return text;
|
||||
}
|
||||
@@ -38,17 +30,9 @@ export class StringUtil {
|
||||
* Generates a random string.
|
||||
*
|
||||
* @param length If this parameter is not provided the length is set to 8 by default.
|
||||
* @method generateRandomString
|
||||
*/
|
||||
static generateRandomString(length: number = 8): string {
|
||||
let text = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
|
||||
return text;
|
||||
return StringUtil.generateRandomCharset(length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,16 +40,9 @@ export class StringUtil {
|
||||
*
|
||||
* @param domain
|
||||
* @param length
|
||||
* @method generateRandomEmail
|
||||
*/
|
||||
static generateRandomEmail(domain: string, length: number = 5): string {
|
||||
let email = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
email += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
|
||||
let email = StringUtil.generateRandomCharset(length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
|
||||
email += domain;
|
||||
return email.toLowerCase();
|
||||
}
|
||||
@@ -74,33 +51,34 @@ export class StringUtil {
|
||||
* Generates a random string - digits only.
|
||||
*
|
||||
* @param length {int} If this parameter is not provided the length is set to 8 by default.
|
||||
* @method generateRandomString
|
||||
*/
|
||||
static generateRandomStringDigits(length: number = 8): string {
|
||||
let text = '';
|
||||
const possible = '0123456789';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
|
||||
return text;
|
||||
return StringUtil.generateRandomCharset(length, '0123456789');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random string - non-latin characters only.
|
||||
*
|
||||
* @param length {int} If this parameter is not provided the length is set to 3 by default.
|
||||
* @method generateRandomString
|
||||
*/
|
||||
static generateRandomStringNonLatin(length: number = 3): string {
|
||||
return StringUtil.generateRandomCharset(length, '密码你好𠮷');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random string.
|
||||
*
|
||||
* @param length If this parameter is not provided the length is set to 8 by default.
|
||||
* @param charSet to use
|
||||
*/
|
||||
static generateRandomCharset(length: number = 8, charSet: string): string {
|
||||
let text = '';
|
||||
const possible = '密码你好𠮷';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
text += charSet.charAt(Math.floor(Math.random() * charSet.length));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ export class DropdownPage {
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-option span.mat-option-text', option)));
|
||||
}
|
||||
|
||||
async clickDropdownWithOption(option: string): Promise<void> {
|
||||
async selectDropdownOption(option: string): Promise<void> {
|
||||
await this.clickDropdown();
|
||||
await this.selectOption(option);
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ export class EditProcessFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setStatusFilterDropDown(option: string): Promise<void> {
|
||||
await this.statusDropdown.clickDropdownWithOption(option);
|
||||
await this.statusDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getStateFilterDropDownValue(): Promise<string> {
|
||||
@@ -69,7 +69,7 @@ export class EditProcessFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setSortFilterDropDown(option): Promise<void> {
|
||||
await this.sortDropdown.clickDropdownWithOption(option);
|
||||
await this.sortDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getSortFilterDropDownValue(): Promise<string> {
|
||||
@@ -78,7 +78,7 @@ export class EditProcessFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setOrderFilterDropDown(option): Promise<void> {
|
||||
await this.orderDropdown.clickDropdownWithOption(option);
|
||||
await this.orderDropdown.selectDropdownOption(option);
|
||||
await browser.sleep(1500);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class EditProcessFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setAppNameDropDown(option: string): Promise<void> {
|
||||
await this.appNameDropdown.clickDropdownWithOption(option);
|
||||
await this.appNameDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getApplicationSelected(): Promise<string> {
|
||||
|
@@ -65,7 +65,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setStatusFilterDropDown(option: string): Promise<void> {
|
||||
await this.statusDropdown.clickDropdownWithOption(option);
|
||||
await this.statusDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getStatusFilterDropDownValue(): Promise<string> {
|
||||
@@ -73,7 +73,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setSortFilterDropDown(option: string): Promise<void> {
|
||||
await this.sortDropdown.clickDropdownWithOption(option);
|
||||
await this.sortDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getSortFilterDropDownValue(): Promise<string> {
|
||||
@@ -81,7 +81,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setOrderFilterDropDown(option: string): Promise<void> {
|
||||
await this.orderDropdown.clickDropdownWithOption(option);
|
||||
await this.orderDropdown.selectDropdownOption(option);
|
||||
await browser.sleep(1500);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export class EditTaskFilterCloudComponentPage {
|
||||
}
|
||||
|
||||
async setAppNameDropDown(option: string): Promise<void> {
|
||||
await this.appNameDropdown.clickDropdownWithOption(option);
|
||||
await this.appNameDropdown.selectDropdownOption(option);
|
||||
}
|
||||
|
||||
async getAppNameDropDownValue(): Promise<string> {
|
||||
|
Reference in New Issue
Block a user