ADF-5074 - reenabled test on upload (#5470)

This commit is contained in:
Vito 2020-02-12 13:49:09 +00:00 committed by GitHub
parent 72d1fbbc1a
commit 498bc6032a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 50 deletions

17
.vscode/closest-config-finder.sh vendored Executable file
View File

@ -0,0 +1,17 @@
specFile=$1;
configFile=$2;
findconfig() {
if [ -f "$1" ]; then
printf '%s\n' "${PWD%/}/$1"
elif [ "$PWD" = / ]; then
false
else
(cd .. && findconfig $1)
fi
}
DIR=$(dirname "$specFile")
cd $DIR
configFile=`findconfig "$configFile"`;
echo "$configFile";

27
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "e2e",
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
"args": [
"`${workspaceFolder}/.vscode/closest-config-finder.sh ${file} protractor.conf.ts`",
"--specs=${file}"
],
"envFile": "${workspaceFolder}/.env",
"console": "integratedTerminal",
"sourceMaps": true,
"smartStep": true,
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
"<node_internals>/**/*.js"
],
"internalConsoleOptions": "neverOpen"
}
]
}

View File

@ -16,14 +16,13 @@
*/
import { browser } from 'protractor';
import { LoginPage, UploadActions } from '@alfresco/adf-testing';
import { LoginPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { UploadDialog } from '../../pages/adf/dialog/uploadDialog';
import { UploadToggles } from '../../pages/adf/dialog/uploadToggles';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import { FileModel } from '../../models/ACS/fileModel';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
describe('Upload component', async () => {
@ -36,17 +35,12 @@ describe('Upload component', async () => {
const uploadToggles = new UploadToggles();
const loginPage = new LoginPage();
const acsUser = new AcsUserModel();
const uploadActions = new UploadActions(this.alfrescoJsApi);
const navigationBarPage = new NavigationBarPage();
const firstPdfFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_location
});
const pngFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PNG.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
@ -54,31 +48,15 @@ describe('Upload component', async () => {
beforeAll(async () => {
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 loginPage.loginToContentServicesUsingUserModel(acsUser);
await contentServicesPage.goToDocumentList();
const pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, '-my-');
Object.assign(firstPdfFileModel, pdfUploadedFile.entry);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(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();}, 1000)');
await browser.executeScript('setTimeout(() => {document.querySelector("div[data-automation-id=\'cancel-upload-progress\']").click();}, 750)');
await contentServicesPage.uploadFile(largeFile.location);
@ -90,23 +68,20 @@ describe('Upload component', async () => {
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(); }, 500)');
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 750)');
await contentServicesPage.uploadFile(largeFile.location);
await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
});
// tslint:disable-next-line: ban
xit('[C272793] Should be able to cancel multiple files upload', async () => {
await browser.executeScript(' setTimeout(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 500)');
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(); }, 750)');
await contentServicesPage.uploadMultipleFile([pngFileModel.location, largeFile.location]);
await expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
@ -117,7 +92,7 @@ describe('Upload component', async () => {
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();}, 500)');
await browser.executeScript('setTimeout(() => {document.querySelector("button[data-automation-id=\'cancel-upload-queue\']").click();}, 750)');
await contentServicesPage.uploadMultipleFile([largeFile.location, pngFileModel.location]);
await uploadDialog.fileIsCancelled(pngFileModel.name);
await uploadDialog.clickOnCloseButton();

View File

@ -58,13 +58,12 @@ export class UploadDialog {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
getRowsName(content) {
const row: ElementFinder = element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
return row;
getRowsByName(content): ElementFinder {
return element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
}
getRowByRowName(content) {
const rows = this.getRowsName(content);
const rows = this.getRowsByName(content);
return rows.element(this.rowByRowName);
}

View File

@ -174,19 +174,10 @@ if $EXEC_VERSION_JSAPI == true; then
npm install alfresco-js-api@${JSAPI_VERSION}
fi
if $EXEC_TEST == true; then
echo "====== Demo shell Test ====="
npm run test || exit 1
exit 0
fi
if $EXEC_E2E == true; then
echo "====== Demo shell e2e ====="
npm run e2e
exit 0
fi
if $EXEC_START == true; then
if [ -f "./.env" ]; then
export $(cat .env | xargs)
fi
if $EXEC_DEVELOP == true; then
echo "====== Start Demo shell dev mode ====="
npm run start:dev