Skip to content

Commit

Permalink
include attach file test (#6102)
Browse files Browse the repository at this point in the history
* include attach file test

* fix

* fix

* fix

* fix
  • Loading branch information
eromano committed Sep 10, 2020
1 parent e765239 commit 5305d65
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 24 deletions.
11 changes: 7 additions & 4 deletions e2e/core/infinite-scrolling.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ describe('Enable infinite scrolling', () => {
await contentServicesPage.doubleClickRow(folderModel.name);
await contentServicesPage.enableInfiniteScrolling();
await infinitePaginationPage.clickLoadMoreButton();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();

for (let i = 0; i < nrOfFiles; i++) {
await contentServicesPage.checkContentIsDisplayed(fileNames[i]);
}
Expand All @@ -102,6 +104,8 @@ describe('Enable infinite scrolling', () => {
await contentServicesPage.openFolder(deleteUploaded.entry.name);
await contentServicesPage.enableInfiniteScrolling();
await infinitePaginationPage.clickLoadMoreButton();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();

for (let i = 0; i < nrOfDeletedFiles; i++) {
await contentServicesPage.checkContentIsDisplayed(deleteFileNames[i]);
}
Expand All @@ -121,15 +125,14 @@ describe('Enable infinite scrolling', () => {
await contentServicesPage.doubleClickRow(folderModel.name);

await contentServicesPage.enableInfiniteScrolling();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();

await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(pageSize);
await infinitePaginationPage.clickLoadMoreButton();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();

await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();

await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
});

it('[C299202] Should not display load more button when all the files are already displayed', async () => {
Expand Down
14 changes: 13 additions & 1 deletion e2e/core/pages/content-services.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
* limitations under the License.
*/

import { DropActions, BrowserActions, BrowserVisibility, DateUtil, DocumentListPage, TogglePage, DropdownPage } from '@alfresco/adf-testing';
import {
DropActions,
BrowserActions,
BrowserVisibility,
DateUtil,
DocumentListPage,
TogglePage,
DropdownPage,
Logger
} from '@alfresco/adf-testing';
import { Locator, $$, browser, by, element, ElementFinder, protractor } from 'protractor';
import { CreateLibraryDialogPage } from './dialog/create-library-dialog.page';
import { FolderDialogPage } from './dialog/folder-dialog.page';
Expand Down Expand Up @@ -344,6 +353,7 @@ export class ContentServicesPage {
}

async doubleClickRow(nodeName): Promise<void> {
Logger.log(`Open Folder ${nodeName}`);
await this.contentList.doubleClickRow(nodeName);
await this.contentList.dataTablePage().waitTillContentLoaded();
}
Expand Down Expand Up @@ -648,9 +658,11 @@ export class ContentServicesPage {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.multiSelectToggle);
}

async multiSelectToggleIsEnabled(): Promise<boolean> {
return this.multiSelectToggle.isEnabled();
}

async clickSelectAllCheckbox(): Promise<void> {
await BrowserActions.click(this.selectAllCheckbox);
}
Expand Down
3 changes: 2 additions & 1 deletion e2e/core/pagination-empty-current-page.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('Pagination - returns to previous page when current is empty', () => {

await paginationPage.selectItemsPerPage(itemsPerPage.five);
await contentServicesPage.checkDocumentListElementsAreDisplayed();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();

await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
Expand All @@ -111,7 +112,6 @@ describe('Pagination - returns to previous page when current is empty', () => {
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);

await paginationPage.clickOnNextPage();

await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();

await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
Expand All @@ -135,6 +135,7 @@ describe('Pagination - returns to previous page when current is empty', () => {

await paginationPage.selectItemsPerPage(itemsPerPage.five);
await contentServicesPage.checkDocumentListElementsAreDisplayed();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();

await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
Expand Down
23 changes: 17 additions & 6 deletions e2e/process-services/attach-file-content-service.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ describe('Attach File - Content service', () => {

const apiServiceExternal = new ApiService({
provider: 'ECM',
hostEcm: browser.params.testConfig.adf_external_acs.host
hostEcm: browser.params.testConfig.adf_external_acs.host,
authType: 'BASIC'
});
const usersActionsExternal = new UsersActions(apiServiceExternal);

const apiService = new ApiService({ provider: 'ALL'});
const apiService = new ApiService({ provider: 'ALL' });
const integrationService = new IntegrationService(apiService);
const applicationService = new ApplicationsUtil(apiService);
const uploadActions = new UploadActions(apiService);
Expand Down Expand Up @@ -81,8 +82,16 @@ describe('Attach File - Content service', () => {
await apiServiceExternal.login(email, password);
await usersActionsExternal.createUser(user);

await integrationService.addCSIntegration({ tenantId: user.tenantId, name: csIntegrations[0], host: browser.params.testConfig.appConfig.ecmHost });
await integrationService.addCSIntegration({ tenantId: user.tenantId, name: csIntegrations[1], host: browser.params.testConfig.adf_external_acs.host });
await integrationService.addCSIntegration({
tenantId: user.tenantId,
name: csIntegrations[0],
host: browser.params.testConfig.appConfig.ecmHost
});
await integrationService.addCSIntegration({
tenantId: user.tenantId,
name: csIntegrations[1],
host: browser.params.testConfig.adf_external_acs.host
});

await apiService.getInstance().login(user.email, user.password);
await uploadActions.uploadFile(pdfFileTwo.location, pdfFileTwo.name, '-my-');
Expand All @@ -94,11 +103,11 @@ describe('Attach File - Content service', () => {
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
});

beforeEach( async () => {
beforeEach(async () => {
await loginPage.login(user.email, user.password);
});

afterEach( async () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});

Expand All @@ -115,6 +124,8 @@ describe('Attach File - Content service', () => {
await widget.attachFileWidget().clickUploadButton(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id);
await widget.attachFileWidget().selectUploadSource(csIntegrations[0]);

await contentNodeSelector.contentList.dataTablePage().waitTillContentLoaded();

await contentNodeSelector.searchAndSelectResult(pdfFileTwo.name, pdfFileTwo.name);
await contentNodeSelector.clickMoveCopyButton();
await widget.attachFileWidget().checkFileIsAttached(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileTwo.name);
Expand Down
1 change: 1 addition & 0 deletions e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ exports.config = {
'--no-sandbox',
'--disable-web-security',
'--disable-browser-side-navigation',
'-allow-running-insecure-content',
...(BROWSER_RUN === true ? [] : ['--headless'])]
}
},
Expand Down
15 changes: 5 additions & 10 deletions e2e/protractor.excludes.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"C362240": "Include once ADF starts using ACS 7 , https://issues.alfresco.com/jira/browse/ADF-5182",
"C362241": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182",
"C291980": "Facet not working",
"C291981": "Facet not working",
"C299200": "Facet not working",
"C297509": "Facet not working",
"C291980": "https://issues.alfresco.com/jira/browse/ADF-5235",
"C291981": "https://issues.alfresco.com/jira/browse/ADF-5235",
"C299200": "https://issues.alfresco.com/jira/browse/ADF-5235",
"C297509": "https://issues.alfresco.com/jira/browse/ADF-5235",
"C277751": "setting problem APS not basic",
"C277752": "setting problem APS not basic",
"C277753": "setting problem APS not basic",
Expand All @@ -13,12 +13,7 @@
"C279932": "login problem APS not basic",
"C279931": "login problem APS not basic",
"C279930": "login problem APS not basic",
"C315268": "Attach file issue",
"C246522": "Attach file issue",
"C299040": "Attach file issue",
"C286516": "Attach file issue",
"C246534": "Attach file issue",
"C279886": "Attach file issue",
"C246534": "https://issues.alfresco.com/jira/browse/ADF-5236",
"C291893": "flaky test"
}

Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class ContentNodeSelectorDialogPage {

async searchAndSelectResult(searchText: string, name: string) {
await this.typeIntoNodeSelectorSearchField(searchText);
await this.contentListPage().dataTablePage().waitTillContentLoaded();
try {
await this.contentListPage().dataTablePage().checkRowContentIsDisplayed(name);
} catch (e) {
Expand Down
23 changes: 23 additions & 0 deletions lib/testing/src/lib/core/pages/data-table-component.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,29 @@ export class DataTableComponentPage {
}
}

try {
Logger.log('wait first element is present');
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
} catch (error) {
Logger.log('Possible empty page');
}

}

async waitTillContentLoadedInfinitePagination(): Promise<void> {
await browser.sleep(500);

if (element(by.tagName('mat-progress-bar')).isPresent()) {
Logger.log('wait datatable loading spinner disappear');
await BrowserVisibility.waitUntilElementIsNotPresent(element(by.tagName('mat-progress-bar')));
} else {
try {
Logger.log('wait datatable loading spinner is present');
await BrowserVisibility.waitUntilElementIsPresent(element(by.tagName('mat-progress-bar')));
} catch (error) {
}
}

try {
Logger.log('wait first element is present');
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first(), 1000);
Expand Down
5 changes: 3 additions & 2 deletions lib/testing/src/lib/core/pages/pagination.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { Locator, by, element } from 'protractor';
import { Locator, by, element, browser } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
Expand Down Expand Up @@ -47,6 +47,7 @@ export class PaginationPage {
await BrowserActions.click(itemsPerPage);
await BrowserVisibility.waitUntilElementIsNotVisible(this.pageSelectorDropDown);
Logger.log('Select page size ', numberOfItem);
await browser.sleep(500);
}

async checkPageSelectorIsNotDisplayed(): Promise<void> {
Expand Down Expand Up @@ -82,8 +83,8 @@ export class PaginationPage {
}

async clickOnNextPage(): Promise<void> {
return BrowserActions.click(this.nextPageButton);
Logger.log('Next page');
return BrowserActions.click(this.nextPageButton);
}

async clickOnPageDropdown(): Promise<void> {
Expand Down

0 comments on commit 5305d65

Please sign in to comment.