[ADF-4329][ASD-5330] plus Improve e2e (#6580)

Improve e2e
Fix SSO user avatar 
Fix Priority for APS1
This commit is contained in:
Eugenio Romano
2021-02-05 15:18:30 +00:00
committed by GitHub
parent e4990f4b0c
commit f4976a1949
72 changed files with 649 additions and 442 deletions

View File

@@ -188,6 +188,7 @@ describe('Comment', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
});

View File

@@ -54,8 +54,9 @@ describe('Create library directive', () => {
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
await apiService.getInstance().core.sitesApi.deleteSite(createSite.entry.id, { permanent: true });
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {

View File

@@ -16,8 +16,8 @@
*/
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { NodeEntry } from '@alfresco/js-api';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TrashcanPage } from '../../core/pages/trashcan.page';
@@ -29,7 +29,8 @@ import {
StringUtil,
UploadActions,
UserModel,
UsersActions
UsersActions,
WaitActions
} from '@alfresco/adf-testing';
describe('Restore content directive', () => {
@@ -42,8 +43,10 @@ describe('Restore content directive', () => {
const trashcanPage = new TrashcanPage();
const breadCrumbPage = new BreadcrumbPage();
const notificationHistoryPage = new NotificationHistoryPage();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const waitActions = new WaitActions(apiService);
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
@@ -60,7 +63,7 @@ describe('Restore content directive', () => {
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const folderName = StringUtil.generateRandomString(5);
let testFolder: NodeEntry;
const uploadActions = new UploadActions(apiService);
let folderWithContent, folderWithFolder, subFolder, subFile, testFile, restoreFile, publicSite, siteFolder,
@@ -72,7 +75,7 @@ describe('Restore content directive', () => {
await usersActions.createUser(anotherAcsUser);
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.createFolder(folderName, '-my-');
testFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
folderWithContent = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
subFile = await uploadActions.uploadFile(testFileModel.location, testFileModel.name, folderWithContent.entry.id);
testFile = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, '-my-');
@@ -93,12 +96,12 @@ describe('Restore content directive', () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.deleteContent(folderName);
await contentServicesPage.checkContentIsNotDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await contentServicesPage.deleteContent(testFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFolder.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(folderName);
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(testFolder.entry.name);
});
afterEach(async () => {
@@ -106,26 +109,26 @@ describe('Restore content directive', () => {
});
it('[C260227] Should validate when restoring Folders with same name', async () => {
await uploadActions.createFolder(folderName, '-my-');
await uploadActions.createFolder(testFolder.entry.name, '-my-');
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.deleteContent(folderName);
await contentServicesPage.checkContentIsNotDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await contentServicesPage.deleteContent(testFolder.entry.name);
await contentServicesPage.checkContentIsNotDisplayed(testFolder.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(folderName);
await trashcanPage.getDocumentList().dataTablePage().checkRowContentIsDisplayed(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkAllRows();
await trashcanPage.clickRestore();
await browser.sleep(1000);
await waitActions.nodeIsPresent(testFolder.entry.id);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.getDocumentList().dataTablePage().waitTillContentLoaded();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await notificationHistoryPage.checkNotifyContains('Can\'t restore, ' + folderName + ' item already exists');
await notificationHistoryPage.checkNotifyContains('Can\'t restore, ' + testFolder.entry.name + ' item already exists');
});
});
@@ -222,26 +225,26 @@ describe('Restore content directive', () => {
});
it('[C260241] Should display restore icon both for file and folder', async () => {
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(testFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(restoreFile.entry.name);
await contentServicesPage.deleteContent(folderName);
await contentServicesPage.deleteContent(testFolder.entry.name);
await contentServicesPage.deleteContent(restoreFile.entry.name);
await navigationBarPage.clickTrashcanButton();
await trashcanPage.waitForTableBody();
await trashcanPage.checkRestoreButtonIsNotDisplayed();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(folderName);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(folderName);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(testFolder.entry.name);
await trashcanPage.checkRestoreButtonIsDisplayed();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(folderName);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsNotSelected(folderName);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsNotSelected(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(restoreFile.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(restoreFile.entry.name);
await trashcanPage.checkRestoreButtonIsDisplayed();
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(folderName);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(folderName);
await trashcanPage.getDocumentList().dataTablePage().clickRowByContentCheckbox(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(testFolder.entry.name);
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(restoreFile.entry.name);
await trashcanPage.checkRestoreButtonIsDisplayed();
});
@@ -285,10 +288,11 @@ describe('Restore content directive', () => {
await trashcanPage.getDocumentList().dataTablePage().checkRowByContentIsSelected(publicSite.entry.id);
await trashcanPage.clickRestore();
await browser.sleep(browser.params.testConfig.timeouts.index_search);
await waitActions.nodeIsPresent(publicSite.entry.guid);
await navigationBarPage.goToSite(publicSite);
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(siteFolder.entry.name);
await contentServicesPage.openFolder(siteFolder.entry.name);
await contentServicesPage.checkContentIsDisplayed(siteFile.entry.name);
@@ -301,7 +305,7 @@ describe('Restore content directive', () => {
beforeAll(async () => {
await apiService.login(anotherAcsUser.username, anotherAcsUser.password);
await uploadActions.createFolder(folderName, '-my-');
await uploadActions.createFolder(testFolder.entry.name, '-my-');
parentFolder = await uploadActions.createFolder(StringUtil.generateRandomString(5), '-my-');
folderWithin = await uploadActions.createFolder(StringUtil.generateRandomString(5), parentFolder.entry.id);
pdfFile = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, folderWithin.entry.id);
@@ -356,4 +360,5 @@ describe('Restore content directive', () => {
await contentServicesPage.checkContentIsDisplayed(pngFile.entry.name);
});
});
});

View File

@@ -338,6 +338,7 @@ describe('Document List Component', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
for (let i = 0; i < folderCreated.length; i++) {
await uploadActions.deleteFileOrFolder(folderCreated[i].entry.id);
}

View File

@@ -47,6 +47,7 @@ describe('Document List Component', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await navigationBarPage.clickLogoutButton();
await apiService.getInstance().core.sitesApi.deleteSite(privateSite.entry.id, { permanent: true });
});

View File

@@ -15,12 +15,21 @@
* limitations under the License.
*/
import { ApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import {
ApiService,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
WaitActions
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../core/pages/content-services.page';
import { LockFilePage } from '../content-services/pages/lock-file.page';
import { FileModel } from '../models/ACS/file.model';
import { browser } from 'protractor';
import { NodeEntry } from '@alfresco/js-api';
import CONSTANTS = require('../util/constants');
describe('Lock File', () => {
@@ -29,12 +38,13 @@ describe('Lock File', () => {
const navigationBarPage = new NavigationBarPage();
const lockFilePage = new LockFilePage();
const contentServices = new ContentServicesPage();
const adminUser = new UserModel();
const managerUser = new UserModel();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const waitActions = new WaitActions(apiService);
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
@@ -46,7 +56,7 @@ describe('Lock File', () => {
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_path
});
let nodeId, site, documentLibrary, lockedFileNodeId;
let site, documentLibrary;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
@@ -72,35 +82,54 @@ describe('Lock File', () => {
});
afterAll(async () => {
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
await apiService.loginWithProfile('admin');
try {
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
} catch (e) {
}
});
describe('Lock file interaction with the UI', () => {
let pngLockedUploadedFile: NodeEntry;
let pngUploadedFile: NodeEntry;
beforeAll(async () => {
const pngLockedUploadedFile = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
pngLockedUploadedFile = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
lockedFileNodeId = pngLockedUploadedFile.entry.id;
});
beforeEach(async () => {
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.login(adminUser.username, adminUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await navigationBarPage.openContentServicesFolder(documentLibrary);
await contentServices.waitForTableBody();
});
afterEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
await uploadActions.deleteFileOrFolder(nodeId);
await navigationBarPage.clickLogoutButton();
try {
await apiService.getInstance().core.nodesApi.unlockNode(pngUploadedFile.entry.id);
await waitActions.nodeIsUnlock(pngUploadedFile.entry.id);
} catch (e) {
}
});
afterAll(async () => {
await apiService.login(adminUser.username, adminUser.password);
await apiService.getInstance().core.nodesApi.unlockNode(lockedFileNodeId);
await uploadActions.deleteFileOrFolder(lockedFileNodeId);
await apiService.loginWithProfile('admin');
try {
await apiService.getInstance().core.nodesApi.unlockNode(pngLockedUploadedFile.entry.id);
} catch (e) {
}
try {
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
} catch (e) {
}
try {
await uploadActions.deleteFileOrFolder(pngLockedUploadedFile.entry.id);
} catch (e) {
}
await navigationBarPage.clickLogoutButton();
});
it('[C286604] Should be able to open Lock file option by clicking the lock image', async () => {
@@ -113,7 +142,6 @@ describe('Lock File', () => {
it('[C286625] Should be able to click Cancel to cancel lock file operation', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.cancelButton.click();
@@ -149,11 +177,11 @@ describe('Lock File', () => {
describe('Locked file without owner permissions', () => {
let pngUploadedFile: NodeEntry;
beforeEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await loginPage.login(managerUser.username, managerUser.password);
@@ -164,8 +192,8 @@ describe('Lock File', () => {
await apiService.login(adminUser.username, adminUser.password);
try {
await apiService.getInstance().core.nodesApi.unlockNode(nodeId);
await uploadActions.deleteFileOrFolder(nodeId);
await apiService.getInstance().core.nodesApi.unlockNode(pngUploadedFile.entry.id);
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
} catch (error) {
}
await navigationBarPage.clickLogoutButton();
@@ -179,7 +207,7 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.deleteNode(nodeId);
await apiService.getInstance().core.nodesApi.deleteNode(pngUploadedFile.entry.id);
} catch (error) {
await expect(error.status).toEqual(409);
}
@@ -193,7 +221,7 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
await apiService.getInstance().core.nodesApi.updateNode(pngUploadedFile.entry.id, { name: 'My new name' });
} catch (error) {
await expect(error.status).toEqual(409);
@@ -208,7 +236,7 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
await apiService.getInstance().core.nodesApi.moveNode(pngUploadedFile.entry.id, { targetParentId: '-my-' });
} catch (error) {
await expect(error.status).toEqual(409);
@@ -223,8 +251,7 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
await apiService.getInstance().core.nodesApi.updateNodeContent(pngUploadedFile.entry.id, 'NEW FILE CONTENT');
} catch (error) {
await expect(error.status).toEqual(409);
}
@@ -232,39 +259,26 @@ describe('Lock File', () => {
});
describe('Locked file with owner permissions', () => {
let pngFileToBeLocked;
beforeAll(async () => {
pngFileToBeLocked = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
lockedFileNodeId = pngFileToBeLocked.entry.id;
});
let pngFileToBeLocked: NodeEntry;
let pngUploadedFile: NodeEntry;
beforeEach(async () => {
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await apiService.login(adminUser.username, adminUser.password);
pngFileToBeLocked = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
await loginPage.login(adminUser.username, adminUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
await contentServices.getDocumentList().dataTable.waitTillContentLoaded();
});
afterEach(async () => {
await apiService.login(adminUser.username, adminUser.password);
await uploadActions.deleteFileOrFolder(nodeId);
await navigationBarPage.clickLogoutButton();
});
it('[C286614] Owner of the locked file should be able to rename if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
const response = await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
await expect(response.entry.name).toEqual('My new name');
} catch (error) {
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
await uploadActions.deleteFileOrFolder(pngFileToBeLocked.entry.id);
} catch (e) {
}
await navigationBarPage.clickLogoutButton();
});
it('[C286615] Owner of the locked file should be able to update a new version if Allow owner to modify is checked', async () => {
@@ -276,7 +290,9 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
const response = await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
await apiService.login(adminUser.username, adminUser.password);
const response = await apiService.getInstance().core.nodesApi.updateNodeContent(pngUploadedFile.entry.id, 'NEW FILE CONTENT');
await expect(response.entry.modifiedAt.getTime()).toBeGreaterThan(response.entry.createdAt.getTime());
} catch (error) {
}
@@ -291,9 +307,10 @@ describe('Lock File', () => {
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
await apiService.login(adminUser.username, adminUser.password);
await apiService.getInstance().core.nodesApi.moveNode(pngUploadedFile.entry.id, { targetParentId: '-my-' });
const movedFile = await apiService.getInstance().core.nodesApi.getNode(nodeId);
const movedFile = await apiService.getInstance().core.nodesApi.getNode(pngUploadedFile.entry.id);
await expect(movedFile.entry.parentId).not.toEqual(documentLibrary);
} catch (error) {
@@ -311,5 +328,20 @@ describe('Lock File', () => {
await contentServices.deleteContent(pngFileToBeLocked.entry.name);
await contentServices.checkContentIsNotDisplayed(pngFileToBeLocked.entry.name);
});
it('[C286614] Owner of the locked file should be able to rename if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
const response = await apiService.getInstance().core.nodesApi.updateNode(pngUploadedFile.entry.id, { name: 'My new name' });
await expect(response.entry.name).toEqual('My new name');
} catch (error) {
}
});
});
});

View File

@@ -95,6 +95,7 @@ describe('permissions', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
});

View File

@@ -228,9 +228,10 @@ describe('Metadata component', () => {
describe('Folder metadata', () => {
beforeAll(async () => {
await uploadActions.createFolder(folderName, '-my-');
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
await uploadActions.createFolder(folderName, '-my-');
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});

View File

@@ -65,12 +65,28 @@ export class TagPage {
return this.addTagButton.isEnabled();
}
checkTagIsDisplayedInTagList(tagName: string): Promise<void> {
return TestElement.byText('div[id*="tag_name"]', tagName).waitVisible();
async checkTagIsDisplayedInTagList(tagName: string): Promise<boolean> {
try {
await TestElement.byText('div[id*="tag_name"]', tagName).waitVisible();
return true;
} catch (error) {
if (await this.showMoreButton.isDisplayed()) {
await this.showMoreButton.click();
await this.checkTagIsDisplayedInTagList(tagName);
return true;
} else {
throw new Error('Error');
}
}
}
checkTagIsNotDisplayedInTagList(tagName: string): Promise<void> {
return TestElement.byText('div[id*="tag_name"]', tagName).waitNotVisible();
async checkTagIsNotDisplayedInTagList(tagName: string): Promise<boolean> {
try {
await TestElement.byText('div[id*="tag_name"]', tagName).waitNotVisible();
return true;
} catch (error) {
return false;
}
}
checkTagIsNotDisplayedInTagListByNodeId(tagName: string): Promise<void> {

View File

@@ -95,7 +95,7 @@ describe('Permissions Component', () => {
await usersActions.createUser(managerUser);
await apiService.login(folderOwnerUser.username, folderOwnerUser.password);
await browser.sleep(15000);
await browser.sleep(browser.params.testConfig.timeouts.index_search);
const publicSiteName = `PUBLIC_TEST_SITE_${StringUtil.generateRandomString(5)}`;

View File

@@ -174,6 +174,7 @@ describe('Share file', () => {
});
afterEach(async () => {
await BrowserActions.getUrl('/');
await navigationBarPage.clickLogoutButton();
});

View File

@@ -27,6 +27,7 @@ import {
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { NodeEntry } from '@alfresco/js-api';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { ShareDialogPage } from '../../core/pages/dialog/share-dialog.page';
@@ -35,23 +36,23 @@ import { browser } from 'protractor';
describe('Unshare file', () => {
const apiService = new ApiService();
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const contentListPage = contentServicesPage.getDocumentList();
const navBar = new NavigationBarPage();
const errorPage = new ErrorPage();
const notificationHistoryPage = new NotificationHistoryPage();
const navigationBarPage = new NavigationBarPage();
const shareDialog = new ShareDialogPage();
const apiService = new ApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const siteName = `PRIVATE-TEST-SITE-${StringUtil.generateRandomString(5)}`;
let acsUser: UserModel;
let nodeBody, nodeId, testSite;
let nodeBody, shareFilesSite;
let pngUploadedFile: NodeEntry;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
@@ -76,7 +77,7 @@ describe('Unshare file', () => {
}
};
testSite = await apiService.getInstance().core.sitesApi.createSite(site);
shareFilesSite = await apiService.getInstance().core.sitesApi.createSite(site);
const docLibId = (await apiService.getInstance().core.sitesApi.getSiteContainers(siteName)).list.entries[0].entry.id;
const testFile1Id = (await apiService.getInstance().core.nodesApi.addNode(docLibId, nodeBody)).entry.id;
@@ -97,38 +98,33 @@ describe('Unshare file', () => {
}
});
await apiService.getInstance().core.sharedlinksApi.addSharedLink({ nodeId: testFile1Id });
await apiService.login(acsUser.username, acsUser.password);
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
nodeId = pngUploadedFile.entry.id;
await loginPage.login(acsUser.username, acsUser.password);
await navBar.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.getInstance().core.sitesApi.deleteSite(testSite.entry.id, { permanent: true });
await apiService.getInstance().core.sitesApi.deleteSite(shareFilesSite.entry.id, { permanent: true });
});
describe('with permission', () => {
afterAll(async () => {
afterEach(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(nodeId);
await navigationBarPage.clickLogoutButton();
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
});
it('[C286550] Should display unshare confirmation dialog', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await browser.sleep(2000);
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await navBar.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
it('[C286551] Should be able to cancel unshare action', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickUnShareFile();
@@ -137,8 +133,17 @@ describe('Unshare file', () => {
await shareDialog.shareToggleButtonIsChecked();
});
it('[C286550] Should display unshare confirmation dialog', async () => {
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await browser.sleep(2000);
await shareDialog.clickUnShareFile();
await shareDialog.confirmationDialogIsDisplayed();
});
it('[C286552] Should be able to confirm unshare action', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickUnShareFile();
@@ -148,7 +153,7 @@ describe('Unshare file', () => {
});
it('[C280556] Should redirect to 404 when trying to access an unshared file', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.getDocumentList().selectRow(pngFileModel.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await browser.sleep(2000);
@@ -165,15 +170,14 @@ describe('Unshare file', () => {
describe('without permission', () => {
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().core.sitesApi.deleteSite(siteName, { permanent: true });
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C286555] Should NOT be able to unshare file without permission', async () => {
await navBar.goToSite(testSite);
await navBar.goToSite(shareFilesSite);
await contentServicesPage.openFolder('documentLibrary');
await contentListPage.selectRow(nodeBody.name);
await contentServicesPage.getDocumentList().selectRow(nodeBody.name);
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();

View File

@@ -128,21 +128,6 @@ describe('Social component', () => {
await navigationBarPage.clickLogoutButton();
});
it('[C260324] Should be able to like and unlike a component', async () => {
await socialPage.writeCustomNodeId(emptyFile.entry.id);
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
await likePage.checkLikeCounter(0);
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
await likePage.clickLike();
await likePage.checkLikeCounter(1);
await likePage.removeHoverFromLikeButton();
await expect(await likePage.getLikedIconColor()).toBe(blueLikeColor);
await likePage.clickUnlike();
await likePage.checkLikeCounter(0);
await likePage.removeHoverFromLikeButton();
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
});
it('[C310198] Should be able to rate and unRate a component', async () => {
await socialPage.writeCustomNodeId(emptyFile.entry.id);
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);

View File

@@ -58,42 +58,43 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList
let pdfUploadedFile, pngUploadedFile, folder, acsUser;
const folderName = StringUtil.generateRandomString(5);
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
folder = await uploadActions.createFolder(folderName, '-my-');
pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id);
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost, false, true, browser.params.testConfig.appConfig.oauth2.clientId);
await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.checkAcsContainer();
await contentServicesPage.openFolder(folderName);
await contentListPage.waitForTableBody();
});
afterAll(async () => {
try {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(folder.entry.id);
await identityService.deleteIdentityUser(acsUser.email);
} catch (error) {
}
await apiService.getInstance().logout();
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
describe('SSO in ADF using ACS and AIS, implicit flow set', () => {
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
folder = await uploadActions.createFolder(folderName, '-my-');
pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id);
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost, false, true, browser.params.testConfig.appConfig.oauth2.clientId);
await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.checkAcsContainer();
await contentServicesPage.openFolder(folderName);
await contentListPage.waitForTableBody();
});
afterAll(async () => {
try {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(folder.entry.id);
await identityService.deleteIdentityUser(acsUser.email);
} catch (error) {
}
await apiService.getInstance().logout();
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
afterEach(async () => {
await browser.refresh();

View File

@@ -125,14 +125,13 @@ describe('Upload - User permission', () => {
describe('full permissions', () => {
beforeEach(async () => {
await apiService.loginWithProfile('admin');
await navigationBarPage.openContentServicesFolder(managerSite.entry.guid);
await contentServicesPage.goToDocumentList();
});
it('[C279917] Should be allowed to upload a file in a folder with manager permissions', async () => {
await contentServicesPage.uploadFile(emptyFile.location);
await uploadDialog.fileIsUploaded(emptyFile.name);
});
});

View File

@@ -144,6 +144,7 @@ describe('Version component permissions', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().nodes.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});
@@ -215,6 +216,7 @@ describe('Version component permissions', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().nodes.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});
@@ -269,6 +271,7 @@ describe('Version component permissions', () => {
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await apiService.getInstance().nodes.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});