[ACS-6136] cleanup e2e files (protractor) (#9009)

* cleanup e2e

* clean e2e
This commit is contained in:
Denys Vuika
2023-10-19 09:14:14 +01:00
committed by GitHub
parent b49c86fda5
commit d13db25609
9 changed files with 15 additions and 912 deletions

View File

@@ -21,7 +21,7 @@ import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, User
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
import { DateFnsUtils } from '../../../lib/core/src/lib/common/utils/date-fns-utils';
import { format } from 'date-fns';
describe('Document List Component', () => {
let uploadedFolder: NodeEntry;
@@ -123,7 +123,7 @@ describe('Document List Component', () => {
await navigationBarPage.clickLogoutButton();
});
it('[C279926] Should only display the user\'s files and folders', async () => {
it("[C279926] Should only display the user's files and folders", async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
@@ -150,7 +150,7 @@ describe('Document List Component', () => {
it('[C279929] Should be able to display the date with date type', async () => {
await apiService.login(acsUser.username, acsUser.password);
mediumDateUploadedNode = await uploadActions.uploadFile(mediumFileModel.location, mediumFileModel.name, '-my-');
const createdDate = DateFnsUtils.formatDate(mediumDateUploadedNode.entry.createdAt, 'll');
const createdDate = format(new Date(mediumDateUploadedNode.entry.createdAt), 'PP');
await contentServicesPage.goToDocumentList();
await contentServicesPage.enableMediumTimeFormat();
const dateValue = await contentServicesPage.getColumnValueForRow(mediumFileModel.name, 'Created');
@@ -174,7 +174,9 @@ describe('Document List Component', () => {
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
let fileANode; let fileBNode; let fileCNode;
let fileANode: NodeEntry;
let fileBNode: NodeEntry;
let fileCNode: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
@@ -232,7 +234,6 @@ describe('Document List Component', () => {
});
describe('', () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
@@ -351,7 +352,7 @@ describe('Document List Component', () => {
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
let file: any;
let file: NodeEntry;
const viewer = new ViewerPage();
beforeAll(async () => {

View File

@@ -1,168 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
let acsUser: UserModel;
const navigationBarPage = new NavigationBarPage();
describe('Gallery View', () => {
const cardProperties = {
DISPLAY_NAME: 'Display name',
SIZE: 'Size',
LOCK: 'Lock',
CREATED_BY: 'Created by',
CREATED: 'Created'
};
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const docxFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode: NodeEntry;
let fileTestNode: NodeEntry;
let fileDocxNode: NodeEntry;
let folderNode: NodeEntry;
let filePDFSubNode: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
filePdfNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(folderName, '-my-');
filePDFSubNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, folderNode.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
if (filePdfNode) {
await uploadActions.deleteFileOrFolder(filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFileOrFolder(fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFileOrFolder(fileDocxNode.entry.id);
}
if (filePDFSubNode) {
await uploadActions.deleteFileOrFolder(filePDFSubNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFileOrFolder(folderNode.entry.id);
}
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.clickGridViewButton();
await contentServicesPage.checkCardViewContainerIsDisplayed();
});
it('[C280016] Should be able to choose Gallery View', async () => {
await expect(await contentServicesPage.getCardElementShowedInPage()).toBe(4);
});
it('[C280023] Gallery Card should show details', async () => {
await expect(await contentServicesPage.getDocumentCardIconForElement(folderName)).toContain('/assets/images/ft_ic_folder.svg');
await expect(await contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
await expect(await contentServicesPage.getDocumentCardIconForElement(docxFile.name)).toContain('/assets/images/ft_ic_ms_word.svg');
await expect(await contentServicesPage.getDocumentCardIconForElement(testFile.name)).toContain('/assets/images/ft_ic_document.svg');
await contentServicesPage.checkMenuIsShowedForElementIndex(0);
await contentServicesPage.checkMenuIsShowedForElementIndex(1);
await contentServicesPage.checkMenuIsShowedForElementIndex(2);
await contentServicesPage.checkMenuIsShowedForElementIndex(3);
});
it('[C280069] Gallery Card should show attributes', async () => {
await contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.DISPLAY_NAME);
await contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.SIZE);
await contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED_BY);
await contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED);
await expect(await contentServicesPage.getAttributeValueForElement(folderName, cardProperties.DISPLAY_NAME)).toBe(folderName);
await expect(await contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED_BY)).toBe(`${acsUser.firstName} ${acsUser.lastName}`);
await expect(await contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED)).toMatch(/(ago|few)/);
await expect(await contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.DISPLAY_NAME)).toBe(pdfFile.name);
await expect(await contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.SIZE)).toBe(`105.02 KB`);
await expect(await contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED_BY)).toBe(`${acsUser.firstName} ${acsUser.lastName}`);
await expect(await contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
await expect(await contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.DISPLAY_NAME)).toBe(docxFile.name);
await expect(await contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.SIZE)).toBe(`11.81 KB`);
await expect(await contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED_BY))
.toBe(`${acsUser.firstName} ${acsUser.lastName}`);
await expect(await contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
await expect(await contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.DISPLAY_NAME)).toBe(testFile.name);
await expect(await contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.SIZE)).toBe(`14 Bytes`);
await expect(await contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED_BY))
.toBe(`${acsUser.firstName} ${acsUser.lastName}`);
await expect(await contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
});
it('[C261993] Should be able to sort Gallery Cards by display name', async () => {
await contentServicesPage.selectGridSortingFromDropdown(cardProperties.DISPLAY_NAME);
await contentServicesPage.checkListIsSortedByNameColumn('asc');
});
it('[C261995] Should be able to sort Gallery Cards by author', async () => {
await contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED_BY);
await contentServicesPage.checkListIsSortedByAuthorColumn('asc');
});
it('[C261996] Should be able to sort Gallery Cards by created date', async () => {
await contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED);
await contentServicesPage.checkListIsSortedByCreatedColumn('asc');
});
});
});

View File

@@ -18,17 +18,16 @@
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { createApiService, BrowserActions, ErrorPage, LoginPage, StringUtil, UsersActions } from '@alfresco/adf-testing';
import { SitesApi } from '@alfresco/js-api';
import { SiteEntry, SitesApi } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const errorPage = new ErrorPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
let privateSite;
let privateSite: SiteEntry;
let acsUser = null;
describe('Permission Message', () => {
@@ -57,7 +56,7 @@ describe('Document List Component', () => {
it('[C217334] Should display a message when accessing file without permissions', async () => {
await BrowserActions.getUrl(browser.baseUrl + '/files/' + privateSite.entry.guid);
await expect(await errorPage.getErrorCode()).toBe('403');
await expect(await errorPage.getErrorDescription()).toBe('You\'re not allowed access to this resource on the server.');
await expect(await errorPage.getErrorDescription()).toBe("You're not allowed access to this resource on the server.");
});
});
});
});

View File

@@ -1,131 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, PaginationPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FolderModel } from '../../models/ACS/folder.model';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
describe('Document List - Selection', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const uploadDialog = new UploadDialogPage();
const paginationPage = new PaginationPage();
let acsUser: UserModel;
const folderModel = new FolderModel({ name: 'folder' });
const docxFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const displayColumnName = 'Display name';
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
try {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.createNewFolder(folderModel.name);
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
} catch (error) {
throw new Error(`API call failed in beforeAll: ${error}`);
}
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C274696] Should be able to select and unselect a file or folder', async () => {
await contentServicesPage.selectRow(docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, docxFileModel.name);
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, docxFileModel.name);
await contentServicesPage.selectRow(docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, docxFileModel.name);
await contentServicesPage.selectRow(folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await contentServicesPage.selectRow(folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, folderModel.name);
});
it('[C260057] Should be able to choose between the Selection Mode options and select items accordingly', async () => {
await contentServicesPage.chooseSelectionMode('None');
await contentServicesPage.selectRow(docxFileModel.name);
await contentServicesPage.selectFolderWithCommandKey(folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, folderModel.name);
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[]');
await contentServicesPage.chooseSelectionMode('Single');
await contentServicesPage.selectRow(docxFileModel.name);
await contentServicesPage.selectFolderWithCommandKey(folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, docxFileModel.name );
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[\"' + folderModel.name + '\"]');
await contentServicesPage.chooseSelectionMode('Multiple');
await contentServicesPage.selectRow(docxFileModel.name);
await contentServicesPage.selectFolderWithCommandKey(folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[\"' + docxFileModel.name + '","' + folderModel.name + '\"]');
});
it('[C212928] Should be able to enable the Multiselect (with checkboxes) toggle and select items accordingly', async () => {
await contentServicesPage.chooseSelectionMode('Multiple');
await contentServicesPage.clickMultiSelectToggle();
await expect(await contentServicesPage.multiSelectToggleIsEnabled()).toBe(true);
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[]');
await contentServicesPage.selectItemWithCheckbox(docxFileModel.name);
await contentServicesPage.selectItemWithCheckbox(folderModel.name);
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[\"' + docxFileModel.name + '","' + folderModel.name + '\"]');
await contentServicesPage.unSelectItemWithCheckbox(docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsNotSelected(displayColumnName, docxFileModel.name );
await contentServicesPage.clickSelectAllCheckbox();
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, docxFileModel.name);
await contentServicesPage.getDocumentList().dataTablePage().checkRowIsSelected(displayColumnName, folderModel.name);
await expect(JSON.stringify(await contentServicesPage.getItemSelected())).toEqual('[\"' + folderModel.name + '","' + docxFileModel.name + '\"]');
});
});

View File

@@ -1,92 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const navigationBarPage = new NavigationBarPage();
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
describe('Thumbnails and tooltips', () => {
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode: NodeEntry;
let folderNode: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
filePdfNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
folderNode = await uploadActions.createFolder(folderName, '-my-');
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
if (filePdfNode) {
await uploadActions.deleteFileOrFolder(filePdfNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFileOrFolder(folderNode.entry.id);
}
});
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260108] Should display tooltip for file\'s name', async () => {
await expect(await contentServicesPage.getDocumentList().getTooltip(pdfFile.name)).toEqual(pdfFile.name);
});
it('[C260109] Should display tooltip for folder\'s name', async () => {
await expect(await contentServicesPage.getDocumentList().getTooltip(folderName)).toEqual(folderName);
});
it('[C274701] Should be able to enable thumbnails', async () => {
await contentServicesPage.enableThumbnails();
await contentServicesPage.checkAcsContainer();
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
await expect(fileIconUrl).toContain(`/versions/1/nodes/${filePdfNode.entry.id}/renditions`);
});
});
});