Fix cancel E2E (#5501)

* fix

* fix upload and remove unused fikes

* fix upload and remove unused fikes

* clean more

* fix cancel test

* unify names

* fix size

* fix cancel

* different timeout
This commit is contained in:
Eugenio Romano
2020-02-26 15:33:45 +00:00
committed by GitHub
parent ae38f3f4ac
commit e74e1e4ade
38 changed files with 61 additions and 1084 deletions

View File

@@ -16,7 +16,7 @@
*/
import { browser } from 'protractor';
import { LoginPage } from '@alfresco/adf-testing';
import { LoginPage, UploadActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../pages/adf/content-services.page';
import { UploadDialogPage } from '../../pages/adf/dialog/upload-dialog.page';
import { UploadTogglesPage } from '../../pages/adf/dialog/upload-toggles.page';
@@ -35,12 +35,18 @@ describe('Upload component', async () => {
const uploadToggles = new UploadTogglesPage();
const loginPage = new LoginPage();
const acsUser = new AcsUserModel();
const uploadActions = new UploadActions(this.alfrescoJsApi);
const pngFileModel = new FileModel({
const pngFile = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const mediumFile = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.MEDIUM_FILE.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.MEDIUM_FILE.file_location
});
const largeFile = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_location
@@ -55,20 +61,32 @@ describe('Upload component', async () => {
await contentServicesPage.goToDocumentList();
});
it('[C272792] Should be possible to cancel upload of a big file using row cancel icon', async () => {
await browser.executeScript('setTimeout(() => {document.querySelector("div[data-automation-id=\'cancel-upload-progress\']").click();}, 2500)');
const deleteNodesInCurrentPage = async function () {
const nodeList = await contentServicesPage.getElementsDisplayedId();
await contentServicesPage.uploadFile(largeFile.location);
for (const node of nodeList) {
try {
await uploadActions.deleteFileOrFolder(node);
} catch (error) {
}
}
};
it('[C272792] Should be possible to cancel upload of a big file using row cancel icon', async () => {
await browser.executeScript(`setTimeout(() => {document.querySelector('div[data-automation-id="cancel-upload-progress"]').click();}, 2500)`);
await contentServicesPage.uploadFile(mediumFile.location);
await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
await contentServicesPage.checkContentIsNotDisplayed(mediumFile.name);
});
it('[C287790] Should be possible to cancel upload of a big file through the cancel uploads button', async () => {
await browser.executeScript(' setTimeout(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 2500)');
await contentServicesPage.uploadFile(largeFile.location);
await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
@@ -78,25 +96,30 @@ describe('Upload component', async () => {
it('[C272793] Should be able to cancel multiple files upload', async () => {
await uploadToggles.enableMultipleFileUpload();
await browser.executeScript(' setTimeout(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 2500)');
await contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]);
await contentServicesPage.uploadMultipleFile([pngFile.location, largeFile.location]);
await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(pngFileModel.name);
await contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
await contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
await uploadToggles.disableMultipleFileUpload();
});
it('[C315257] Should be able to cancel file in upload queue', async () => {
await uploadToggles.enableMultipleFileUpload();
await browser.executeScript('setTimeout(() => {document.querySelector("button[data-automation-id=\'cancel-upload-queue\']").click();}, 3000)');
await contentServicesPage.uploadMultipleFile([largeFile.location, pngFileModel.location]);
await uploadDialog.fileIsCancelled(pngFileModel.name);
await browser.executeScript(`setTimeout(() => {document.querySelector('button[data-automation-id="cancel-upload-queue"]').click();}, 2500)`);
await contentServicesPage.uploadMultipleFile([mediumFile.location, pngFile.location]);
await uploadDialog.fileIsCancelled(pngFile.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableMultipleFileUpload();
await deleteNodesInCurrentPage();
});
});