mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4226]Adding tests for infinite pagination. (#4428)
* Adding tests for infinite pagination. * sustitute function * remove wrong file * Remove a check * Fix after rebase
This commit is contained in:
committed by
Eugenio Romano
parent
e3804e0e70
commit
77bad96d0d
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
import { LoginPage } from '../pages/adf/loginPage';
|
import { LoginPage } from '../pages/adf/loginPage';
|
||||||
import { ContentServicesPage } from '../pages/adf/contentServicesPage';
|
import { ContentServicesPage } from '../pages/adf/contentServicesPage';
|
||||||
|
import { InfinitePaginationPage } from '../pages/adf/core/infinitePaginationPage';
|
||||||
|
import { ConfigEditorPage } from '../pages/adf/configEditorPage';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
|
||||||
|
|
||||||
import { AcsUserModel } from '../models/ACS/acsUserModel';
|
import { AcsUserModel } from '../models/ACS/acsUserModel';
|
||||||
import { FolderModel } from '../models/ACS/folderModel';
|
import { FolderModel } from '../models/ACS/folderModel';
|
||||||
@@ -29,14 +32,19 @@ import { UploadActions } from '../actions/ACS/upload.actions';
|
|||||||
|
|
||||||
describe('Enable infinite scrolling', () => {
|
describe('Enable infinite scrolling', () => {
|
||||||
|
|
||||||
let loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
let contentServicesPage = new ContentServicesPage();
|
const contentServicesPage = new ContentServicesPage();
|
||||||
|
const infinitePaginationPage = new InfinitePaginationPage();
|
||||||
|
const configEditorPage = new ConfigEditorPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
|
||||||
let acsUser = new AcsUserModel();
|
let acsUser = new AcsUserModel();
|
||||||
let folderModel = new FolderModel({ 'name': 'folderOne' });
|
let folderModel = new FolderModel({ 'name': 'folderOne' });
|
||||||
|
|
||||||
let fileNames = [], nrOfFiles = 21, deleteFileNames = [], nrOfDeletedFiles = 22;
|
let fileNames = [], nrOfFiles = 30, deleteFileNames = [], nrOfDeletedFiles = 22;
|
||||||
let deleteUploaded;
|
let deleteUploaded;
|
||||||
|
let pageSize = 20;
|
||||||
|
let emptyFolderModel;
|
||||||
|
|
||||||
let files = {
|
let files = {
|
||||||
base: 'newFile',
|
base: 'newFile',
|
||||||
@@ -63,6 +71,7 @@ describe('Enable infinite scrolling', () => {
|
|||||||
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||||
|
|
||||||
let folderUploadedModel = await uploadActions.createFolder(this.alfrescoJsApi, folderModel.name, '-my-');
|
let folderUploadedModel = await uploadActions.createFolder(this.alfrescoJsApi, folderModel.name, '-my-');
|
||||||
|
emptyFolderModel = await uploadActions.createFolder(this.alfrescoJsApi, 'emptyFolder', '-my-');
|
||||||
|
|
||||||
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, folderUploadedModel.entry.id);
|
await uploadActions.createEmptyFiles(this.alfrescoJsApi, fileNames, folderUploadedModel.entry.id);
|
||||||
|
|
||||||
@@ -74,14 +83,15 @@ describe('Enable infinite scrolling', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async (done) => {
|
beforeEach(async (done) => {
|
||||||
contentServicesPage.goToDocumentList();
|
navigationBarPage.clickContentServicesButton();
|
||||||
|
contentServicesPage.checkAcsContainer();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C260484] Should be possible to enable infinite scrolling', () => {
|
it('[C260484] Should be possible to enable infinite scrolling', () => {
|
||||||
contentServicesPage.doubleClickRow(folderModel.name);
|
contentServicesPage.doubleClickRow(folderModel.name);
|
||||||
contentServicesPage.enableInfiniteScrolling();
|
contentServicesPage.enableInfiniteScrolling();
|
||||||
contentServicesPage.clickLoadMoreButton();
|
infinitePaginationPage.clickLoadMoreButton();
|
||||||
for (let i = 0; i < nrOfFiles; i++) {
|
for (let i = 0; i < nrOfFiles; i++) {
|
||||||
contentServicesPage.checkContentIsDisplayed(fileNames[i]);
|
contentServicesPage.checkContentIsDisplayed(fileNames[i]);
|
||||||
}
|
}
|
||||||
@@ -92,7 +102,7 @@ describe('Enable infinite scrolling', () => {
|
|||||||
contentServicesPage.checkAcsContainer();
|
contentServicesPage.checkAcsContainer();
|
||||||
contentServicesPage.waitForTableBody();
|
contentServicesPage.waitForTableBody();
|
||||||
contentServicesPage.enableInfiniteScrolling();
|
contentServicesPage.enableInfiniteScrolling();
|
||||||
contentServicesPage.clickLoadMoreButton();
|
infinitePaginationPage.clickLoadMoreButton();
|
||||||
for (let i = 0; i < nrOfDeletedFiles; i++) {
|
for (let i = 0; i < nrOfDeletedFiles; i++) {
|
||||||
contentServicesPage.checkContentIsDisplayed(deleteFileNames[i]);
|
contentServicesPage.checkContentIsDisplayed(deleteFileNames[i]);
|
||||||
}
|
}
|
||||||
@@ -106,4 +116,43 @@ describe('Enable infinite scrolling', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C299201] Should use default pagination settings for infinite pagination', () => {
|
||||||
|
navigationBarPage.clickContentServicesButton();
|
||||||
|
contentServicesPage.checkAcsContainer();
|
||||||
|
contentServicesPage.doubleClickRow(folderModel.name);
|
||||||
|
|
||||||
|
contentServicesPage.enableInfiniteScrolling();
|
||||||
|
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(pageSize);
|
||||||
|
infinitePaginationPage.clickLoadMoreButton();
|
||||||
|
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
|
||||||
|
|
||||||
|
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C299202] Should not display load more button when all the files are already displayed', () => {
|
||||||
|
navigationBarPage.clickConfigEditorButton();
|
||||||
|
configEditorPage.clickInfinitePaginationConfiguration();
|
||||||
|
configEditorPage.clickClearButton();
|
||||||
|
configEditorPage.enterConfiguration('30');
|
||||||
|
configEditorPage.clickSaveButton();
|
||||||
|
|
||||||
|
navigationBarPage.clickContentServicesButton();
|
||||||
|
contentServicesPage.checkAcsContainer();
|
||||||
|
contentServicesPage.doubleClickRow(folderModel.name);
|
||||||
|
|
||||||
|
contentServicesPage.enableInfiniteScrolling();
|
||||||
|
expect(contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
|
||||||
|
|
||||||
|
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C299203] Should not display load more button when a folder is empty', () => {
|
||||||
|
navigationBarPage.clickContentServicesButton();
|
||||||
|
contentServicesPage.checkAcsContainer();
|
||||||
|
|
||||||
|
contentServicesPage.doubleClickRow(emptyFolderModel.entry.name);
|
||||||
|
|
||||||
|
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -90,4 +90,11 @@ export class ConfigEditorPage {
|
|||||||
Util.waitUntilElementIsClickable(button);
|
Util.waitUntilElementIsClickable(button);
|
||||||
return button.click();
|
return button.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickInfinitePaginationConfiguration() {
|
||||||
|
let button = element(by.id('adf-infinite-pagination-conf'));
|
||||||
|
Util.waitUntilElementIsVisible(button);
|
||||||
|
Util.waitUntilElementIsClickable(button);
|
||||||
|
return button.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,6 @@ export class ContentServicesPage {
|
|||||||
uploadMultipleFileButton = element(by.css('input[data-automation-id="upload-multiple-files"]'));
|
uploadMultipleFileButton = element(by.css('input[data-automation-id="upload-multiple-files"]'));
|
||||||
uploadFolderButton = element(by.css('input[data-automation-id="uploadFolder"]'));
|
uploadFolderButton = element(by.css('input[data-automation-id="uploadFolder"]'));
|
||||||
errorSnackBar = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]'));
|
errorSnackBar = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]'));
|
||||||
loadMoreButton = element(by.css('button[data-automation-id="adf-infinite-pagination-button"]'));
|
|
||||||
emptyPagination = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
|
emptyPagination = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
|
||||||
dragAndDrop = element.all(by.css('adf-upload-drag-area div')).first();
|
dragAndDrop = element.all(by.css('adf-upload-drag-area div')).first();
|
||||||
nameHeader = element(by.css('div[data-automation-id="auto_id_name"] > span'));
|
nameHeader = element(by.css('div[data-automation-id="auto_id_name"] > span'));
|
||||||
@@ -504,13 +503,6 @@ export class ContentServicesPage {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clickLoadMoreButton() {
|
|
||||||
Util.waitUntilElementIsVisible(this.loadMoreButton);
|
|
||||||
Util.waitUntilElementIsClickable(this.loadMoreButton);
|
|
||||||
this.loadMoreButton.click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkPaginationIsNotDisplayed() {
|
checkPaginationIsNotDisplayed() {
|
||||||
Util.waitUntilElementIsVisible(this.emptyPagination);
|
Util.waitUntilElementIsVisible(this.emptyPagination);
|
||||||
}
|
}
|
||||||
|
48
e2e/pages/adf/core/infinitePaginationPage.ts
Normal file
48
e2e/pages/adf/core/infinitePaginationPage.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*!
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { element, by } from 'protractor';
|
||||||
|
import { ElementFinder } from 'protractor/built/element';
|
||||||
|
|
||||||
|
import { Util } from '../../../util/util';
|
||||||
|
|
||||||
|
export class InfinitePaginationPage {
|
||||||
|
|
||||||
|
rootElement: ElementFinder;
|
||||||
|
loadMoreButton;
|
||||||
|
|
||||||
|
constructor(rootElement: ElementFinder = element.all(by.css('adf-infinite-pagination')).first()) {
|
||||||
|
this.rootElement = rootElement;
|
||||||
|
this.loadMoreButton = this.rootElement.element(by.css('button[data-automation-id="adf-infinite-pagination-button"]'));
|
||||||
|
}
|
||||||
|
|
||||||
|
clickLoadMoreButton() {
|
||||||
|
Util.waitUntilElementIsVisible(this.loadMoreButton);
|
||||||
|
Util.waitUntilElementIsClickable(this.loadMoreButton);
|
||||||
|
this.loadMoreButton.click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLoadMoreButtonIsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.loadMoreButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLoadMoreButtonIsNotDisplayed() {
|
||||||
|
return Util.waitUntilElementIsNotOnPage(this.loadMoreButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user