mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-259] refactor login page (#5733)
* refator login page * refator login page * remove obsolete classes and move what is needed in the test pck * fix const * revert modify * remove duplicate browser property * fix build * fix * fix * fix lint * move drop action in testing remove not necessary space js-api centralize content * first refactor use js-api * fix protractor * refactor test config * simplify properties fix namings * ps cloud simplify remove unused js files * id fix * fix search test simplify environment var step 1 * fix lint * first user iteration fix * fix model * unify use of apiService * first step automatic user creation Identity * refactor creation user content-services * refactor creation user search * refactor creation user core * process service refactoring 1 * process service refactoring 1 * process service refactoring 2 * fix process * appconfig * fix process util * fix gallery * fix "this" reference issues * fix incorrect import paths * fix core * some fixes * allign * fix some test remove structure folder and move in actions * fixes * move folders in the right place * fix * fix rebase * solve build issue * fix e2e * change init aae * order api and some fixes * fix possible not valid password * fix some ps test * replace host port also in objects * Update app-config.service.ts * fix process * fix process test * process service cloud fix * fiexs * modify init script * fix two test * remove unused property * host issue * not use npx * fix ps cloud test Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
@@ -15,16 +15,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LoginPage, UploadActions, PaginationPage, LocalStorageUtil, FileBrowserUtil } from '@alfresco/adf-testing';
|
||||
import {
|
||||
ArrayUtil,
|
||||
StringUtil,
|
||||
LoginSSOPage,
|
||||
UploadActions,
|
||||
PaginationPage,
|
||||
LocalStorageUtil,
|
||||
FileBrowserUtil,
|
||||
ApiService, UserModel
|
||||
} from '@alfresco/adf-testing';
|
||||
import { ContentServicesPage } from '../../pages/adf/content-services.page';
|
||||
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||
import { AcsUserModel } from '../../models/ACS/acs-user.model';
|
||||
import { FolderModel } from '../../models/ACS/folder.model';
|
||||
import { Util } from '../../util/util';
|
||||
import { browser } from 'protractor';
|
||||
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
import { FileModel } from '../../models/ACS/file.model';
|
||||
import { UploadDialogPage } from '../../pages/adf/dialog/upload-dialog.page';
|
||||
import { UsersActions } from '../../actions/users.actions';
|
||||
|
||||
describe('Document List - Pagination', () => {
|
||||
const pagination = {
|
||||
@@ -47,13 +54,13 @@ describe('Document List - Pagination', () => {
|
||||
default: '25'
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const loginPage = new LoginSSOPage();
|
||||
const contentServicesPage = new ContentServicesPage();
|
||||
const paginationPage = new PaginationPage();
|
||||
const navigationBarPage = new NavigationBarPage();
|
||||
const uploadDialog = new UploadDialogPage();
|
||||
|
||||
const acsUser = new AcsUserModel();
|
||||
let acsUser: UserModel;
|
||||
const newFolderModel = new FolderModel({ name: 'newFolder' });
|
||||
let fileNames = [];
|
||||
const nrOfFiles = 20;
|
||||
@@ -64,12 +71,10 @@ describe('Document List - Pagination', () => {
|
||||
const folderTwoModel = new FolderModel({ name: 'folderTwo' });
|
||||
const folderThreeModel = new FolderModel({ name: 'folderThree' });
|
||||
const numberOfSubFolders = 6;
|
||||
const apiService = new ApiService();
|
||||
const usersActions = new UsersActions(apiService);
|
||||
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
provider: 'ECM',
|
||||
hostEcm: browser.params.testConfig.adf_acs.host
|
||||
});
|
||||
const uploadActions = new UploadActions(this.alfrescoJsApi);
|
||||
const uploadActions = new UploadActions(apiService);
|
||||
|
||||
const docxFileModel = new FileModel({
|
||||
'name': browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
|
||||
@@ -77,12 +82,12 @@ describe('Document List - Pagination', () => {
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
fileNames = Util.generateSequenceFiles(10, nrOfFiles + 9, pagination.base, pagination.extension);
|
||||
secondSetOfFiles = Util.generateSequenceFiles(10, secondSetNumber + 9, pagination.secondSetBase, pagination.extension);
|
||||
fileNames = StringUtil.generateFilesNames(10, nrOfFiles + 9, pagination.base, pagination.extension);
|
||||
secondSetOfFiles = StringUtil.generateFilesNames(10, secondSetNumber + 9, pagination.secondSetBase, pagination.extension);
|
||||
|
||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
|
||||
acsUser = await usersActions.createUser();
|
||||
await apiService.getInstance().login(acsUser.email, acsUser.password);
|
||||
|
||||
const folderThreeUploadedModel = await uploadActions.createFolder(folderThreeModel.name, '-my-');
|
||||
const newFolderUploadedModel = await uploadActions.createFolder(newFolderModel.name, '-my-');
|
||||
@@ -90,7 +95,7 @@ describe('Document List - Pagination', () => {
|
||||
await uploadActions.createEmptyFiles(fileNames, newFolderUploadedModel.entry.id);
|
||||
await uploadActions.createEmptyFiles(secondSetOfFiles, folderThreeUploadedModel.entry.id);
|
||||
|
||||
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
await loginPage.login(acsUser.email, acsUser.password);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -108,7 +113,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual( `Showing 1-${nrOfFiles} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
|
||||
const list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames)).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames)).toEqual(true);
|
||||
await paginationPage.checkNextPageButtonIsDisabled();
|
||||
await paginationPage.checkPreviousPageButtonIsDisabled();
|
||||
});
|
||||
@@ -122,17 +127,17 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual( `Showing 1-${nrOfFiles} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
|
||||
const list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames)).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames)).toEqual(true);
|
||||
await paginationPage.checkNextPageButtonIsDisabled();
|
||||
await paginationPage.checkPreviousPageButtonIsDisabled();
|
||||
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
await loginPage.login(acsUser.email, acsUser.password);
|
||||
await contentServicesPage.goToDocumentList();
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
await loginPage.login(acsUser.email, acsUser.password);
|
||||
});
|
||||
|
||||
it('[C260069] Should be able to set Items per page to 5', async () => {
|
||||
@@ -144,7 +149,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${itemsPerPage.fiveValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
|
||||
let list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
|
||||
await paginationPage.clickOnNextPage();
|
||||
currentPage++;
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
@@ -152,7 +157,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual( `Showing 6-${itemsPerPage.fiveValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(5, 10))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(5, 10))).toEqual(true);
|
||||
await paginationPage.clickOnNextPage();
|
||||
currentPage++;
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
@@ -160,7 +165,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 11-${itemsPerPage.fiveValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(10, 15))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(10, 15))).toEqual(true);
|
||||
await paginationPage.clickOnNextPage();
|
||||
currentPage++;
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
@@ -168,13 +173,13 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 16-${itemsPerPage.fiveValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
|
||||
|
||||
await browser.refresh();
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
await loginPage.login(acsUser.email, acsUser.password);
|
||||
});
|
||||
|
||||
it('[C260067] Should be able to set Items per page to 10', async () => {
|
||||
@@ -187,7 +192,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${itemsPerPage.tenValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.tenValue);
|
||||
let list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(0, 10))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 10))).toEqual(true);
|
||||
await paginationPage.clickOnNextPage();
|
||||
currentPage++;
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
@@ -195,13 +200,13 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 11-${itemsPerPage.tenValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.tenValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(10, 20))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(10, 20))).toEqual(true);
|
||||
|
||||
await browser.refresh();
|
||||
await contentServicesPage.waitForTableBody();
|
||||
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||
await loginPage.login(acsUser.email, acsUser.password);
|
||||
currentPage = 1;
|
||||
});
|
||||
|
||||
@@ -216,7 +221,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${itemsPerPage.fifteenValue * currentPage} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fifteenValue);
|
||||
let list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(0, 15))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 15))).toEqual(true);
|
||||
currentPage++;
|
||||
await paginationPage.clickOnNextPage();
|
||||
await contentServicesPage.checkDocumentListElementsAreDisplayed();
|
||||
@@ -225,7 +230,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual( `Showing 16-${nrOfFiles} of ${nrOfFiles}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles - itemsPerPage.fifteenValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
|
||||
|
||||
await browser.refresh();
|
||||
await contentServicesPage.waitForTableBody();
|
||||
@@ -279,7 +284,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${itemsPerPage.fifteenValue * currentPage} of ${secondSetNumber}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fifteenValue);
|
||||
let list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(0, 15))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(0, 15))).toEqual(true);
|
||||
|
||||
currentPage++;
|
||||
await paginationPage.clickOnNextPage();
|
||||
@@ -288,7 +293,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 16-${secondSetNumber} of ${secondSetNumber}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - itemsPerPage.fifteenValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(15, 25))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(15, 25))).toEqual(true);
|
||||
|
||||
currentPage = 1;
|
||||
await paginationPage.selectItemsPerPage(itemsPerPage.twenty);
|
||||
@@ -297,7 +302,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${itemsPerPage.twentyValue * currentPage} of ${secondSetNumber}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.twentyValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(0, 20))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(0, 20))).toEqual(true);
|
||||
|
||||
currentPage++;
|
||||
await paginationPage.clickOnNextPage();
|
||||
@@ -306,7 +311,7 @@ describe('Document List - Pagination', () => {
|
||||
await expect(await paginationPage.getPaginationRange()).toEqual( `Showing 21-${secondSetNumber} of ${secondSetNumber}`);
|
||||
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - itemsPerPage.twentyValue);
|
||||
list = await contentServicesPage.getAllRowsNameColumn();
|
||||
await expect(Util.arrayContainsArray(list, secondSetOfFiles.slice(20, 25))).toEqual(true);
|
||||
await expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(20, 25))).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C216321] Should be able to modify the supported page size value', async () => {
|
||||
|
Reference in New Issue
Block a user