[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:
Eugenio Romano
2020-03-02 10:28:38 +00:00
committed by GitHub
parent 7c849d87f4
commit 7a2af38699
23 changed files with 145 additions and 132 deletions
@@ -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);
});
});
});
+2 -2
View File
@@ -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> {
+1 -1
View File
@@ -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> {
+3 -3
View File
@@ -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> {