diff --git a/.vscode/closest-config-finder.sh b/.vscode/closest-config-finder.sh new file mode 100755 index 0000000000..497d824b30 --- /dev/null +++ b/.vscode/closest-config-finder.sh @@ -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"; diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..a3ebaacc00 --- /dev/null +++ b/.vscode/launch.json @@ -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", + "/**/*.js" + ], + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/e2e/content-services/upload/cancel-upload.e2e.ts b/e2e/content-services/upload/cancel-upload.e2e.ts index 06f647972c..61d59db12d 100644 --- a/e2e/content-services/upload/cancel-upload.e2e.ts +++ b/e2e/content-services/upload/cancel-upload.e2e.ts @@ -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(); diff --git a/e2e/pages/adf/dialog/uploadDialog.ts b/e2e/pages/adf/dialog/uploadDialog.ts index cb4d8a952e..5d26e5a8a5 100644 --- a/e2e/pages/adf/dialog/uploadDialog.ts +++ b/e2e/pages/adf/dialog/uploadDialog.ts @@ -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); } diff --git a/scripts/start.sh b/scripts/start.sh index 5d4240c13c..30985a8073 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -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