From ad58be3d05c070e8ec8af4f1bbf705b435caa0d0 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 4 Dec 2020 12:39:39 +0000 Subject: [PATCH] Rebalance suites conf to be less error prone (#1819) * rebalance suites conf to be less error prone * shared api - wait for specific files instead of totalItems * remove unused * - make search api wait calls more stable on parallel runs - remove not needed workaround from closeMoreMenu * reorganize test suites a few more test stabilisations * improve copy tests for parallel running * more changes to consider parallel running Co-authored-by: Adina Parpalita --- .travis.yml | 72 +++++++-- e2e/protractor.excludes.json | 5 +- .../files-folders/folders-actions.test.ts | 11 +- .../{ => files-folders}/generic.test.ts | 9 +- .../locked-files-actions.test.ts | 98 +------------ .../multiple-files-actions.test.ts | 50 +++++-- .../office-files-actions.test.ts | 138 +----------------- .../files-folders/single-file-actions.test.ts | 4 +- .../files-folders/test-data.ts | 40 ++--- .../files-folders/trash.test.ts | 1 + .../new-menu}/new-menu.test.ts | 0 .../special-permissions/search-results.ts | 16 +- .../special-permissions-actions.test.ts | 14 +- .../test-data-permissions.ts | 36 ++--- .../special-permissions/viewer.ts | 3 +- e2e/suites/actions/copy-move/copy.test.ts | 133 ++++++++--------- .../destination-picker-dialog.test.ts | 1 + e2e/suites/actions/copy-move/move.test.ts | 7 +- .../create-file-from-template.test.ts | 0 .../create-folder-from-template.test.ts | 1 + .../{ => create}/create-folder.test.ts | 0 .../{ => create}/create-library.test.ts | 14 +- .../{ => delete}/delete-undo-delete.test.ts | 3 +- .../{ => delete}/permanently-delete.test.ts | 0 .../actions/{ => delete}/restore.test.ts | 0 .../actions/{ => edit}/edit-folder.test.ts | 22 ++- .../actions/{ => edit}/edit-offline.test.ts | 24 +-- .../{ => favorite}/mark-favorite.test.ts | 36 +++-- .../{ => library}/library-actions.test.ts | 2 +- .../actions/{ => share}/share-file.test.ts | 112 +++----------- .../unshare-file-search-results.test.ts | 20 +-- .../actions/{ => share}/unshare-file.test.ts | 55 ++----- .../{ => upload-download}/download.test.ts | 49 +++---- .../{ => upload-download}/upload-file.test.ts | 4 +- .../upload-new-version.test.ts | 20 ++- .../version-actions.test.ts | 116 +++++++-------- e2e/suites/authentication/login.test.ts | 28 +--- e2e/suites/info-drawer/comments.test.ts | 3 +- e2e/suites/list-views/permissions.test.ts | 13 +- e2e/suites/list-views/shared-files.test.ts | 14 +- e2e/suites/list-views/tooltips.test.ts | 44 +----- e2e/suites/list-views/trash.test.ts | 76 +++++----- e2e/suites/navigation/breadcrumb.test.ts | 3 + e2e/suites/navigation/single-click.test.ts | 3 +- .../pagination/multiple-pages-files.test.ts | 4 +- e2e/suites/pagination/single-page.test.ts | 3 +- .../search-results-files-folders.test.ts | 19 +-- .../search/search-results-general.test.ts | 17 ++- .../search/search-results-libraries.test.ts | 81 +++++----- e2e/suites/search/search-sorting.test.ts | 8 +- e2e/suites/viewer/viewer-actions.test.ts | 14 +- e2e/suites/viewer/viewer-general.test.ts | 5 +- .../dialog/manage-versions-dialog.ts | 13 ++ .../src/components/toolbar/toolbar.ts | 11 +- .../version-manage/version-manager.ts | 40 ----- .../repo-client/apis/nodes/nodes-api.ts | 17 ++- .../apis/shared-links/shared-links-api.ts | 58 +++++++- .../repo-client/apis/sites/sites-api.ts | 19 +++ protractor.conf.js | 99 ++++++------- .../favorites/favorites.component.spec.ts | 28 +--- .../preview/preview.component.spec.ts | 46 ------ .../recent-files.component.spec.ts | 28 +--- .../shared-files.component.spec.ts | 135 ----------------- .../sidenav/sidenav.component.spec.ts | 2 +- tslint.json | 4 +- 65 files changed, 745 insertions(+), 1206 deletions(-) rename e2e/suites/actions-available/{ => files-folders}/generic.test.ts (98%) rename e2e/suites/{actions => actions-available/new-menu}/new-menu.test.ts (100%) rename e2e/suites/actions/{ => create}/create-file-from-template.test.ts (100%) rename e2e/suites/actions/{ => create}/create-folder-from-template.test.ts (99%) rename e2e/suites/actions/{ => create}/create-folder.test.ts (100%) rename e2e/suites/actions/{ => create}/create-library.test.ts (96%) rename e2e/suites/actions/{ => delete}/delete-undo-delete.test.ts (99%) rename e2e/suites/actions/{ => delete}/permanently-delete.test.ts (100%) rename e2e/suites/actions/{ => delete}/restore.test.ts (100%) rename e2e/suites/actions/{ => edit}/edit-folder.test.ts (95%) rename e2e/suites/actions/{ => edit}/edit-offline.test.ts (93%) rename e2e/suites/actions/{ => favorite}/mark-favorite.test.ts (96%) rename e2e/suites/actions/{ => library}/library-actions.test.ts (99%) rename e2e/suites/actions/{ => share}/share-file.test.ts (89%) rename e2e/suites/actions/{ => share}/unshare-file-search-results.test.ts (92%) rename e2e/suites/actions/{ => share}/unshare-file.test.ts (92%) rename e2e/suites/actions/{ => upload-download}/download.test.ts (88%) rename e2e/suites/actions/{ => upload-download}/upload-file.test.ts (94%) rename e2e/suites/actions/{ => upload-download}/upload-new-version.test.ts (98%) rename e2e/suites/actions/{ => upload-download}/version-actions.test.ts (74%) delete mode 100644 projects/aca-testing-shared/src/components/version-manage/version-manager.ts delete mode 100644 src/app/components/shared-files/shared-files.component.spec.ts diff --git a/.travis.yml b/.travis.yml index 76ddf44b5..97c61aeb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ install: echo "no install" stages: - name: Quality and Unit tests - name: Publish Docker Registry - if: (type = push AND tag IS blank) OR type = api + if: (type = push AND tag IS blank) OR type = api - name: Release Libraries if: branch = master AND type = push - name: Release Tag @@ -83,10 +83,18 @@ jobs: cache: false - stage: e2e - name: 'Test Suites: authentication,listViews,navigation,application,search' + name: 'Test Suites: authentication,listViews,navigation,application' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=authentication,listViews,navigation,application,search" + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=authentication,listViews,navigation,application" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - stage: e2e + name: 'Test Suites: search' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=search" after_script: - ./scripts/ci/job_hooks/after_e2e.sh @@ -98,31 +106,73 @@ jobs: after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: actionsAvailable' + - name: 'Test Suites: actionsAvailableFilesFolders' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailable" + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableFilesFolders" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: addRemoveContent' + - name: 'Test Suites: actionsAvailableLibraries,actionsAvailableNewMenu' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=addRemoveContent" + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableLibraries,actionsAvailableNewMenu" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: manageContent' + - name: 'Test Suites: actionsAvailableSpecialPermissions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=manageContent" + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableSpecialPermissions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suite: sharingContent' + - name: 'Test Suites: copyMoveActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=sharingContent" + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=copyMoveActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: createActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=createActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: deleteActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=deleteActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: editActions,favoriteActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=editActions,favoriteActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: libraryActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=libraryActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: shareActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=shareActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - name: 'Test Suites: uploadDownloadActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=uploadDownloadActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index 138fd649e..6087d63a1 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -1,3 +1,6 @@ { - "C269007" : "EXIF aspect missing on latest ACS" + "C306956": "https://alfresco.atlassian.net/browse/ACA-4196", + "C286314": "https://alfresco.atlassian.net/browse/ACA-2176", + "C213107": "https://alfresco.atlassian.net/browse/ACA-4197", + "C269007": "ACS-938 - EXIF aspect missing on latest ACS" } diff --git a/e2e/suites/actions-available/files-folders/folders-actions.test.ts b/e2e/suites/actions-available/files-folders/folders-actions.test.ts index 97b44bd91..66f26fd99 100755 --- a/e2e/suites/actions-available/files-folders/folders-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/folders-actions.test.ts @@ -28,9 +28,10 @@ import * as testData from './test-data'; import * as testUtil from '../test-util'; describe('Folders - available actions : ', () => { - const random = Utils.random(); - const username = `user-${random}`; - const parentName = `parent-${random}`; + const random = testData.random; + + const username = `user-${Utils.random()}`; + const parentName = `parent-${Utils.random()}`; let parentId: string; let folderFavId: string; @@ -151,7 +152,7 @@ describe('Folders - available actions : ', () => { beforeAll(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('folderActions-'); + await searchInput.searchFor(random); await searchResultsPage.waitForResults(); }); @@ -169,7 +170,7 @@ describe('Folders - available actions : ', () => { describe('on multiple selection', () => { it('[C291821] multiple folders', async () => { await searchInput.clickSearchButton(); - await searchInput.searchFor('folderActions-'); + await searchInput.searchFor(random); await searchResultsPage.waitForResults(); await testUtil.checkMultipleSelContextMenu([testData.folder.name, testData.folderFav.name], testData.multipleSel.searchContextMenu); diff --git a/e2e/suites/actions-available/generic.test.ts b/e2e/suites/actions-available/files-folders/generic.test.ts similarity index 98% rename from e2e/suites/actions-available/generic.test.ts rename to e2e/suites/actions-available/files-folders/generic.test.ts index 0bbadae91..2a9b2a1f0 100755 --- a/e2e/suites/actions-available/generic.test.ts +++ b/e2e/suites/actions-available/files-folders/generic.test.ts @@ -33,8 +33,8 @@ describe('Generic tests : ', () => { const parent = `parent-${random}`; - const file1 = `file1-${random}.txt`; - const file2 = `file2-${random}.txt`; + const file1 = `file-${random}-1.txt`; + const file2 = `file-${random}-2.txt`; const folder1 = `my-folder1-${random}`; const folder2 = `my-folder2-${random}`; @@ -57,9 +57,7 @@ describe('Generic tests : ', () => { beforeAll(async () => { await adminApiActions.createUser({ username }); - await userApi.nodes.createContent(content); - await loginPage.loginWith(username); }); @@ -132,7 +130,8 @@ describe('Generic tests : ', () => { }); it('[C280447] on Recent Files', async () => { - await userApi.search.waitForApi(username, { expect: 2 }); + await userApi.search.waitForNodes(`file-${random}`, { expect: 2 }); + await page.clickRecentFilesAndWait(); expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); }); diff --git a/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts b/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts index 5eae1f18e..dbbc87b60 100755 --- a/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts @@ -28,9 +28,10 @@ import * as testData from './test-data'; import * as testUtil from '../test-util'; describe('Locked Files - available actions : ', () => { - const random = Utils.random(); - const username = `user-${random}`; - const parentName = `parent-${random}`; + const random = testData.random; + + const username = `user-${Utils.random()}`; + const parentName = `parent-${Utils.random()}`; let parentId: string; let fileLockedId: string; @@ -64,15 +65,15 @@ describe('Locked Files - available actions : ', () => { await userApi.favorites.addFavoritesByIds('file', [fileFavLockedId, fileSharedFavLockedId]); await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 }); - const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); await userApi.shared.shareFilesByIds([fileSharedLockedId, fileSharedFavLockedId]); - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 2 }); await userApi.nodes.lockFile(fileLockedId); await userApi.nodes.lockFile(fileFavLockedId); await userApi.nodes.lockFile(fileSharedLockedId); await userApi.nodes.lockFile(fileSharedFavLockedId); + await userApi.shared.waitForFilesToBeShared([fileSharedLockedId, fileSharedFavLockedId]); + await loginPage.loginWith(username); }); @@ -122,21 +123,6 @@ describe('Locked Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple locked files - [C326688]', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileLocked.name, testData.fileSharedFavLocked.name], testData.multipleSel.contextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Personal Files : ', () => { it('File locked - [C291832]', async () => { await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); @@ -193,24 +179,6 @@ describe('Locked Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple locked files - [C297631]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileFavLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSelAllFav.favoritesContextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileFavLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSelAllFav.toolbarPrimary, - // testData.multipleSelAllFav.favoritesToolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Favorites : ', () => { it('File favorite, locked - [C326707]', async () => { await testUtil.checkViewerActions( @@ -265,21 +233,6 @@ describe('Locked Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple locked files - [C297624]', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileLocked.name, testData.fileSharedFavLocked.name], testData.multipleSel.contextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Recent Files : ', () => { it('File locked - [C326698]', async () => { await testUtil.checkViewerActions(testData.fileLocked.name, testData.fileLocked.viewerToolbarPrimary, testData.fileLocked.viewerToolbarMore); @@ -315,7 +268,8 @@ describe('Locked Files - available actions : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('fileActions-'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(random); await searchResultsPage.waitForResults(); }); @@ -353,24 +307,6 @@ describe('Locked Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('[C297626] multiple locked files', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.searchContextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.searchToolbarPrimary, - // testData.multipleSel.searchToolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Search Results : ', () => { it('File locked - [C326722]', async () => { await testUtil.checkViewerActions( @@ -431,24 +367,6 @@ describe('Locked Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple locked files - [C297623]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileSharedLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.contextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileSharedLocked.name, testData.fileSharedFavLocked.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Shared Files : ', () => { it('File shared, locked - [C326712]', async () => { await testUtil.checkViewerActions( diff --git a/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts b/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts index c46665164..6ee0e8686 100755 --- a/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts @@ -29,18 +29,21 @@ import * as testUtil from '../test-util'; describe('Multiple Files - available actions : ', () => { const random = Utils.random(); + const username = `user-${random}`; const parentName = `parent-${random}`; let parentId: string; - const file1 = `fileActions-1-${random}.txt`; + const file1 = `file-1-${random}.txt`; let file1Id: string; - const file2 = `fileActions-2-${random}.txt`; + const file2 = `file-2-${random}.txt`; let file2Id: string; - const file1LockedFav = `fileActions-lockedFav1-${random}.txt`; + const file3Locked = `file-3-locked-${random}.txt`; + let file3LockedId: string; + const file1LockedFav = `file-lockedFav1-${random}.txt`; let file1LockedFavId: string; - const file2LockedFav = `fileActions-lockedFav2-${random}.txt`; + const file2LockedFav = `file-lockedFav2-${random}.txt`; let file2LockedFavId: string; const userApi = new RepoClient(username, username); @@ -62,25 +65,26 @@ describe('Multiple Files - available actions : ', () => { file1Id = (await userApi.nodes.createFile(file1, parentId)).entry.id; file2Id = (await userApi.nodes.createFile(file2, parentId)).entry.id; + file3LockedId = (await userApi.nodes.createFile(file3Locked, parentId)).entry.id; file1LockedFavId = (await userApi.nodes.createFile(file1LockedFav, parentId)).entry.id; file2LockedFavId = (await userApi.nodes.createFile(file2LockedFav, parentId)).entry.id; await userApi.nodes.lockFile(file1LockedFavId); await userApi.nodes.lockFile(file2LockedFavId); + await userApi.nodes.lockFile(file3LockedId); const initialFavoritesTotalItems = (await userApi.favorites.getFavoritesTotalItems()) || 0; await userApi.favorites.addFavoritesByIds('file', [file1LockedFavId, file2LockedFavId]); await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 }); - const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); - await userApi.shared.shareFilesByIds([file1Id, file2Id, file1LockedFavId, file2LockedFavId]); - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await userApi.shared.shareFilesByIds([file1Id, file2Id, file3LockedId, file1LockedFavId, file2LockedFavId]); + await userApi.shared.waitForFilesToBeShared([file1Id, file2Id, file3LockedId, file1LockedFavId, file2LockedFavId]); await loginPage.loginWith(username); }); afterAll(async () => { - await userActions.unlockNodes([file1LockedFavId, file2LockedFavId]); + await userActions.unlockNodes([file1LockedFavId, file2LockedFavId, file3LockedId]); await userActions.deleteNodes([parentId]); }); @@ -108,6 +112,15 @@ describe('Multiple Files - available actions : ', () => { testData.multipleSelAllFav.toolbarMore ); }); + + it('multiple locked files - [C326688]', async () => { + await testUtil.checkMultipleSelContextMenu([file3Locked, file1LockedFav], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions( + [file3Locked, file1LockedFav], + testData.multipleSel.toolbarPrimary, + testData.multipleSel.toolbarMore + ); + }); }); describe('on Favorites : ', () => { @@ -151,7 +164,8 @@ describe('Multiple Files - available actions : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('fileActions-'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(random); await searchResultsPage.waitForResults(); }); @@ -172,6 +186,15 @@ describe('Multiple Files - available actions : ', () => { testData.multipleSelAllFav.searchToolbarMore ); }); + + it('[C297626] multiple locked files', async () => { + await testUtil.checkMultipleSelContextMenu([file3Locked, file1LockedFav], testData.multipleSel.searchContextMenu); + await testUtil.checkMultipleSelToolbarActions( + [file3Locked, file1LockedFav], + testData.multipleSel.searchToolbarPrimary, + testData.multipleSel.searchToolbarMore + ); + }); }); describe('on Shared Files : ', () => { @@ -193,5 +216,14 @@ describe('Multiple Files - available actions : ', () => { testData.multipleSelAllFav.toolbarMore ); }); + + it('multiple locked files - [C297623]', async () => { + await testUtil.checkMultipleSelContextMenu([file3Locked, file1LockedFav], testData.multipleSel.contextMenu); + await testUtil.checkMultipleSelToolbarActions( + [file3Locked, file1LockedFav], + testData.multipleSel.toolbarPrimary, + testData.multipleSel.toolbarMore + ); + }); }); }); diff --git a/e2e/suites/actions-available/files-folders/office-files-actions.test.ts b/e2e/suites/actions-available/files-folders/office-files-actions.test.ts index f0225a5d5..3790ebc45 100755 --- a/e2e/suites/actions-available/files-folders/office-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/office-files-actions.test.ts @@ -28,9 +28,10 @@ import * as testData from './test-data'; import * as testUtil from '../test-util'; describe('Office Files - available actions : ', () => { - const random = Utils.random(); - const username = `user-${random}`; - const parentName = `parent-${random}`; + const random = testData.random; + + const username = `user-${Utils.random()}`; + const parentName = `parent-${Utils.random()}`; let parentId: string; let fileDocxFavId: string; @@ -63,9 +64,8 @@ describe('Office Files - available actions : ', () => { await userApi.favorites.addFavoritesByIds('file', [fileDocxFavId, fileDocxSharedFavId]); await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 }); - const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); await userApi.shared.shareFilesByIds([fileDocxSharedId, fileDocxSharedFavId]); - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 2 }); + await userApi.shared.waitForFilesToBeShared([fileDocxSharedId, fileDocxSharedFavId]); await loginPage.loginWith(username); }); @@ -141,33 +141,6 @@ describe('Office Files - available actions : ', () => { ); }); }); - - // describe('on multiple selection', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple files - [C217112]', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileDocx.name, testData.fileDocxSharedFav.name], testData.multipleSel.contextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocx.name, testData.fileDocxSharedFav.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - - // it('multiple files - all favorite - [C297619]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.contextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSelAllFav.toolbarMore - // ); - // }); - // }); }); describe('on Favorites : ', () => { @@ -191,24 +164,6 @@ describe('Office Files - available actions : ', () => { }); }); - // describe('multiple selection : ', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple files - [C280656]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.favoritesContextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.toolbarPrimary, - // testData.multipleSelAllFav.favoritesToolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Favorites : ', () => { it('File Office, favorite - [C326702]', async () => { await testUtil.checkViewerActions( @@ -259,33 +214,6 @@ describe('Office Files - available actions : ', () => { }); }); - // describe('on multiple selection', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple files - [C280468]', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileDocxFav.name, testData.fileDocxShared.name], testData.multipleSel.contextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxFav.name, testData.fileDocxShared.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - - // it('multiple files - all favorite - [C326689]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.contextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSelAllFav.toolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Recent Files : ', () => { it('File Office - [C297599]', async () => { await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.viewerToolbarMore); @@ -321,7 +249,7 @@ describe('Office Files - available actions : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('fileActions-'); + await searchInput.searchFor(random); await searchResultsPage.waitForResults(); }); @@ -359,33 +287,6 @@ describe('Office Files - available actions : ', () => { }); }); - // describe('on multiple selection', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('[C291820] multiple files', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileDocx.name, testData.fileDocxShared.name], testData.multipleSel.searchContextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocx.name, testData.fileDocxShared.name], - // testData.multipleSel.searchToolbarPrimary, - // testData.multipleSel.searchToolbarMore - // ); - // }); - - // it('[C326690] multiple files - all favorite', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.searchContextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxFav.name, testData.fileDocxSharedFav.name], - // testData.multipleSelAllFav.searchToolbarPrimary, - // testData.multipleSelAllFav.searchToolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Search Results : ', () => { it('File Office - [C326714]', async () => { await testUtil.checkViewerActions(testData.fileDocx.name, testData.fileDocx.viewerToolbarPrimary, testData.fileDocx.searchViewerToolbarMore); @@ -438,33 +339,6 @@ describe('Office Files - available actions : ', () => { }); }); - // describe('multiple selection', () => { - // afterAll(async () => { - // await dataTable.clearSelection(); - // }); - - // it('multiple files - [C280467]', async () => { - // await testUtil.checkMultipleSelContextMenu([testData.fileDocxShared.name, testData.fileDocxSharedFav.name], testData.multipleSel.contextMenu); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileDocxShared.name, testData.fileDocxSharedFav.name], - // testData.multipleSel.toolbarPrimary, - // testData.multipleSel.toolbarMore - // ); - // }); - - // it('multiple files - all favorite - [C326691]', async () => { - // await testUtil.checkMultipleSelContextMenu( - // [testData.fileSharedFav.name, testData.fileSharedFavLocked.name], - // testData.multipleSelAllFav.contextMenu - // ); - // await testUtil.checkMultipleSelToolbarActions( - // [testData.fileSharedFav.name, testData.fileSharedFavLocked.name], - // testData.multipleSelAllFav.toolbarPrimary, - // testData.multipleSelAllFav.toolbarMore - // ); - // }); - // }); - describe('Viewer - file opened from Shared Files', () => { it('File Office, shared - [C326708]', async () => { await testUtil.checkViewerActions( diff --git a/e2e/suites/actions-available/files-folders/single-file-actions.test.ts b/e2e/suites/actions-available/files-folders/single-file-actions.test.ts index 45ac87455..e332d3582 100755 --- a/e2e/suites/actions-available/files-folders/single-file-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/single-file-actions.test.ts @@ -29,6 +29,7 @@ import * as testUtil from '../test-util'; describe('Files - available actions : ', () => { const random = Utils.random(); + const username = `user-${random}`; const parentName = `parent-${random}`; @@ -63,9 +64,8 @@ describe('Files - available actions : ', () => { await userApi.favorites.addFavoritesByIds('file', [fileFavId, fileSharedFavId]); await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 }); - const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); await userApi.shared.shareFilesByIds([fileSharedId, fileSharedFavId]); - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 2 }); + await userApi.shared.waitForFilesToBeShared([fileSharedId, fileSharedFavId]); await loginPage.loginWith(username); }); diff --git a/e2e/suites/actions-available/files-folders/test-data.ts b/e2e/suites/actions-available/files-folders/test-data.ts index c2ea5d019..4bc371208 100644 --- a/e2e/suites/actions-available/files-folders/test-data.ts +++ b/e2e/suites/actions-available/files-folders/test-data.ts @@ -25,6 +25,8 @@ import { Utils } from '@alfresco/aca-testing-shared'; +export const random = Utils.random(); + export const trashActions = ['Permanently Delete', 'Restore']; // ----- files ----- @@ -491,7 +493,7 @@ const searchViewerDocxFavToolbarMore = [ const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions']; export const fileDocx = { - name: `fileActions-docx-${Utils.random()}.docx`, + name: `fileActions-docx-${random}.docx`, description: 'file not shared, not fav, office, not locked', contextMenu: fileDocxContextMenu, @@ -507,7 +509,7 @@ export const fileDocx = { }; export const fileDocxFav = { - name: `fileActions-docx-fav-${Utils.random()}.docx`, + name: `fileActions-docx-fav-${random}.docx`, description: 'file not shared, fav, office, not locked', contextMenu: fileDocxFavContextMenu, @@ -526,7 +528,7 @@ export const fileDocxFav = { }; export const file = { - name: `fileActions-${Utils.random()}.txt`, + name: `fileActions-${random}.txt`, description: 'file not shared, not fav, not office, not locked', contextMenu: fileContextMenu, @@ -542,7 +544,7 @@ export const file = { }; export const fileFav = { - name: `fileActions-fav-${Utils.random()}.txt`, + name: `fileActions-fav-${random}.txt`, description: 'file not shared, fav, not office, not locked', contextMenu: fileFavContextMenu, @@ -561,7 +563,7 @@ export const fileFav = { }; export const fileDocxShared = { - name: `fileActions-docx-shared-${Utils.random()}.docx`, + name: `fileActions-docx-shared-${random}.docx`, description: 'file shared, not fav, office, not locked', contextMenu: fileDocxSharedContextMenu, @@ -577,7 +579,7 @@ export const fileDocxShared = { }; export const fileDocxSharedFav = { - name: `fileActions-docx-shared-fav-${Utils.random()}.docx`, + name: `fileActions-docx-shared-fav-${random}.docx`, description: 'file shared, fav, office, not locked', contextMenu: fileDocxSharedFavContextMenu, @@ -597,7 +599,7 @@ export const fileDocxSharedFav = { }; export const fileShared = { - name: `fileActions-shared-${Utils.random()}.txt`, + name: `fileActions-shared-${random}.txt`, description: 'file shared, not fav, not office, not locked', contextMenu: fileSharedContextMenu, @@ -613,7 +615,7 @@ export const fileShared = { }; export const fileSharedFav = { - name: `fileActions-shared-fav-${Utils.random()}.txt`, + name: `fileActions-shared-fav-${random}.txt`, description: 'file shared, fav, not office, not locked', contextMenu: fileSharedFavContextMenu, @@ -633,7 +635,7 @@ export const fileSharedFav = { }; export const fileLocked = { - name: `fileActions-locked-${Utils.random()}.txt`, + name: `fileActions-locked-${random}.txt`, description: 'file not shared, not fav, not office, locked', contextMenu: fileLockedContextMenu, @@ -649,7 +651,7 @@ export const fileLocked = { }; export const fileFavLocked = { - name: `fileActions-fav-locked-${Utils.random()}.txt`, + name: `fileActions-fav-locked-${random}.txt`, description: 'file not shared, fav, not office, locked', contextMenu: fileFavLockedContextMenu, @@ -668,7 +670,7 @@ export const fileFavLocked = { }; export const fileSharedLocked = { - name: `fileActions-shared-locked-${Utils.random()}.txt`, + name: `fileActions-shared-locked-${random}.txt`, description: 'file shared, not fav, not office, locked', contextMenu: fileSharedLockedContextMenu, @@ -684,7 +686,7 @@ export const fileSharedLocked = { }; export const fileSharedFavLocked = { - name: `fileActions-shared-fav-locked-${Utils.random()}.txt`, + name: `fileActions-shared-fav-locked-${random}.txt`, description: 'file shared, fav, not office, locked', contextMenu: fileSharedFavLockedContextMenu, @@ -704,22 +706,22 @@ export const fileSharedFavLocked = { }; export const fileInTrash = { - name: `deleted-file-${Utils.random()}.txt`, + name: `deleted-file-${random}.txt`, trashActions }; export const file2InTrash = { - name: `deleted-file2-${Utils.random()}.txt`, + name: `deleted-file2-${random}.txt`, trashActions }; export const folderInTrash = { - name: `deleted-folder-${Utils.random()}`, + name: `deleted-folder-${random}`, trashActions }; export const folder2InTrash = { - name: `deleted-folder2-${Utils.random()}`, + name: `deleted-folder2-${random}`, trashActions }; @@ -741,7 +743,7 @@ const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Permissions']; export const folder = { - name: `folderActions-${Utils.random()}`, + name: `folderActions-${random}`, description: 'folder not favorite', contextMenu: folderContextMenu, @@ -754,7 +756,7 @@ export const folder = { }; export const folderFav = { - name: `folderActions-fav-${Utils.random()}`, + name: `folderActions-fav-${random}`, description: 'folder favorite', contextMenu: folderFavContextMenu, @@ -770,7 +772,7 @@ export const folderFav = { }; export const folderFav2 = { - name: `folderActions-fav-2-${Utils.random()}`, + name: `folderActions-fav-2-${random}`, description: 'folder favorite', contextMenu: folderFavContextMenu, diff --git a/e2e/suites/actions-available/files-folders/trash.test.ts b/e2e/suites/actions-available/files-folders/trash.test.ts index 81ca742ab..b3d0fd395 100755 --- a/e2e/suites/actions-available/files-folders/trash.test.ts +++ b/e2e/suites/actions-available/files-folders/trash.test.ts @@ -31,6 +31,7 @@ const page = new BrowsingPage(); describe('Trash - available actions : ', () => { const random = Utils.random(); + const username = `user-${random}`; let fileInTrashId: string; diff --git a/e2e/suites/actions/new-menu.test.ts b/e2e/suites/actions-available/new-menu/new-menu.test.ts similarity index 100% rename from e2e/suites/actions/new-menu.test.ts rename to e2e/suites/actions-available/new-menu/new-menu.test.ts diff --git a/e2e/suites/actions-available/special-permissions/search-results.ts b/e2e/suites/actions-available/special-permissions/search-results.ts index 0230b7178..bc1f7e548 100755 --- a/e2e/suites/actions-available/special-permissions/search-results.ts +++ b/e2e/suites/actions-available/special-permissions/search-results.ts @@ -42,10 +42,11 @@ export function searchResultsTests() { }); describe('on a file', () => { - beforeAll(async () => { + beforeEach(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('file-'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(testData.random); await searchResultsPage.waitForResults(); }); @@ -87,7 +88,7 @@ export function searchResultsTests() { await testUtil.checkContextMenu(testData.fileDocxSharedFav.name, testData.fileDocxSharedFav.contextMenu); }); - xit('File shared - [C286282]', async () => { + it('File shared - [C286282]', async () => { await testUtil.checkToolbarActions(testData.fileShared.name, testData.fileShared.searchToolbarPrimary, testData.fileShared.toolbarMore); await testUtil.checkContextMenu(testData.fileShared.name, testData.fileShared.contextMenu); }); @@ -138,7 +139,8 @@ export function searchResultsTests() { beforeAll(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('folder-'); + await searchInput.checkOnlyFolders(); + await searchInput.searchFor(testData.random); await searchResultsPage.waitForResults(); }); @@ -158,7 +160,8 @@ export function searchResultsTests() { beforeAll(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('file-'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(testData.random); await searchResultsPage.waitForResults(); }); @@ -208,7 +211,8 @@ export function searchResultsTests() { it('multiple folders - [C291836]', async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.searchFor('folder-'); + await searchInput.checkOnlyFolders(); + await searchInput.searchFor(testData.random); await testUtil.checkMultipleSelContextMenu([testData.folder.name, testData.folderFav.name], testData.multipleSel.contextMenu); await testUtil.checkMultipleSelToolbarActions( diff --git a/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts b/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts index a3c26899c..77ec99574 100644 --- a/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts +++ b/e2e/suites/actions-available/special-permissions/special-permissions-actions.test.ts @@ -33,7 +33,7 @@ import { sharedFilesTests } from './shared-files'; import { collaboratorTests, filesLockedByCurrentUser, filesLockedByOtherUser } from './other-permissions'; describe('Special permissions : ', () => { - const random = Utils.random(); + const random = testData.random; const sitePrivate = `site-private-${random}`; @@ -73,7 +73,6 @@ describe('Special permissions : ', () => { await adminApiActions.createUser({ username: userDemoted }); const consumerFavoritesTotalItems = await userConsumerApi.favorites.getFavoritesTotalItems(); - const consumerSharedTotalItems = await userConsumerApi.shared.getSharedLinksTotalItems(); const managerSearchTotalItems = await userManagerApi.search.getTotalItems(userManager); const collaboratorFavoritesTotalItems = await userCollaboratorApi.favorites.getFavoritesTotalItems(); @@ -141,7 +140,16 @@ describe('Special permissions : ', () => { await Promise.all([ userConsumerApi.favorites.waitForApi({ expect: consumerFavoritesTotalItems + 9 }), - userConsumerApi.shared.waitForApi({ expect: consumerSharedTotalItems + 8 }), + userManagerApi.shared.waitForFilesToBeShared([ + fileDocxSharedId, + fileDocxSharedFavId, + fileSharedId, + fileSharedFavId, + fileSharedLockedId, + fileSharedFavLockedId, + fileGranularPermissionId, + fileLockedByUserId + ]), userManagerApi.search.waitForApi(userManager, { expect: managerSearchTotalItems + 14 }), userCollaboratorApi.favorites.waitForApi({ expect: collaboratorFavoritesTotalItems + 2 }) ]); diff --git a/e2e/suites/actions-available/special-permissions/test-data-permissions.ts b/e2e/suites/actions-available/special-permissions/test-data-permissions.ts index aba2673c0..d89ad2d87 100644 --- a/e2e/suites/actions-available/special-permissions/test-data-permissions.ts +++ b/e2e/suites/actions-available/special-permissions/test-data-permissions.ts @@ -25,6 +25,8 @@ import { Utils } from '@alfresco/aca-testing-shared'; +export const random = Utils.random(); + // ----- files ----- const consumerContextMenu = ['Share', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions']; @@ -122,7 +124,7 @@ const sharedConsumerFavLockedContextMenu = [ ]; export const fileDocx = { - name: `file-docx-${Utils.random()}.docx`, + name: `file-${random}-docx.docx`, description: 'file not shared, not fav, office, not locked', contextMenu: consumerContextMenu, @@ -135,7 +137,7 @@ export const fileDocx = { }; export const fileDocxFav = { - name: `file-docx-fav-${Utils.random()}.docx`, + name: `file-${random}-docx-fav.docx`, description: 'file not shared, fav, office, not locked', contextMenu: consumerFavContextMenu, @@ -151,7 +153,7 @@ export const fileDocxFav = { }; export const file = { - name: `file-${Utils.random()}.txt`, + name: `file-${random}.txt`, description: 'file not shared, not fav, not office, not locked', contextMenu: consumerContextMenu, @@ -164,7 +166,7 @@ export const file = { }; export const fileFav = { - name: `file-fav-${Utils.random()}.txt`, + name: `file-${random}-fav.txt`, description: 'file not shared, fav, not office, not locked', contextMenu: consumerFavContextMenu, @@ -180,7 +182,7 @@ export const fileFav = { }; export const fileDocxShared = { - name: `file-docx-shared-${Utils.random()}.docx`, + name: `file-${random}-docx-shared.docx`, description: 'file shared, not fav, office, not locked', contextMenu: consumerSharedContextMenu, @@ -196,7 +198,7 @@ export const fileDocxShared = { }; export const fileDocxSharedFav = { - name: `file-docx-shared-fav-${Utils.random()}.docx`, + name: `file-${random}-docx-shared-fav.docx`, description: 'file shared, fav, office, not locked', contextMenu: consumerSharedFavContextMenu, @@ -215,7 +217,7 @@ export const fileDocxSharedFav = { }; export const fileShared = { - name: `file-shared-${Utils.random()}.txt`, + name: `file-${random}-shared.txt`, description: 'file shared, not fav, not office, not locked', contextMenu: consumerSharedContextMenu, @@ -231,7 +233,7 @@ export const fileShared = { }; export const fileSharedFav = { - name: `file-shared-fav-${Utils.random()}.txt`, + name: `file-${random}-shared-fav.txt`, description: 'file shared, fav, not office, not locked', contextMenu: consumerSharedFavContextMenu, @@ -250,7 +252,7 @@ export const fileSharedFav = { }; export const fileLocked = { - name: `file-locked-${Utils.random()}.txt`, + name: `file-${random}-locked.txt`, description: 'file not shared, not fav, not office, locked', contextMenu: consumerContextMenu, @@ -263,7 +265,7 @@ export const fileLocked = { }; export const fileFavLocked = { - name: `file-fav-locked-${Utils.random()}.txt`, + name: `file-${random}-fav-locked.txt`, description: 'file not shared, fav, not office, locked', contextMenu: consumerFavContextMenu, @@ -279,7 +281,7 @@ export const fileFavLocked = { }; export const fileSharedLocked = { - name: `file-shared-locked-${Utils.random()}.txt`, + name: `file-${random}-shared-locked.txt`, description: 'file shared, not fav, not office, locked', contextMenu: consumerSharedContextMenu, @@ -295,7 +297,7 @@ export const fileSharedLocked = { }; export const fileSharedFavLocked = { - name: `file-shared-fav-locked-${Utils.random()}.txt`, + name: `file-${random}-shared-fav-locked.txt`, description: 'file shared, fav, not office, locked', contextMenu: consumerSharedFavContextMenu, @@ -313,8 +315,8 @@ export const fileSharedFavLocked = { searchToolbarPrimary: searchConsumerSharedToolbarPrimary }; -export const fileGranularPermission = `file-granular-${Utils.random()}.txt`; -export const fileLockedByUser = `my-file-locked-${Utils.random()}.txt`; +export const fileGranularPermission = `file-${random}-granular.txt`; +export const fileLockedByUser = `file-${random}-my-locked.txt`; // ---- folders --- @@ -333,7 +335,7 @@ const favoritesConsumerFolderContextMenu = ['Download', 'Edit', 'Remove Favorite const favoritesConsumerFolderToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete']; export const folder = { - name: `folder-${Utils.random()}`, + name: `folder-${random}`, description: 'folder not favorite', contextMenu: consumerFolderContextMenu, toolbarPrimary: consumerFolderToolbarPrimary, @@ -343,7 +345,7 @@ export const folder = { }; export const folderFav = { - name: `folder-fav-${Utils.random()}`, + name: `folder-fav-${random}`, description: 'folder favorite', contextMenu: consumerFolderFavContextMenu, toolbarPrimary: consumerFolderToolbarPrimary, @@ -356,7 +358,7 @@ export const folderFav = { }; export const folderFav2 = { - name: `folder-fav-2-${Utils.random()}`, + name: `folder-fav-2-${random}`, description: 'folder 2 favorite' }; diff --git a/e2e/suites/actions-available/special-permissions/viewer.ts b/e2e/suites/actions-available/special-permissions/viewer.ts index 5269fc9a7..954c482ad 100755 --- a/e2e/suites/actions-available/special-permissions/viewer.ts +++ b/e2e/suites/actions-available/special-permissions/viewer.ts @@ -229,7 +229,8 @@ export function viewerTests(siteName?: string) { describe('file opened from Search Results', () => { beforeAll(async () => { await searchInput.clickSearchButton(); - await searchInput.searchFor('file-'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(testData.random); await searchResultsPage.waitForResults(); }); diff --git a/e2e/suites/actions/copy-move/copy.test.ts b/e2e/suites/actions/copy-move/copy.test.ts index 2aab97fc9..04a15c9ee 100755 --- a/e2e/suites/actions/copy-move/copy.test.ts +++ b/e2e/suites/actions/copy-move/copy.test.ts @@ -24,60 +24,62 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; -import { BrowserActions } from '@alfresco/adf-testing'; +import { BrowserActions, Logger } from '@alfresco/adf-testing'; describe('Copy content', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); - const source = `source-${Utils.random()}`; + const username = `user-${random}`; + + const source = `source-${random}`; let sourceId: string; - const destinationPF = `destinationPersonal-${Utils.random()}`; + const destinationPF = `destinationPersonal-${random}`; let destinationIdPF: string; - const destinationRF = `destinationRecent-${Utils.random()}`; + const destinationRF = `destinationRecent-${random}`; let destinationIdRF: string; - const destinationSF = `destinationShared-${Utils.random()}`; + const destinationSF = `destinationShared-${random}`; let destinationIdSF: string; - const destinationFav = `destinationFav-${Utils.random()}`; + const destinationFav = `destinationFav-${random}`; let destinationIdFav: string; - const destinationSearch = `destinationSearch-${Utils.random()}`; + const destinationSearch = `destinationSearch-${random}`; let destinationIdSearch: string; - const file1 = `copy-file1-${Utils.random()}.txt`; + const file1 = `copy-file1-${random}.txt`; let file1Id: string; - const folder1 = `copy-folder1-${Utils.random()}`; + const folder1 = `copy-folder1-${random}`; let folder1Id: string; - const fileInFolder = `copy-fileInFolder-${Utils.random()}.txt`; + const fileInFolder = `copy-fileInFolder-${random}.txt`; let fileInFolderId: string; - const folder2 = `copy-folder2-${Utils.random()}`; + const folder2 = `copy-folder2-${random}`; let folder2Id: string; const fileInFolder2 = fileInFolder; - const folderExisting = `copy-folder-existing-${Utils.random()}`; + const folderExisting = `copy-folder-existing-${random}`; let folderExistingId: string; - const file1InFolderExisting = `copy-file1InFolderExisting-${Utils.random()}.txt`; - const file2InFolderExisting = `copy-file2InFolderExisting-${Utils.random()}.txt`; + const file1InFolderExisting = `copy-file1InFolderExisting-${random}.txt`; + const file2InFolderExisting = `copy-file2InFolderExisting-${random}.txt`; - const file2 = `copy-file2-${Utils.random()}.txt`; + const file2 = `copy-file2-${random}.txt`; let file2Id: string; - const file3 = `copy-file3-${Utils.random()}.txt`; + const file3 = `copy-file3-${random}.txt`; let file3Id: string; - const file4 = `copy-file4-${Utils.random()}.txt`; + const file4 = `copy-file4-${random}.txt`; let file4Id: string; - const fileLocked1 = `copy-file-locked1-${Utils.random()}.txt`; + const fileLocked1 = `copy-file-locked1-${random}.txt`; let fileLocked1Id: string; - const folderWithLockedFiles = `copy-folder-locked1-${Utils.random()}`; + const folderWithLockedFiles = `copy-folder-locked1-${random}`; let folderWithLockedFilesId: string; - const fileLockedInFolder = `copy-file-locked-${Utils.random()}`; + const fileLockedInFolder = `copy-file-locked-${random}`; let fileLockedInFolderId: string; - const existingFile = `copy-existing-${Utils.random()}.txt`; + const existingFile = `copy-existing-${random}-file.txt`; let existingFileToCopyId: string; - const existingFolder = `copy-existing-${Utils.random()}`; + const existingFolder = `copy-existing-${random}-folder`; let existingFolderToCopyId: string; let existingIdPF: string; @@ -87,15 +89,15 @@ describe('Copy content', () => { let folderExistingFavId: string; let folderExistingSearchId: string; - const file2InFolder = `copy-file2InFolder-${Utils.random()}.txt`; - const file3InFolder = `copy-file3InFolder-${Utils.random()}.txt`; + const file2InFolder = `copy-file2InFolder-${random}.txt`; + const file3InFolder = `copy-file3InFolder-${random}.txt`; - const siteName = `copy-site-${Utils.random()}`; - const folderSitePF = `copy-folderSitePersonal-${Utils.random()}`; - const folderSiteRF = `copy-folderSiteRecent-${Utils.random()}`; - const folderSiteSF = `copy-folderSiteShared-${Utils.random()}`; - const folderSiteFav = `copy-folderSiteFav-${Utils.random()}`; - const folderSiteSearch = `copy-folderSiteSearch-${Utils.random()}`; + const siteName = `copy-site-${random}`; + const folderSitePF = `copy-folderSitePersonal-${random}`; + const folderSiteRF = `copy-folderSiteRecent-${random}`; + const folderSiteSF = `copy-folderSiteShared-${random}`; + const folderSiteFav = `copy-folderSiteFav-${random}`; + const folderSiteSearch = `copy-folderSiteSearch-${random}`; let locationId: string; let destinationId: string; @@ -118,7 +120,6 @@ describe('Copy content', () => { await adminApiActions.createUser({ username }); await userActions.login(username, username); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems(); sourceId = (await apis.user.nodes.createFolder(source)).entry.id; @@ -206,17 +207,26 @@ describe('Copy content', () => { await apis.user.nodes.createFolder(folderSiteFav, docLibId); await apis.user.nodes.createFolder(folderSiteSearch, docLibId); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 }); + await apis.user.shared.waitForFilesToBeShared([existingFileToCopyId, fileInFolderId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id]); await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 }); await loginPage.loginWith(username); done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(sourceId); - await apis.user.sites.deleteSite(siteName); - done(); + beforeEach(async () => { + await page.closeOpenDialogs(); + }); + + afterAll(async () => { + try { + await apis.user.nodes.unlockFile(fileLocked1Id); + await apis.user.nodes.unlockFile(fileLockedInFolderId); + await apis.user.nodes.deleteNodesById([sourceId, destinationIdRF, destinationIdPF, destinationIdSF, destinationIdFav, destinationIdSearch]); + await apis.user.sites.deleteSite(siteName); + } catch (error) { + Logger.error(`---- afterAll failed : ${error}`); + } }); describe('from Recent Files', () => { @@ -226,11 +236,6 @@ describe('Copy content', () => { done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(destinationIdRF); - done(); - }); - it('[C280194] Copy a file', async () => copyFile(file1, source, destinationRF)); it('[C280201] Copy multiple items', async () => copyMultipleItems([file2, file3], source, destinationRF)); @@ -257,11 +262,6 @@ describe('Copy content', () => { done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(destinationIdPF); - done(); - }); - it('[C217135] Copy a file', async () => copyFile(file1, '', destinationPF)); it('[C291888] Copy a folder with content', async () => copyFolderWithContent(folder1, '', destinationPF)); @@ -303,15 +303,9 @@ describe('Copy content', () => { }); describe('from Shared Files', () => { - beforeEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); await page.clickSharedFilesAndWait(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(destinationIdSF); - done(); }); it('[C280206] Copy a file', async () => copyFile(file1, source, destinationSF)); @@ -339,11 +333,6 @@ describe('Copy content', () => { done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(destinationIdFav); - done(); - }); - it('[C280218] Copy a file', async () => copyFile(file1, source, destinationFav)); it('[C280219] Copy a folder with content', async () => copyFolderWithContent(folder1, source, destinationFav)); @@ -382,51 +371,51 @@ describe('Copy content', () => { }); describe('from Search Results', () => { - beforeEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); + await page.clickPersonalFiles(); await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); - done(); - }); - - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(destinationIdSearch); - done(); }); it('[C306932] Copy a file', async () => copyFile(file1, source, destinationSearch, async () => { + await searchInput.checkOnlyFiles(); await searchInput.searchFor(file1); await dataTable.waitForBody(); })); it('[C306943] Copy a folder with content', async () => copyFolderWithContent(folder1, source, destinationSearch, async () => { + await searchInput.checkOnlyFolders(); await searchInput.searchFor(folder1); await dataTable.waitForBody(); })); it('[C306944] Copy multiple items', async () => copyMultipleItems([file2, file3], source, destinationSearch, async () => { - await searchInput.searchFor('copy-file'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(random); await dataTable.waitForBody(); })); it('[C306933] Copy a file with a name that already exists on the destination', async () => copyFileWithNameThatAlreadyExists(existingFile, source, destinationSearch, async () => { + await searchInput.checkOnlyFiles(); await searchInput.searchFor(existingFile); await dataTable.waitForBody(); })); it('[C306934] Copy a folder with a name that already exists on the destination', async () => copyFolderWithNameThatAlreadyExists(existingFolder, source, destinationSearch, async () => { + await searchInput.checkOnlyFolders(); await searchInput.searchFor(existingFolder); await dataTable.waitForBody(); })); it('[C306942] Copy items into a library', async () => copyItemsIntoLibrary([file1, file2], source, folderSiteSearch, async () => { - await searchInput.searchFor('copy-file'); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(random); await dataTable.waitForBody(); })); @@ -434,6 +423,7 @@ describe('Copy content', () => { copyLockedFile(fileLocked1, source, destinationSearch, async () => { locationId = sourceId; destinationId = destinationIdSearch; + await searchInput.checkOnlyFiles(); await searchInput.searchFor(fileLocked1); await dataTable.waitForBody(); })); @@ -442,30 +432,35 @@ describe('Copy content', () => { copyFolderThatContainsLockedFile(folderWithLockedFiles, source, destinationSearch, async () => { locationId = folderWithLockedFilesId; destinationId = destinationIdSearch; + await searchInput.checkOnlyFolders(); await searchInput.searchFor(folderWithLockedFiles); await dataTable.waitForBody(); })); it('[C306938] Undo copy of files', async () => undoCopyFile(file4, source, destinationSearch, async () => { + await searchInput.checkOnlyFiles(); await searchInput.searchFor(file4); await dataTable.waitForBody(); })); it('[C306939] Undo copy of folders', async () => undoCopyFolder(folder2, source, destinationSearch, async () => { + await searchInput.checkOnlyFolders(); await searchInput.searchFor(folder2); await dataTable.waitForBody(); })); it('[C306940] Undo copy of a file when a file with same name already exists on the destination', async () => undoCopyFileWithExistingName(fileInFolder, folder1, folder2, async () => { + await searchInput.checkOnlyFiles(); await searchInput.searchFor(fileInFolder); await dataTable.waitForBody(); })); it('[C306941] Undo copy of a folder when a folder with same name already exists on the destination', async () => undoCopyFolderWithExistingName(folderExisting, source, destinationSearch, async () => { + await searchInput.checkOnlyFolders(); await searchInput.searchFor(folderExisting); await dataTable.waitForBody(); })); diff --git a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts index c4ef197c7..401872ded 100755 --- a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts +++ b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts @@ -117,6 +117,7 @@ describe('Destination picker dialog : ', () => { await contributorApi.nodes.deleteNodeById(fileIdContributor); await collaboratorApi.nodes.deleteNodeById(fileIdCollaborator); + await adminApiActions.login(); await adminApiActions.nodes.deleteNodeById(adminFolderId); }); diff --git a/e2e/suites/actions/copy-move/move.test.ts b/e2e/suites/actions/copy-move/move.test.ts index fe74f367c..9d7572542 100755 --- a/e2e/suites/actions/copy-move/move.test.ts +++ b/e2e/suites/actions/copy-move/move.test.ts @@ -301,17 +301,13 @@ describe('Move content', () => { beforeAll(async (done) => { await apis.user.nodes.createFile(file1, sourceIdRF); - await apis.user.nodes.createFile(file2, sourceIdRF); await apis.user.nodes.createFile(file3, sourceIdRF); - await apis.user.nodes.createFile(`${existingFile}.txt`, sourceIdRF); await apis.user.nodes.createFile(`${existingFile}.txt`, destinationIdRF); - await apis.user.nodes.createFile(file4, sourceIdRF); await apis.user.search.waitForApi(username, { expect: 16 }); - done(); }); @@ -424,7 +420,6 @@ describe('Move content', () => { beforeAll(async (done) => { file1Id = (await apis.user.nodes.createFile(file1, sourceIdSF)).entry.id; - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id]); file2Id = (await apis.user.nodes.createFile(file2, sourceIdSF)).entry.id; @@ -437,7 +432,7 @@ describe('Move content', () => { file4Id = (await apis.user.nodes.createFile(file4, sourceIdSF)).entry.id; await userActions.shareNodes([file4Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, existingFileId, file4Id]); done(); }); diff --git a/e2e/suites/actions/create-file-from-template.test.ts b/e2e/suites/actions/create/create-file-from-template.test.ts similarity index 100% rename from e2e/suites/actions/create-file-from-template.test.ts rename to e2e/suites/actions/create/create-file-from-template.test.ts diff --git a/e2e/suites/actions/create-folder-from-template.test.ts b/e2e/suites/actions/create/create-folder-from-template.test.ts similarity index 99% rename from e2e/suites/actions/create-folder-from-template.test.ts rename to e2e/suites/actions/create/create-folder-from-template.test.ts index 9992a006a..0065f57cf 100755 --- a/e2e/suites/actions/create-folder-from-template.test.ts +++ b/e2e/suites/actions/create/create-folder-from-template.test.ts @@ -321,6 +321,7 @@ describe('Create folder from template', () => { await page.dataTable.waitForHeader(); expect(await page.dataTable.isItemPresent(folder2.name)).toBe(true, 'Folder not displayed in list view'); + const desc = await userApi.nodes.getNodeDescription(folder2.name, parentId); expect(desc).toEqual(folder2.description); const title = await userApi.nodes.getNodeTitle(folder2.name, parentId); diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create/create-folder.test.ts similarity index 100% rename from e2e/suites/actions/create-folder.test.ts rename to e2e/suites/actions/create/create-folder.test.ts diff --git a/e2e/suites/actions/create-library.test.ts b/e2e/suites/actions/create/create-library.test.ts similarity index 96% rename from e2e/suites/actions/create-library.test.ts rename to e2e/suites/actions/create/create-library.test.ts index f8f29580a..ca40ffacb 100755 --- a/e2e/suites/actions/create-library.test.ts +++ b/e2e/suites/actions/create/create-library.test.ts @@ -23,7 +23,16 @@ * along with Alfresco. If not, see . */ -import { AdminActions, SITE_VISIBILITY, LoginPage, BrowsingPage, CreateLibraryDialog, Utils, RepoClient } from '@alfresco/aca-testing-shared'; +import { + AdminActions, + SITE_VISIBILITY, + LoginPage, + BrowsingPage, + CreateLibraryDialog, + Utils, + RepoClient, + UserActions +} from '@alfresco/aca-testing-shared'; import { BrowserActions } from '@alfresco/adf-testing'; describe('Create library', () => { @@ -58,6 +67,7 @@ describe('Create library', () => { const createDialog = new CreateLibraryDialog(); const { dataTable } = page; const adminApiActions = new AdminActions(); + const userActions = new UserActions(); beforeAll(async (done) => { await adminApiActions.createUser({ username }); @@ -76,6 +86,8 @@ describe('Create library', () => { afterAll(async (done) => { await apis.user.sites.deleteAllUserSites(); + await userActions.login(username, username); + await userActions.emptyTrashcan(); done(); }); diff --git a/e2e/suites/actions/delete-undo-delete.test.ts b/e2e/suites/actions/delete/delete-undo-delete.test.ts similarity index 99% rename from e2e/suites/actions/delete-undo-delete.test.ts rename to e2e/suites/actions/delete/delete-undo-delete.test.ts index e3656d991..efb4152e6 100755 --- a/e2e/suites/actions/delete-undo-delete.test.ts +++ b/e2e/suites/actions/delete/delete-undo-delete.test.ts @@ -359,9 +359,8 @@ describe('Delete and undo delete', () => { sharedFile5Id = (await apis.user.nodes.createFile(sharedFile5, parentId)).entry.id; sharedFile6Id = (await apis.user.nodes.createFile(sharedFile6, parentId)).entry.id; - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 }); + await apis.user.shared.waitForFilesToBeShared([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]); await loginPage.loginWith(username); done(); diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/delete/permanently-delete.test.ts similarity index 100% rename from e2e/suites/actions/permanently-delete.test.ts rename to e2e/suites/actions/delete/permanently-delete.test.ts diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/delete/restore.test.ts similarity index 100% rename from e2e/suites/actions/restore.test.ts rename to e2e/suites/actions/delete/restore.test.ts diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit/edit-folder.test.ts similarity index 95% rename from e2e/suites/actions/edit-folder.test.ts rename to e2e/suites/actions/edit/edit-folder.test.ts index 7b5816e35..067b62397 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit/edit-folder.test.ts @@ -67,10 +67,11 @@ describe('Edit folder', () => { const folderFavoriteDuplicate = `folder-fav-${Utils.random()}`; let folderFavoriteDuplicateId: string; - const folderSearch = `folder-search-${Utils.random()}`; - const folderSearchToEdit = `folder-search-${Utils.random()}`; + const searchRandom = Utils.random(); + const folderSearch = `folder-search-${searchRandom}`; + const folderSearchToEdit = `folder-search-to-edit-${searchRandom}`; let folderSearchToEditId: string; - const folderSearchDuplicate = `folder-search-${Utils.random()}`; + const folderSearchDuplicate = `folder-search-duplicate-${searchRandom}`; const apis = { user: new RepoClient(username, username) @@ -107,7 +108,6 @@ describe('Edit folder', () => { folderFavoriteToEditId = (await apis.user.nodes.createFolder(folderFavoriteToEdit)).entry.id; folderFavoriteDuplicateId = (await apis.user.nodes.createFolder(folderFavoriteDuplicate)).entry.id; - const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('folder-search'); await apis.user.nodes.createFolder(folderSearch); folderSearchToEditId = (await apis.user.nodes.createFolder(folderSearchToEdit)).entry.id; await apis.user.nodes.createFolder(folderSearchDuplicate); @@ -116,19 +116,17 @@ describe('Edit folder', () => { await apis.user.favorites.addFavoriteById('folder', folderFavoriteToEditId); await apis.user.favorites.addFavoriteById('folder', folderFavoriteDuplicateId); - await apis.user.search.waitForNodes('folder-search', { expect: initialSearchByTermTotalItems + 3 }); + await apis.user.search.waitForNodes(searchRandom, { expect: 3 }); await loginPage.loginWith(username); done(); }); - afterAll(async (done) => { - await Promise.all([ - adminApiActions.sites.deleteSite(sitePrivate), - apis.user.sites.deleteSite(siteName), - apis.user.nodes.deleteNodesById([parentId, folderFavoriteToEditId, folderFavoriteDuplicateId, folderSearchToEditId]) - ]); - done(); + afterAll(async () => { + await adminApiActions.login(); + await adminApiActions.sites.deleteSite(sitePrivate); + await apis.user.sites.deleteSite(siteName); + await apis.user.nodes.deleteNodesById([parentId, folderFavoriteToEditId, folderFavoriteDuplicateId, folderSearchToEditId]); }); beforeEach(async () => { diff --git a/e2e/suites/actions/edit-offline.test.ts b/e2e/suites/actions/edit/edit-offline.test.ts similarity index 93% rename from e2e/suites/actions/edit-offline.test.ts rename to e2e/suites/actions/edit/edit-offline.test.ts index b82f25d1f..db4c79a8a 100755 --- a/e2e/suites/actions/edit-offline.test.ts +++ b/e2e/suites/actions/edit/edit-offline.test.ts @@ -35,11 +35,12 @@ describe('Edit offline', () => { const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id: string; - const fileSearch1 = `file-search-1-${Utils.random()}.docx`; + const searchRandom = Utils.random(); + const fileSearch1 = `file-search-1-${searchRandom}.docx`; let fileSearch1Id: string; - const fileSearchLocked = `file-search-locked-${Utils.random()}.docx`; + const fileSearchLocked = `file-search-locked-${searchRandom}.docx`; let fileSearchLockedId: string; - const fileSearchLocked2 = `file-search-locked2-${Utils.random()}.docx`; + const fileSearchLocked2 = `file-search-locked2-${searchRandom}.docx`; let fileSearchLocked2Id: string; const parentPF = `parentPersonal-${Utils.random()}`; @@ -130,9 +131,8 @@ describe('Edit offline', () => { await apis.user.nodes.lockFile(fileLockedId); await apis.user.nodes.lockFile(fileLocked2Id); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([file1Id, fileLockedId, fileLocked2Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, fileLockedId, fileLocked2Id]); await loginPage.loginWith(username); }); @@ -256,8 +256,7 @@ describe('Edit offline', () => { await Utils.pressEscape(); }); - // TODO: raise REPO issue: permissions not returned in /people/${personId}/favorites api - xit('[C306956] File is locked and downloaded when clicking Edit Offline', async () => { + it('[C306956] File is locked and downloaded when clicking Edit Offline', async () => { await dataTable.selectItem(file1); await toolbar.clickMoreActionsEditOffline(); @@ -285,7 +284,6 @@ describe('Edit offline', () => { beforeAll(async () => { parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id; - const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('file-search'); fileSearch1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearch1)).entry.id; fileSearchLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked)).entry.id; fileSearchLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked2)).entry.id; @@ -293,7 +291,7 @@ describe('Edit offline', () => { await apis.user.nodes.lockFile(fileSearchLockedId); await apis.user.nodes.lockFile(fileSearchLocked2Id); - await apis.user.search.waitForNodes('file-search', { expect: initialSearchByTermTotalItems + 3 }); + await apis.user.search.waitForNodes(searchRandom, { expect: 3 }); await loginPage.loginWith(username); }); @@ -305,7 +303,7 @@ describe('Edit offline', () => { beforeEach(async () => { await page.clickPersonalFilesAndWait(); await searchInput.clickSearchButton(); - await searchInput.searchFor('file-search'); + await searchInput.searchFor(searchRandom); await dataTable.waitForBody(); }); @@ -324,8 +322,10 @@ describe('Edit offline', () => { it('[C306954] Lock information is displayed', async () => { expect(await dataTable.isItemPresent(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} is not displayed`); expect(await dataTable.hasLockIcon(fileSearchLocked2, parentSearch)).toBe(true, `${fileSearchLocked2} does not have a lock icon`); - // TODO: enable when ACA-2314 is fixed - // expect(await dataTable.getLockOwner(fileSearchLocked2, parentSearch)).toContain(username, `${fileSearchLocked2} does not have correct lock owner info`); + expect(await dataTable.getLockOwner(fileSearchLocked2, parentSearch)).toContain( + username, + `${fileSearchLocked2} does not have correct lock owner info` + ); }); it('[C306955] Cancel Editing unlocks the file', async () => { diff --git a/e2e/suites/actions/mark-favorite.test.ts b/e2e/suites/actions/favorite/mark-favorite.test.ts similarity index 96% rename from e2e/suites/actions/mark-favorite.test.ts rename to e2e/suites/actions/favorite/mark-favorite.test.ts index bdfd627c9..69d900a60 100644 --- a/e2e/suites/actions/mark-favorite.test.ts +++ b/e2e/suites/actions/favorite/mark-favorite.test.ts @@ -53,15 +53,16 @@ describe('Mark items as favorites', () => { let folderId: string; let parentId: string; - const fileSearchNotFav1 = `search-fileNotFav1-${Utils.random()}.txt`; - const fileSearchNotFav2 = `search-fileNotFav2-${Utils.random()}.txt`; - const fileSearchNotFav3 = `search-fileNotFav3-${Utils.random()}.txt`; - const fileSearchNotFav4 = `search-fileNotFav4-${Utils.random()}.txt`; - const fileSearchFav1 = `search-fileFav1-${Utils.random()}.txt`; - const fileSearchFav2 = `search-fileFav2-${Utils.random()}.txt`; - const fileSearchFav3 = `search-fileFav3-${Utils.random()}.txt`; - const fileSearchFav4 = `search-fileFav4-${Utils.random()}.txt`; - const folderSearch = `search-folder-${Utils.random()}`; + const searchRandom = Utils.random(); + const fileSearchNotFav1 = `search-${searchRandom}-fileNotFav1.txt`; + const fileSearchNotFav2 = `search-${searchRandom}-fileNotFav2.txt`; + const fileSearchNotFav3 = `search-${searchRandom}-fileNotFav3.txt`; + const fileSearchNotFav4 = `search-${searchRandom}-fileNotFav4.txt`; + const fileSearchFav1 = `search-${searchRandom}-fileFav1.txt`; + const fileSearchFav2 = `search-${searchRandom}-fileFav2.txt`; + const fileSearchFav3 = `search-${searchRandom}-fileFav3.txt`; + const fileSearchFav4 = `search-${searchRandom}-fileFav4.txt`; + const folderSearch = `search-${searchRandom}-folder`; let fileSearchNotFav1Id: string; let fileSearchNotFav2Id: string; @@ -105,10 +106,18 @@ describe('Mark items as favorites', () => { await apis.user.favorites.addFavoritesByIds('file', [fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]); await apis.user.favorites.waitForApi({ expect: currentFavoritesTotalItems + 5 }); - const currentSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]); await apis.user.shared.shareFilesByIds([fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id]); - await apis.user.shared.waitForApi({ expect: currentSharedTotalItems + 8 }); + await apis.user.shared.waitForFilesToBeShared([ + fileFav1Id, + fileFav2Id, + fileFav3Id, + fileFav4Id, + fileNotFav1Id, + fileNotFav2Id, + fileNotFav3Id, + fileNotFav4Id + ]); await loginPage.loginWith(username); done(); @@ -361,7 +370,6 @@ describe('Mark items as favorites', () => { describe('on Search Results', () => { beforeAll(async (done) => { - const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f'); fileSearchNotFav1Id = (await apis.user.nodes.createFile(fileSearchNotFav1, parentId)).entry.id; fileSearchNotFav2Id = (await apis.user.nodes.createFile(fileSearchNotFav2, parentId)).entry.id; fileSearchNotFav3Id = (await apis.user.nodes.createFile(fileSearchNotFav3, parentId)).entry.id; @@ -371,13 +379,13 @@ describe('Mark items as favorites', () => { fileSearchFav3Id = (await apis.user.nodes.createFile(fileSearchFav3, parentId)).entry.id; fileSearchFav4Id = (await apis.user.nodes.createFile(fileSearchFav4, parentId)).entry.id; folderSearchId = (await apis.user.nodes.createFolder(folderSearch, parentId)).entry.id; - await apis.user.search.waitForNodes('search-f', { expect: initialSearchByTermTotalItems + 9 }); + await apis.user.search.waitForNodes(searchRandom, { expect: 9 }); await apis.user.favorites.addFavoritesByIds('file', [fileSearchFav1Id, fileSearchFav2Id, fileSearchFav3Id, fileSearchFav4Id]); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('search-f'); + await searchInput.searchFor(searchRandom); await dataTable.waitForBody(); done(); }); diff --git a/e2e/suites/actions/library-actions.test.ts b/e2e/suites/actions/library/library-actions.test.ts similarity index 99% rename from e2e/suites/actions/library-actions.test.ts rename to e2e/suites/actions/library/library-actions.test.ts index 4c41b05e2..4c3024671 100755 --- a/e2e/suites/actions/library-actions.test.ts +++ b/e2e/suites/actions/library/library-actions.test.ts @@ -334,7 +334,7 @@ describe('Library actions', () => { expect(await apis.user.favorites.isFavoriteWithRetry(sitePublic6Admin, { expect: true })).toBe(true, `${sitePublic6Admin} not favorite`); }); - it('[C306963] from on Search Results', async () => { + it('[C306963] from Search Results', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); await searchInput.searchFor(siteSearchPublic3Admin); diff --git a/e2e/suites/actions/share-file.test.ts b/e2e/suites/actions/share/share-file.test.ts similarity index 89% rename from e2e/suites/actions/share-file.test.ts rename to e2e/suites/actions/share/share-file.test.ts index 5f0384d4a..ea282fa6a 100755 --- a/e2e/suites/actions/share-file.test.ts +++ b/e2e/suites/actions/share/share-file.test.ts @@ -89,20 +89,17 @@ describe('Share a file', () => { describe('when logged out', () => { let file6SharedLink: string; - let initialTotalItems: number; beforeAll(async () => { file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); const sharedId = (await apis.user.shared.shareFileById(file6Id)).entry.id; file6SharedLink = `${shareLinkPreUrl}${sharedId}`; - await apis.user.shared.waitForApi({ expect: initialTotalItems + 1 }); + await apis.user.shared.waitForFilesToBeShared([file6Id]); }); afterAll(async () => { await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); }); it('[C286326] A non-logged user can download the shared file from the viewer', async () => { @@ -128,8 +125,6 @@ describe('Share a file', () => { }); describe('from Personal Files', () => { - let initialTotalItems: number; - beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -141,9 +136,8 @@ describe('Share a file', () => { file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id; file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file6Id, file7Id], expiryDate); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); }); beforeEach(async () => { @@ -157,16 +151,7 @@ describe('Share a file', () => { }); afterAll(async () => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.nodes.deleteNodeById(file5Id); - await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.nodes.deleteNodeById(file7Id); - await apis.user.nodes.deleteNodeById(file8Id); - await apis.user.nodes.deleteNodeById(file9Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id, file9Id]); }); it('[C286327] Share dialog default values', async () => { @@ -312,7 +297,6 @@ describe('Share a file', () => { const siteName = `site-${Utils.random()}`; const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId: string; - let initialTotalItems: number; beforeAll(async () => { await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); @@ -329,9 +313,8 @@ describe('Share a file', () => { await apis.user.nodes.createFile(file8, parentInSiteId); file9Id = (await apis.user.nodes.createFile(file9, parentInSiteId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file6Id, file7Id], expiryDate); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); }); beforeEach(async () => { @@ -349,7 +332,6 @@ describe('Share a file', () => { afterAll(async () => { await adminApiActions.sites.deleteSite(siteName); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); }); it('[C286639] Share dialog default values', async () => { @@ -488,8 +470,6 @@ describe('Share a file', () => { }); describe('from Recent Files', () => { - let initialTotalItems: number; - beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -501,9 +481,8 @@ describe('Share a file', () => { file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id; file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file6Id, file7Id], expiryDate); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); }); beforeEach(async () => { @@ -516,16 +495,7 @@ describe('Share a file', () => { }); afterAll(async () => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.nodes.deleteNodeById(file5Id); - await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.nodes.deleteNodeById(file7Id); - await apis.user.nodes.deleteNodeById(file8Id); - await apis.user.nodes.deleteNodeById(file9Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id, file9Id]); }); it('[C286657] Share dialog default values', async () => { @@ -664,8 +634,6 @@ describe('Share a file', () => { }); describe('from Shared Files', () => { - let initialTotalItems: number; - beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -675,11 +643,10 @@ describe('Share a file', () => { file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id; file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id, file2Id, file3Id]); await userActions.shareNodes([file4Id, file5Id], expiryDate); await userActions.shareNodes([file6Id, file7Id]); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 7 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id]); }); beforeEach(async () => { @@ -692,14 +659,7 @@ describe('Share a file', () => { }); afterAll(async () => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.nodes.deleteNodeById(file5Id); - await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.nodes.deleteNodeById(file7Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id]); }); it('[C286648] Share dialog default values', async () => { @@ -809,8 +769,6 @@ describe('Share a file', () => { }); describe('from Favorites', () => { - let initialTotalItems: number; - beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -822,20 +780,11 @@ describe('Share a file', () => { file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id; file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id; - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await apis.user.favorites.addFavoriteById('file', file1Id); - await apis.user.favorites.addFavoriteById('file', file2Id); - await apis.user.favorites.addFavoriteById('file', file3Id); - await apis.user.favorites.addFavoriteById('file', file4Id); - await apis.user.favorites.addFavoriteById('file', file5Id); - await apis.user.favorites.addFavoriteById('file', file6Id); - await apis.user.favorites.addFavoriteById('file', file7Id); - await apis.user.favorites.addFavoriteById('file', file8Id); - await apis.user.favorites.addFavoriteById('file', file9Id); - + await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id, file9Id]); await userActions.shareNodes([file6Id, file7Id], expiryDate); + await apis.user.favorites.waitForApi({ expect: 9 }); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); }); beforeEach(async () => { @@ -848,16 +797,7 @@ describe('Share a file', () => { }); afterAll(async () => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.nodes.deleteNodeById(file5Id); - await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.nodes.deleteNodeById(file7Id); - await apis.user.nodes.deleteNodeById(file8Id); - await apis.user.nodes.deleteNodeById(file9Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id, file9Id]); }); it('[C286666] Share dialog default values', async () => { @@ -996,32 +936,29 @@ describe('Share a file', () => { }); describe('from Search Results', () => { - file3 = `search-file3-${Utils.random()}.txt`; - file5 = `search-file5-${Utils.random()}.txt`; - file6 = `search-file6-${Utils.random()}.txt`; - file7 = `search-file7-${Utils.random()}.txt`; - file9 = `search-file9-${Utils.random()}.txt`; - - let initialTotalItems: number; + const searchRandom = Utils.random(); + file3 = `search-file3-${searchRandom}.txt`; + file5 = `search-file5-${searchRandom}.txt`; + file6 = `search-file6-${searchRandom}.txt`; + file7 = `search-file7-${searchRandom}.txt`; + file9 = `search-file9-${searchRandom}.txt`; beforeAll(async () => { - const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f'); file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file5Id = (await apis.user.nodes.createFile(file5, parentId)).entry.id; file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id; file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id; file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id; - await apis.user.search.waitForNodes('search-f', { expect: initialSearchByTermTotalItems + 5 }); + await apis.user.search.waitForNodes(searchRandom, { expect: 5 }); - initialTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file6Id, file7Id], expiryDate); - await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); }); beforeEach(async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('search-f'); + await searchInput.searchFor(searchRandom); await dataTable.waitForBody(); }); @@ -1031,12 +968,7 @@ describe('Share a file', () => { }); afterAll(async () => { - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file5Id); - await apis.user.nodes.deleteNodeById(file6Id); - await apis.user.nodes.deleteNodeById(file7Id); - await apis.user.nodes.deleteNodeById(file9Id); - await apis.user.shared.waitForApi({ expect: initialTotalItems }); + await apis.user.nodes.deleteNodesById([file3Id, file5Id, file6Id, file7Id, file9Id]); }); it('[C306975] Share a file', async () => { diff --git a/e2e/suites/actions/unshare-file-search-results.test.ts b/e2e/suites/actions/share/unshare-file-search-results.test.ts similarity index 92% rename from e2e/suites/actions/unshare-file-search-results.test.ts rename to e2e/suites/actions/share/unshare-file-search-results.test.ts index 33d790ae9..68fc36e46 100755 --- a/e2e/suites/actions/unshare-file-search-results.test.ts +++ b/e2e/suites/actions/share/unshare-file-search-results.test.ts @@ -44,20 +44,21 @@ describe('Unshare a file from Search Results', () => { const parent = `parent-${Utils.random()}`; let parentId: string; - const file1 = `search-file1-${Utils.random()}.txt`; + const searchRandom = Utils.random(); + const file1 = `search-file-${searchRandom}-1.txt`; let file1Id: string; - const file2 = `search-file2-${Utils.random()}.txt`; + const file2 = `search-file-${searchRandom}-2.txt`; let file2Id: string; - const file3 = `search-file3-${Utils.random()}.txt`; + const file3 = `search-file-${searchRandom}-3.txt`; let file3Id: string; - const file4 = `search-file4-${Utils.random()}.txt`; + const file4 = `search-file-${searchRandom}-4.txt`; let file4Id: string; const sitePrivate = `site-private-${Utils.random()}`; - const fileSite1 = `search-fileSite1-${Utils.random()}.txt`; + const fileSite1 = `search-file-${searchRandom}-Site1.txt`; let fileSite1Id: string; - const fileSite2 = `search-fileSite2-${Utils.random()}.txt`; + const fileSite2 = `search-file-${searchRandom}-Site2.txt`; let fileSite2Id: string; const apis = { @@ -83,13 +84,11 @@ describe('Unshare a file from Search Results', () => { parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-file'); file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id; - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate); @@ -102,8 +101,9 @@ describe('Unshare a file from Search Results', () => { await adminApiActions.shareNodes([fileSite1Id]); await userActions.shareNodes([fileSite2Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 }); - await apis.user.search.waitForNodes('search-file', { expect: initialSearchByTermTotalItems + 6 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, fileSite2Id]); + await adminApiActions.shared.waitForFilesToBeShared([fileSite1Id]); + await apis.user.search.waitForNodes(`search-file-${searchRandom}`, { expect: 6 }); await loginPage.loginWith(username); done(); diff --git a/e2e/suites/actions/unshare-file.test.ts b/e2e/suites/actions/share/unshare-file.test.ts similarity index 92% rename from e2e/suites/actions/unshare-file.test.ts rename to e2e/suites/actions/share/unshare-file.test.ts index 917f8d903..823592490 100755 --- a/e2e/suites/actions/unshare-file.test.ts +++ b/e2e/suites/actions/share/unshare-file.test.ts @@ -83,17 +83,15 @@ describe('Unshare a file', () => { let file3Id: string; const file4 = `file4-${Utils.random()}.txt`; let file4Id: string; - let initialSharedTotalItems: number; beforeAll(async (done) => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -111,11 +109,7 @@ describe('Unshare a file', () => { }); afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -205,7 +199,6 @@ describe('Unshare a file', () => { const siteName = `site-${Utils.random()}`; const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId: string; - let initialSharedTotalItems: number; beforeAll(async (done) => { await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); @@ -216,10 +209,9 @@ describe('Unshare a file', () => { file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id; file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -240,7 +232,6 @@ describe('Unshare a file', () => { afterAll(async (done) => { await adminApiActions.sites.deleteSite(siteName); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems }); done(); }); @@ -326,7 +317,6 @@ describe('Unshare a file', () => { let file3Id: string; const file4 = `file4-${Utils.random()}.txt`; let file4Id: string; - let initialSharedTotalItems: number; beforeAll(async (done) => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; @@ -334,10 +324,8 @@ describe('Unshare a file', () => { file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -353,11 +341,7 @@ describe('Unshare a file', () => { }); afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -443,7 +427,6 @@ describe('Unshare a file', () => { let file3Id: string; const file4 = `file4-${Utils.random()}.txt`; let file4Id: string; - let initialSharedTotalItems: number; beforeAll(async (done) => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; @@ -451,10 +434,8 @@ describe('Unshare a file', () => { file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -470,11 +451,7 @@ describe('Unshare a file', () => { }); afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -560,7 +537,6 @@ describe('Unshare a file', () => { let file3Id: string; const file4 = `file4-${Utils.random()}.txt`; let file4Id: string; - let initialSharedTotalItems: number; beforeAll(async (done) => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; @@ -568,8 +544,6 @@ describe('Unshare a file', () => { file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await userActions.shareNodes([file1Id, file2Id, file3Id, file4Id]); await apis.user.favorites.addFavoriteById('file', file1Id); @@ -578,7 +552,7 @@ describe('Unshare a file', () => { await apis.user.favorites.addFavoriteById('file', file4Id); await apis.user.favorites.waitForApi({ expect: 4 }); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -594,11 +568,7 @@ describe('Unshare a file', () => { }); afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(file1Id); - await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.nodes.deleteNodeById(file3Id); - await apis.user.nodes.deleteNodeById(file4Id); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems }); + await apis.user.nodes.deleteNodesById([file1Id, file2Id, file3Id, file4Id]); done(); }); @@ -704,15 +674,18 @@ describe('Unshare a file', () => { await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); + await adminApiActions.login(); await adminApiActions.shareNodes([file1FileLibId, file1SharedId, file1FavId]); + + await userActions.login(username, username); await userActions.shareNodes([file2FileLibId, file2SharedId, file2FavId]); await apis.user.favorites.addFavoriteById('file', file1FavId); await apis.user.favorites.addFavoriteById('file', file2FavId); await apis.user.favorites.waitForApi({ expect: 2 }); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 }); + await adminApiActions.shared.waitForFilesToBeShared([file1FileLibId, file1SharedId, file1FavId]); + await apis.user.shared.waitForFilesToBeShared([file2FileLibId, file2SharedId, file2FavId]); done(); }); diff --git a/e2e/suites/actions/download.test.ts b/e2e/suites/actions/upload-download/download.test.ts similarity index 88% rename from e2e/suites/actions/download.test.ts rename to e2e/suites/actions/upload-download/download.test.ts index 7198946ef..9808b867d 100755 --- a/e2e/suites/actions/download.test.ts +++ b/e2e/suites/actions/upload-download/download.test.ts @@ -27,32 +27,33 @@ import { AdminActions, UserActions, LoginPage, BrowsingPage, SearchResultsPage, import { BrowserActions } from '@alfresco/adf-testing'; describe('Download', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + const username = `user-${random}`; - const parent = `parent-${Utils.random()}`; + const parent = `parent-${random}`; let parentId: string; - const filePersonal = `filePersonal-${Utils.random()}.txt`; - const fileRecent1 = `fileRecent1-${Utils.random()}.txt`; - const fileRecent2 = `fileRecent2-${Utils.random()}.txt`; - const fileShared1 = `fileShared1-${Utils.random()}.txt`; - const fileShared2 = `fileShared2-${Utils.random()}.txt`; - const fileFavorites = `fileFavorites-${Utils.random()}.txt`; - const fileSearch = `fileSearch-${Utils.random()}.txt`; + const filePersonal = `filePersonal-${random}.txt`; + const fileRecent1 = `fileRecent1-${random}.txt`; + const fileRecent2 = `fileRecent2-${random}.txt`; + const fileShared1 = `fileShared1-${random}.txt`; + const fileShared2 = `fileShared2-${random}.txt`; + const fileFavorites = `fileFavorites-${random}.txt`; + const fileSearch = `fileSearch-${random}.txt`; - const folderPersonal = `folderPersonal-${Utils.random()}`; - const folderFavorites = `folderFavorites-${Utils.random()}`; - const folderSearch = `folderSearch-${Utils.random()}`; + const folderPersonal = `folderPersonal-${random}`; + const folderFavorites = `folderFavorites-${random}`; + const folderSearch = `folderSearch-${random}`; - const fileInFolderPersonal = `fileInFolderPersonal-${Utils.random()}.txt`; - const fileInFolderFavorites = `fileInFolderFavorites-${Utils.random()}.txt`; - const fileInFolderSearch = `fileInFolderSearch-${Utils.random()}.txt`; + const fileInFolderPersonal = `fileInFolderPersonal-${random}.txt`; + const fileInFolderFavorites = `fileInFolderFavorites-${random}.txt`; + const fileInFolderSearch = `fileInFolderSearch-${random}.txt`; - const unzippedPersonal = `unzippedPersonal-${Utils.random()}`; - const unzippedRecent = `unzippedRecent-${Utils.random()}`; - const unzippedShared = `unzippedShared-${Utils.random()}`; - const unzippedFavorites = `unzippedFavorites-${Utils.random()}`; - const unzippedSearch = `unzippedSearch-${Utils.random()}`; + const unzippedPersonal = `unzippedPersonal-${random}`; + const unzippedRecent = `unzippedRecent-${random}`; + const unzippedShared = `unzippedShared-${random}`; + const unzippedFavorites = `unzippedFavorites-${random}`; + const unzippedSearch = `unzippedSearch-${random}`; let fileShared1Id: string; let fileShared2Id: string; @@ -73,7 +74,6 @@ describe('Download', () => { const searchResultsPage = new SearchResultsPage(); const { searchInput } = searchResultsPage.header; - let initialSharedTotalItems: number; let initialFavoritesTotalItems: number; let initialRecentTotalItems: number; @@ -108,9 +108,8 @@ describe('Download', () => { await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 10 }); - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([fileShared1Id, fileShared2Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 2 }); + await apis.user.shared.waitForFilesToBeShared([fileShared1Id, fileShared2Id]); initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems(); await apis.user.favorites.addFavoriteById('file', fileFavoritesId); @@ -128,7 +127,7 @@ describe('Download', () => { }); afterEach(async (done) => { - await Utils.renameFile(archiveZip, `${Utils.random()}.zip`); + await Utils.renameFile(archiveZip, `${random}.zip`); done(); }); @@ -276,7 +275,7 @@ describe('Download', () => { await page.clickPersonalFilesAndWait(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('*Search*'); + await searchInput.searchFor(random); done(); }); diff --git a/e2e/suites/actions/upload-file.test.ts b/e2e/suites/actions/upload-download/upload-file.test.ts similarity index 94% rename from e2e/suites/actions/upload-file.test.ts rename to e2e/suites/actions/upload-download/upload-file.test.ts index ec3365c92..aa06a1f96 100755 --- a/e2e/suites/actions/upload-file.test.ts +++ b/e2e/suites/actions/upload-download/upload-file.test.ts @@ -61,8 +61,8 @@ describe('Upload files', () => { it('Upload a file', async () => { await dataTable.doubleClickOnRowByName(folder1); await page.sidenav.openNewMenu(); - await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/create-folder.test.ts`); + await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/upload-file.test.ts`); - expect(await dataTable.isItemPresent('create-folder.test.ts')).toBe(true, 'file not uploaded'); + expect(await dataTable.isItemPresent('upload-file.test.ts')).toBe(true, 'file not uploaded'); }); }); diff --git a/e2e/suites/actions/upload-new-version.test.ts b/e2e/suites/actions/upload-download/upload-new-version.test.ts similarity index 98% rename from e2e/suites/actions/upload-new-version.test.ts rename to e2e/suites/actions/upload-download/upload-new-version.test.ts index 40a160c84..e3c037961 100755 --- a/e2e/suites/actions/upload-new-version.test.ts +++ b/e2e/suites/actions/upload-download/upload-new-version.test.ts @@ -50,17 +50,18 @@ describe('Upload new version', () => { const fileLocked2 = `file-locked2-${Utils.random()}.docx`; let fileLocked2Id: string; - const fileSearch1 = `search-file1-${Utils.random()}.docx`; + const searchRandom = Utils.random(); + const fileSearch1 = `search-${searchRandom}-file1.docx`; let fileSearch1Id: string; - const fileSearch2 = `search-file2-${Utils.random()}.docx`; + const fileSearch2 = `search-${searchRandom}-file2.docx`; let fileSearch2Id: string; - const fileSearch3 = `search-file3-${Utils.random()}.docx`; + const fileSearch3 = `search-${searchRandom}-file3.docx`; let fileSearch3Id: string; - const fileSearch4 = `search-file4-${Utils.random()}.docx`; + const fileSearch4 = `search-${searchRandom}-file4.docx`; let fileSearch4Id: string; - const fileLockedSearch1 = `search-file-locked1-${Utils.random()}.docx`; + const fileLockedSearch1 = `search-${searchRandom}-file-locked1.docx`; let fileLockedSearch1Id: string; - const fileLockedSearch2 = `search-file-locked2-${Utils.random()}.docx`; + const fileLockedSearch2 = `search-${searchRandom}-file-locked2.docx`; let fileLockedSearch2Id: string; const parentPF = `parentPersonal-${Utils.random()}`; @@ -116,8 +117,6 @@ describe('Upload new version', () => { describe('on Search Results', () => { beforeAll(async (done) => { - const initialSearchTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f'); - fileId = (await apis.user.upload.uploadFile(file, parentSearchId)).entry.id; fileSearch1Id = (await apis.user.nodes.createFile(fileSearch1, parentSearchId)).entry.id; fileSearch2Id = (await apis.user.nodes.createFile(fileSearch2, parentSearchId)).entry.id; @@ -130,7 +129,7 @@ describe('Upload new version', () => { await apis.user.nodes.lockFile(fileLockedSearch1Id); await apis.user.nodes.lockFile(fileLockedSearch2Id); - await apis.user.search.waitForNodes('search-f', { expect: initialSearchTotalItems + 6 }); + await apis.user.search.waitForNodes(searchRandom, { expect: 6 }); await loginPage.loginWith(username); done(); @@ -455,9 +454,8 @@ describe('Upload new version', () => { await apis.user.nodes.lockFile(fileLocked1Id); await apis.user.nodes.lockFile(fileLocked2Id); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([fileId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id, fileLocked2Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 }); + await apis.user.shared.waitForFilesToBeShared([fileId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id, fileLocked2Id]); await loginPage.loginWith(username); done(); diff --git a/e2e/suites/actions/version-actions.test.ts b/e2e/suites/actions/upload-download/version-actions.test.ts similarity index 74% rename from e2e/suites/actions/version-actions.test.ts rename to e2e/suites/actions/upload-download/version-actions.test.ts index 272ecec33..53e56273f 100644 --- a/e2e/suites/actions/version-actions.test.ts +++ b/e2e/suites/actions/upload-download/version-actions.test.ts @@ -23,17 +23,16 @@ * along with Alfresco. If not, see . */ -import { AdminActions, LoginPage, BrowsingPage, FILES, RepoClient, Utils, UploadNewVersionDialog } from '@alfresco/aca-testing-shared'; -import { VersionManagePage } from '../../../projects/aca-testing-shared/src/components/version-manage/version-manager'; -import { Viewer } from '../../../projects/aca-testing-shared/src/components'; +import { AdminActions, LoginPage, BrowsingPage, FILES, RepoClient, Utils, ManageVersionsDialog, Viewer } from '@alfresco/aca-testing-shared'; import { browser } from 'protractor'; -import { BrowserActions } from '@alfresco/adf-testing'; +import { Logger } from '@alfresco/adf-testing'; -describe('Version component actions', () => { - const versionManagePage = new VersionManagePage(); - const viewerPage = new Viewer(); +describe('Version actions', () => { + const random = Utils.random(); - const username = `user-${Utils.random()}`; + const username = `user-${random}`; + const parentFolder = `parent-${random}`; + let parentFolderId: string; let fileId: string; @@ -46,54 +45,57 @@ describe('Version component actions', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const uploadNewVersionDialog = new UploadNewVersionDialog(); + const versionManagePage = new ManageVersionsDialog(); + const viewerPage = new Viewer(); const { searchInput } = page.header; const adminApiActions = new AdminActions(); - beforeAll(async (done) => { - await adminApiActions.createUser({ username }); - fileId = (await apis.user.upload.uploadFile(filesToUpload[0])).entry.id; - await apis.user.shared.shareFilesByIds([fileId]); - await loginPage.loginWith(username); + beforeAll(async () => { + try { + await adminApiActions.createUser({ username }); - for (let i = 0; i < filesToUpload.length - 1; i++) { - await dataTable.selectItem(filesToUpload[i]); - await toolbar.clickMoreActionsUploadNewVersion(); - await Utils.uploadFileNewVersion(filesToUpload[i + 1]); + parentFolderId = (await apis.user.nodes.createFolder(parentFolder)).entry.id; - await page.waitForDialog(); + fileId = (await apis.user.upload.uploadFile(filesToUpload[0], parentFolderId)).entry.id; - await BrowserActions.click(uploadNewVersionDialog.majorOption); + await apis.user.shared.shareFilesByIds([fileId]); + await apis.user.favorites.addFavoritesByIds('file', [fileId]); - await uploadNewVersionDialog.enterDescription('new major version description'); - await BrowserActions.click(uploadNewVersionDialog.uploadButton); + for (let i = 0; i < filesToUpload.length - 1; i++) { + await apis.user.nodes.updateNodeContent( + fileId, + `${browser.params.e2eRootPath}/resources/test-files/${filesToUpload[i + 1]}`, + true, + 'new major version description', + filesToUpload[i + 1] + ); + } - await uploadNewVersionDialog.waitForDialogToClose(); + await loginPage.loginWith(username); + await dataTable.doubleClickOnRowByName(parentFolder); + await dataTable.waitForHeader(); + } catch (error) { + Logger.error(`--- beforeAll failed : ${error}`); } - done(); }); - afterAll(async (done) => { - await apis.user.nodes.deleteNodeById(fileId); - done(); + afterAll(async () => { + await apis.user.nodes.deleteNodeById(parentFolderId); }); describe('on Personal Files', () => { - beforeAll(async (done) => { + beforeEach(async () => { await page.clickPersonalFilesAndWait(); - done(); - }); - - beforeEach(async (done) => { + await dataTable.doubleClickOnRowByName(parentFolder); + await dataTable.waitForHeader(); await dataTable.selectItem(filesToUpload[4]); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('1.0'); - done(); }); - afterEach(async (done) => { - await viewerPage.clickCloseButton(); - done(); + afterEach(async () => { + await page.closeOpenDialogs(); + await Utils.pressEscape(); }); it('[C586766] Should be possible to view a previous document version', async () => { @@ -112,13 +114,9 @@ describe('Version component actions', () => { }); describe('on Shared Files', () => { - beforeAll(async (done) => { - await page.clickSharedFilesAndWait(); - done(); - }); - beforeEach(async (done) => { - await dataTable.selectItem(filesToUpload[4]); + await page.clickSharedFilesAndWait(); + await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('2.0'); done(); @@ -145,13 +143,9 @@ describe('Version component actions', () => { }); describe('on Recent Files', () => { - beforeAll(async (done) => { - await page.clickRecentFilesAndWait(); - done(); - }); - beforeEach(async (done) => { - await dataTable.selectItem(filesToUpload[4]); + await page.clickRecentFilesAndWait(); + await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('3.0'); done(); @@ -178,15 +172,9 @@ describe('Version component actions', () => { }); describe('on Favorite Files', () => { - beforeAll(async (done) => { - await apis.user.favorites.addFavoritesByIds('file', [fileId]); - await apis.user.favorites.waitForApi({ expect: 1 }); - await page.clickFavoritesAndWait(); - done(); - }); - beforeEach(async (done) => { - await dataTable.selectItem(filesToUpload[4]); + await page.clickFavoritesAndWait(); + await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('4.0'); done(); @@ -213,16 +201,14 @@ describe('Version component actions', () => { }); describe('on Search Results', () => { - beforeAll(async (done) => { - await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); - await searchInput.searchFor(filesToUpload[4]); - await dataTable.waitForBody(); - done(); - }); - beforeEach(async (done) => { - await dataTable.selectItem(filesToUpload[4], 'Personal Files'); + await page.clickPersonalFiles(); + await searchInput.clickSearchButton(); + await searchInput.checkOnlyFiles(); + await searchInput.searchFor(`${filesToUpload[4]} AND PARENT:"workspace://SpacesStore/${parentFolderId}"`); + await dataTable.waitForBody(); + + await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('5.0'); done(); diff --git a/e2e/suites/authentication/login.test.ts b/e2e/suites/authentication/login.test.ts index 3557d4770..5211da143 100755 --- a/e2e/suites/authentication/login.test.ts +++ b/e2e/suites/authentication/login.test.ts @@ -115,8 +115,7 @@ describe('Login', () => { expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES); }); - // TODO: ACA-245 - xit('[C213107] redirects to Home Page when navigating to the Login page while already logged in', async () => { + it('[C213107] redirects to Home Page when navigating to the Login page while already logged in', async () => { const { username } = johnDoe; await loginPage.loginWith(username); @@ -143,7 +142,7 @@ describe('Login', () => { describe('with invalid credentials', () => { const { login: loginComponent } = loginPage; - const { submitButton, errorMessage } = loginComponent; + const { submitButton } = loginComponent; beforeEach(async (done) => { await loginPage.load(); @@ -160,32 +159,9 @@ describe('Login', () => { expect(await submitButton.isEnabled()).toBe(false, 'submit button is enabled'); }); - it('[C213093] shows error when entering nonexistent user', async () => { - await loginPage.tryLoginWith('nonexistent-user', 'any-password'); - expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); - expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed'); - expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`); - }); - - it('[C280071] shows error when entering invalid password', async () => { - const { username } = johnDoe; - - await loginPage.tryLoginWith(username, 'incorrect-password'); - expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); - expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed'); - expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`); - }); - it('[C213106] unauthenticated user is redirected to Login page', async () => { await navigate(APP_ROUTES.PERSONAL_FILES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); }); - - it('[C213100] disabled user is not logged in', async () => { - await loginPage.tryLoginWith(disabledUser); - expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.LOGIN); - expect(await errorMessage.isDisplayed()).toBe(true, 'error message is not displayed'); - expect(await errorMessage.getText()).toBe(`You've entered an unknown username or password`); - }); }); }); diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/suites/info-drawer/comments.test.ts index 746210d9c..e859b5633 100755 --- a/e2e/suites/info-drawer/comments.test.ts +++ b/e2e/suites/info-drawer/comments.test.ts @@ -87,9 +87,8 @@ describe('Comments', () => { comment1File2Entry = await userActions.createComment(fileWith2CommentsId, 'first comment'); comment2File2Entry = await userActions.createComment(fileWith2CommentsId, 'second comment'); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 }); + await apis.user.shared.waitForFilesToBeShared([file2SharedId, fileWith1CommentId, fileWith2CommentsId]); await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]); diff --git a/e2e/suites/list-views/permissions.test.ts b/e2e/suites/list-views/permissions.test.ts index 478d7437c..989118740 100755 --- a/e2e/suites/list-views/permissions.test.ts +++ b/e2e/suites/list-views/permissions.test.ts @@ -40,8 +40,6 @@ describe('Special permissions', () => { const adminApiActions = new AdminActions(); const userActions = new UserActions(); - let initialSharedTotalItems: number; - beforeAll(async (done) => { await adminApiActions.login(); await adminApiActions.createUser({ username }); @@ -52,7 +50,7 @@ describe('Special permissions', () => { describe('file not displayed if user no longer has permissions on it', () => { const sitePrivate = `private-${Utils.random()}`; const fileName = `file-${Utils.random()}.txt`; - let fileId; + let fileId: string; beforeAll(async (done) => { await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE); @@ -61,13 +59,11 @@ describe('Special permissions', () => { fileId = (await adminApiActions.nodes.createFile(fileName, docLibId)).entry.id; await apis.user.favorites.addFavoriteById('file', fileId); - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await adminApiActions.shareNodes([fileId]); - await apis.user.nodes.editNodeContent(fileId, 'edited by user'); + await apis.user.nodes.updateNodeContent(fileId, 'edited by user'); await apis.user.search.waitForApi(username, { expect: 1 }); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 }); + await adminApiActions.shared.waitForFilesToBeShared([fileId]); await loginPage.loginWith(username); done(); @@ -136,9 +132,8 @@ describe('Special permissions', () => { fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id; await apis.user.favorites.addFavoriteById('file', fileId); - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([fileId]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 }); + await apis.user.shared.waitForFilesToBeShared([fileId]); await apis.user.search.waitForApi(username, { expect: 1 }); await adminApiActions.sites.deleteSiteMember(sitePrivate, username); diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/suites/list-views/shared-files.test.ts index 0c92a180d..3fb8ad785 100755 --- a/e2e/suites/list-views/shared-files.test.ts +++ b/e2e/suites/list-views/shared-files.test.ts @@ -43,8 +43,6 @@ describe('Shared Files', () => { const file4User = `file4-${Utils.random()}.txt`; let file4Id: string; - let initialSharedTotalItems: number; - const apis = { user: new RepoClient(username, password) }; @@ -67,16 +65,18 @@ describe('Shared Files', () => { file3Id = (await apis.user.nodes.createFile(file3User)).entry.id; file4Id = (await apis.user.nodes.createFile(file4User)).entry.id; - initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); - await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]); + + await adminApiActions.login(); await adminApiActions.shareNodes([nodeId]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 }); + + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]); + await adminApiActions.shared.waitForFilesToBeShared([nodeId]); await apis.user.nodes.deleteNodeById(file2Id); - await apis.user.shared.unshareFile(file3User); + await apis.user.shared.unshareFileById(file3Id); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 }); + await apis.user.shared.waitForFilesToNotBeShared([file2Id, file3Id]); await loginPage.loginWith(username); done(); diff --git a/e2e/suites/list-views/tooltips.test.ts b/e2e/suites/list-views/tooltips.test.ts index 1a9606600..ce6b00245 100755 --- a/e2e/suites/list-views/tooltips.test.ts +++ b/e2e/suites/list-views/tooltips.test.ts @@ -78,12 +78,10 @@ describe('File / folder tooltips', () => { file7Id = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)).entry.id; file8Id = (await apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle)).entry.id; - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); - await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 8 }); + await apis.user.shared.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]); await loginPage.loginWith(username); done(); @@ -175,46 +173,6 @@ describe('File / folder tooltips', () => { }); }); - // disabled until ACA-518 is done - xdescribe('on Shared Files', () => { - beforeAll(async (done) => { - await page.clickSharedFilesAndWait(); - done(); - }); - - xit('[C280143] File with name, no title, no description', async () => { - expect(await dataTable.getItemNameTooltip(file)).toEqual(`${file}`); - }); - - xit('[C280144] File with name and description, no title', async () => { - expect(await dataTable.getItemNameTooltip(fileWithDesc)).toEqual(`${fileWithDesc}\n${fileDescription}`); - }); - - xit('[C280145] File with name and title, no description', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitle)).toEqual(`${fileWithTitle}\n${fileTitle}`); - }); - - xit('[C280146] File with name and title and description, all different', async () => { - expect(await dataTable.getItemNameTooltip(fileWithTitleAndDesc)).toEqual(`${fileTitle}\n${fileDescription}`); - }); - - xit('[C280147] File with name and title and description, all equal', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleEqDesc)).toEqual(`${fileNameEqTitleEqDesc}`); - }); - - xit('[C280148] File with name = title, different description', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqTitleDiffDesc)).toEqual(`${fileNameEqTitleDiffDesc}\n${fileDescription}`); - }); - - xit('[C280149] File with name = description, different title', async () => { - expect(await dataTable.getItemNameTooltip(fileNameEqDescDiffTitle)).toEqual(`${fileTitle}\n${fileNameEqDescDiffTitle}`); - }); - - xit('[C280150] File with title = description, different name', async () => { - expect(await dataTable.getItemNameTooltip(fileTitleEqDesc)).toEqual(`${fileTitle}`); - }); - }); - describe('on Favorites', () => { beforeAll(async (done) => { await page.clickFavoritesAndWait(); diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/suites/list-views/trash.test.ts index 80bdec1fa..f0240b62f 100755 --- a/e2e/suites/list-views/trash.test.ts +++ b/e2e/suites/list-views/trash.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; +import { Logger } from '@alfresco/adf-testing'; describe('Trash', () => { const username = `user-${Utils.random()}`; @@ -64,54 +65,59 @@ describe('Trash', () => { const userActions = new UserActions(); beforeAll(async () => { - await adminApiActions.login(); - await adminApiActions.createUser({ username }); - await userActions.login(username, username); + try { + await adminApiActions.login(); + await adminApiActions.createUser({ username }); - fileAdminId = (await adminApiActions.nodes.createFiles([fileAdmin])).entry.id; - folderAdminId = (await adminApiActions.nodes.createFolders([folderAdmin])).entry.id; - await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); - await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); - const docLibId = await adminApiActions.sites.getDocLibId(siteName); - fileSiteId = (await adminApiActions.nodes.createFile(fileSite, docLibId)).entry.id; - fileUserId = (await apis.user.nodes.createFiles([fileUser])).entry.id; - folderUserId = (await apis.user.nodes.createFolders([folderUser])).entry.id; - folderDeletedId = (await apis.user.nodes.createFolder(folderDeleted)).entry.id; - fileDeletedId = (await apis.user.nodes.createFiles([fileDeleted], folderDeleted)).entry.id; - folderNotDeletedId = (await apis.user.nodes.createFolder(folderNotDeleted)).entry.id; - fileInFolderId = (await apis.user.nodes.createFiles([fileInFolder], folderNotDeleted)).entry.id; + fileAdminId = (await adminApiActions.nodes.createFiles([fileAdmin])).entry.id; + folderAdminId = (await adminApiActions.nodes.createFolders([folderAdmin])).entry.id; + await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); + await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); + const docLibId = await adminApiActions.sites.getDocLibId(siteName); + fileSiteId = (await adminApiActions.nodes.createFile(fileSite, docLibId)).entry.id; - await adminApiActions.nodes.deleteNodesById([fileAdminId, folderAdminId], false); - await apis.user.nodes.deleteNodesById([fileSiteId, fileUserId, folderUserId, fileInFolderId], false); - await apis.user.nodes.deleteNodeById(fileDeletedId, false); - await apis.user.nodes.deleteNodeById(folderDeletedId, false); + await adminApiActions.nodes.deleteNodesById([fileAdminId, folderAdminId], false); + + fileUserId = (await apis.user.nodes.createFiles([fileUser])).entry.id; + folderUserId = (await apis.user.nodes.createFolders([folderUser])).entry.id; + folderDeletedId = (await apis.user.nodes.createFolder(folderDeleted)).entry.id; + fileDeletedId = (await apis.user.nodes.createFiles([fileDeleted], folderDeleted)).entry.id; + folderNotDeletedId = (await apis.user.nodes.createFolder(folderNotDeleted)).entry.id; + fileInFolderId = (await apis.user.nodes.createFiles([fileInFolder], folderNotDeleted)).entry.id; + + await apis.user.nodes.deleteNodesById([fileSiteId, fileUserId, folderUserId, fileInFolderId, fileDeletedId, folderDeletedId], false); + } catch (error) { + Logger.error(`----- beforeAll failed : ${error}`); + } }); - afterAll(async (done) => { - await adminApiActions.sites.deleteSite(siteName); - await adminApiActions.trashcanApi.deleteDeletedNode(fileAdminId); - await adminApiActions.trashcanApi.deleteDeletedNode(folderAdminId); - await apis.user.nodes.deleteNodeById(folderNotDeletedId); - await userActions.emptyTrashcan(); - done(); + afterAll(async () => { + try { + await adminApiActions.sites.deleteSite(siteName); + await adminApiActions.trashcanApi.deleteDeletedNode(fileAdminId); + await adminApiActions.trashcanApi.deleteDeletedNode(folderAdminId); + await apis.user.nodes.deleteNodeById(folderNotDeletedId); + await userActions.login(username, username); + await userActions.emptyTrashcan(); + } catch (error) { + Logger.error(`----- afterAll failed : ${error}`); + } }); describe('as admin', () => { - beforeAll(async (done) => { + beforeAll(async () => { await loginPage.loginWithAdmin(); - done(); }); - beforeEach(async (done) => { + beforeEach(async () => { await page.clickTrashAndWait(); - done(); }); it('[C213217] has the correct columns', async () => { const expectedColumns = ['Name', 'Location', 'Size', 'Deleted', 'Deleted by']; const actualColumns = await dataTable.getColumnHeadersText(); - await expect(actualColumns).toEqual(expectedColumns); + expect(actualColumns).toEqual(expectedColumns); }); it('[C280493] displays the files and folders deleted by everyone', async () => { @@ -124,21 +130,19 @@ describe('Trash', () => { }); describe('as user', () => { - beforeAll(async (done) => { + beforeAll(async () => { await loginPage.loginWith(username); - done(); }); - beforeEach(async (done) => { + beforeEach(async () => { await page.clickTrashAndWait(); - done(); }); it('[C280494] has the correct columns', async () => { const expectedColumns = ['Name', 'Location', 'Size', 'Deleted']; const actualColumns = await dataTable.getColumnHeadersText(); - await expect(actualColumns).toEqual(expectedColumns); + expect(actualColumns).toEqual(expectedColumns); }); it('[C213218] displays the files and folders deleted by the user', async () => { diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index a961bcade..eaf83d3ed 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -219,6 +219,9 @@ describe('Breadcrumb', () => { it(`[C260970] Breadcrumb on navigation to a user's home`, async () => { await page.dataTable.doubleClickOnRowByName('User Homes'); await page.dataTable.doubleClickOnRowByName(user2); + + await browser.sleep(4000); + expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', 'User Homes', user2]); await page.dataTable.doubleClickOnRowByName(userFolder); expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', 'User Homes', user2, userFolder]); diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/suites/navigation/single-click.test.ts index e9e8b5332..e82e42270 100755 --- a/e2e/suites/navigation/single-click.test.ts +++ b/e2e/suites/navigation/single-click.test.ts @@ -135,9 +135,8 @@ describe('Single click on item name', () => { describe('on Shared Files', () => { beforeAll(async () => { - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([file1Id]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 }); + await apis.user.shared.waitForFilesToBeShared([file1Id]); }); beforeEach(async () => { diff --git a/e2e/suites/pagination/multiple-pages-files.test.ts b/e2e/suites/pagination/multiple-pages-files.test.ts index 878f0a409..6b38d333c 100644 --- a/e2e/suites/pagination/multiple-pages-files.test.ts +++ b/e2e/suites/pagination/multiple-pages-files.test.ts @@ -45,7 +45,6 @@ describe('Pagination on multiple pages : ', () => { const userApi = new RepoClient(username, username); const adminApiActions = new AdminActions(); - let initialSharedTotalItems: number; let initialFavoritesTotalItems: number; let initialSearchTotalItems: number; @@ -57,7 +56,6 @@ describe('Pagination on multiple pages : ', () => { parentId = (await userApi.nodes.createFolder(parent)).entry.id; filesIds = (await userApi.nodes.createFiles(files, parent)).list.entries.map((entries: any) => entries.entry.id); - initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); initialFavoritesTotalItems = await userApi.favorites.getFavoritesTotalItems(); await userApi.shared.shareFilesByIds(filesIds); await userApi.favorites.addFavoritesByIds('file', filesIds); @@ -87,7 +85,7 @@ describe('Pagination on multiple pages : ', () => { describe('on Shared Files', () => { beforeAll(async () => { - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 51 }); + await userApi.shared.waitForFilesToBeShared(filesIds); }); sharedFilesTests(username); }); diff --git a/e2e/suites/pagination/single-page.test.ts b/e2e/suites/pagination/single-page.test.ts index b7066e2b1..d5c966a8a 100755 --- a/e2e/suites/pagination/single-page.test.ts +++ b/e2e/suites/pagination/single-page.test.ts @@ -55,7 +55,6 @@ describe('Pagination on single page', () => { const initialFavoriteTotalItems = await userApi.favorites.getFavoritesTotalItems(); const initialRecentFilesTotalItems = await userApi.search.getTotalItems(username); - const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); const initialTrashTotalItems = await userActions.getTrashcanSize(); fileId = (await userApi.nodes.createFile(file)).entry.id; @@ -68,7 +67,7 @@ describe('Pagination on single page', () => { await userApi.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 }); await userApi.search.waitForApi(username, { expect: initialRecentFilesTotalItems + 1 }); - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 1 }); + await userApi.shared.waitForFilesToBeShared([fileId]); await userActions.waitForTrashcanSize(initialTrashTotalItems + 1); await loginPage.loginWith(username); diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts index f5cd6ae05..c1b25b8b7 100644 --- a/e2e/suites/search/search-results-files-folders.test.ts +++ b/e2e/suites/search/search-results-files-folders.test.ts @@ -27,23 +27,24 @@ import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils } from '@ const moment = require('moment'); describe('Search results - files and folders', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + const username = `user-${random}`; - const file = `test-file-${Utils.random()}.txt`; + const file = `test-file-${random}.txt`; let fileId: string; const fileTitle = 'file title'; const fileDescription = 'file description'; /* cspell:disable-next-line */ - const fileRussian = `любимый-сайт-${Utils.random()}`; + const fileRussian = `любимый-сайт-${random}`; let fileRussianId: string; - const folder = `test-folder-${Utils.random()}`; + const folder = `test-folder-${random}`; let folderId: string; const folderTitle = 'folder title'; const folderDescription = 'folder description'; - const site = `test-site-${Utils.random()}`; + const site = `test-site-${random}`; const apis = { user: new RepoClient(username, username) @@ -59,7 +60,7 @@ describe('Search results - files and folders', () => { await adminApiActions.createUser({ username }); fileId = (await apis.user.nodes.createFile(file, '-my-', fileTitle, fileDescription)).entry.id; - await apis.user.nodes.editNodeContent(fileId, 'edited by user'); + await apis.user.nodes.updateNodeContent(fileId, 'edited by user'); folderId = (await apis.user.nodes.createFolder(folder, '-my-', folderTitle, folderDescription)).entry.id; fileRussianId = (await apis.user.nodes.createFile(fileRussian)).entry.id; await apis.user.sites.createSite(site); @@ -89,7 +90,7 @@ describe('Search results - files and folders', () => { it('[C307002] Results page title', async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('test-'); + await searchInput.searchFor(random); await dataTable.waitForBody(); expect(await page.breadcrumb.currentItem.getText()).toEqual('Search Results'); @@ -98,7 +99,7 @@ describe('Search results - files and folders', () => { it('[C279183] File information', async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('test-'); + await searchInput.searchFor(random); await dataTable.waitForBody(); const fileEntry = await apis.user.nodes.getNodeById(fileId); @@ -118,7 +119,7 @@ describe('Search results - files and folders', () => { it('[C306867] Folder information', async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('test-'); + await searchInput.searchFor(random); await dataTable.waitForBody(); const folderEntry = await apis.user.nodes.getNodeById(folderId); diff --git a/e2e/suites/search/search-results-general.test.ts b/e2e/suites/search/search-results-general.test.ts index 508c7816e..cc392b415 100644 --- a/e2e/suites/search/search-results-general.test.ts +++ b/e2e/suites/search/search-results-general.test.ts @@ -27,13 +27,14 @@ import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils } from '@ import { browser } from 'protractor'; describe('Search results general', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + const username = `user-${random}`; - const file = `test-file-${Utils.random()}.txt`; + const file = `test-file-${random}.txt`; let fileId: string; - const folder = `test-folder-${Utils.random()}`; + const folder = `test-folder-${random}`; let folderId: string; - const site = `test-site-${Utils.random()}`; + const site = `test-site-${random}`; const apis = { user: new RepoClient(username, username) @@ -72,7 +73,7 @@ describe('Search results general', () => { it('[C290005] Only files are returned when Files option is the only one checked', async () => { await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); - await searchInput.searchFor('test'); + await searchInput.searchFor(random); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(file)).toBe(true, `${file} not displayed`); @@ -83,7 +84,7 @@ describe('Search results general', () => { it('[C290006] Only folders are returned when Folders option is the only one checked', async () => { await searchInput.clickSearchButton(); await searchInput.checkOnlyFolders(); - await searchInput.searchFor('test'); + await searchInput.searchFor(random); await page.waitForResults(); expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); @@ -94,7 +95,7 @@ describe('Search results general', () => { it('[C290007] Files and folders are returned when both Files and Folders options are checked', async () => { await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); - await searchInput.searchFor('test'); + await searchInput.searchFor(random); await page.waitForResults(); expect(await dataTable.isItemPresent(file)).toBe(true, `${file} not displayed`); @@ -105,7 +106,7 @@ describe('Search results general', () => { it('[C290008] Only libraries are returned when Libraries option is checked', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('test'); + await searchInput.searchFor(random); await page.waitForResults(); expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts index 2ead68df4..185291774 100644 --- a/e2e/suites/search/search-results-libraries.test.ts +++ b/e2e/suites/search/search-results-libraries.test.ts @@ -26,41 +26,42 @@ import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/aca-testing-shared'; describe('Search results - libraries', () => { - const username = `user-${Utils.random()}`; + const random = Utils.random(); + const username = `user-${random}`; const site1 = { - name: `lib-1-${Utils.random()}`, - id: `site1-${Utils.random()}` + name: `lib-${random}-1`, + id: `site-${random}-1` }; const site2 = { - name: `site-2-${Utils.random()}`, - id: `site1-${Utils.random()}` + name: `site-2-${random}`, + id: `site-${random}-2` }; const site3 = { - name: `my-lib-${Utils.random()}`, - id: `site3-${Utils.random()}` + name: `my-lib-${random}`, + id: `site3-${random}` }; const site4 = { - name: `my-site-${Utils.random()}`, - id: `site4-${Utils.random()}`, + name: `my-site-${random}`, + id: `site4-${random}`, description: 'site description' }; - const userSitePrivate = `user-site-private-${Utils.random()}`; - const userSiteModerated = `user-site-moderated-${Utils.random()}`; - const userSitePublic = `user-site-public-${Utils.random()}`; + const userSitePrivate = `user-site-${random}-private`; + const userSiteModerated = `user-site-${random}-moderated`; + const userSitePublic = `user-site-${random}-public`; const siteRussian = { /* cspell:disable-next-line */ - name: `любимый-сайт-${Utils.random()}`, - id: `site-russian-id-${Utils.random()}` + name: `любимый-сайт-${random}`, + id: `site-russian-id-${random}` }; - const adminSite1 = `admin-site-${Utils.random()}`; - const adminSite2 = `admin-site-${Utils.random()}`; - const adminSite3 = `admin-site-${Utils.random()}`; - const adminSite4 = `admin-site-${Utils.random()}`; - const adminPrivate = `admin-site-${Utils.random()}`; + const adminSite1 = `admin-${random}-site1`; + const adminSite2 = `admin-${random}-site2`; + const adminSite3 = `admin-${random}-site3`; + const adminSite4 = `admin-${random}-site4`; + const adminPrivate = `admin-${random}-sitePrivate`; const apis = { user: new RepoClient(username, username) @@ -97,25 +98,35 @@ describe('Search results - libraries', () => { await adminApiActions.sites.createSite(adminPrivate, SITE_VISIBILITY.PRIVATE); - await apis.user.sites.waitForApi({ expect: 12 }); - await apis.user.queries.waitForSites('lib', { expect: 2 }); - await apis.user.queries.waitForSites('my-site', { expect: 1 }); + await adminApiActions.login(); + await adminApiActions.sites.waitForSitesToBeCreated([adminSite1, adminSite2, adminSite3, adminSite4]); + + await apis.user.sites.waitForSitesToBeCreated([ + site1.id, + site2.id, + site3.id, + site4.id, + userSitePublic, + userSiteModerated, + userSitePrivate, + siteRussian.id + ]); + + await apis.user.queries.waitForSites(random, { expect: 12 }); await loginPage.loginWith(username); done(); }); - afterAll(async (done) => { - await Promise.all([ - adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate]), - apis.user.sites.deleteSites([site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id]) - ]); - done(); + afterAll(async () => { + await adminApiActions.login(); + await adminApiActions.sites.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate]); + await apis.user.sites.deleteSites([site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id]); }); - beforeEach(async (done) => { + beforeEach(async () => { await Utils.pressEscape(); - done(); + await page.clickPersonalFiles(); }); it('[C290012] Search library - full name match', async () => { @@ -133,7 +144,7 @@ describe('Search results - libraries', () => { it('[C290013] Search library - partial name match', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('lib'); + await searchInput.searchFor(`lib-${random}`); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`); @@ -157,7 +168,7 @@ describe('Search results - libraries', () => { it('[C290015] Results page title', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('lib'); + await searchInput.searchFor(random); await dataTable.waitForBody(); expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...'); @@ -178,7 +189,7 @@ describe('Search results - libraries', () => { it('[C290017] Library visibility is correctly displayed', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('user-site'); + await searchInput.searchFor(`user-site-${random}`); await dataTable.waitForBody(); const expectedSitesVisibility = { @@ -197,7 +208,7 @@ describe('Search results - libraries', () => { it('[C290018] User role is correctly displayed', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('admin-site'); + await searchInput.searchFor(`admin-${random}-site`); await dataTable.waitForBody(); const expectedSitesRoles = { @@ -217,7 +228,7 @@ describe('Search results - libraries', () => { it('[C290019] Private sites are not displayed when user is not a member', async () => { await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor('admin-site'); + await searchInput.searchFor(`admin-${random}-site`); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(adminPrivate)).toBe(false, `${adminPrivate} is displayed`); diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts index af5d1083e..c9ba7177b 100644 --- a/e2e/suites/search/search-sorting.test.ts +++ b/e2e/suites/search/search-sorting.test.ts @@ -35,12 +35,12 @@ describe('Search sorting', () => { let parentId: string; const fileJpg = { - name: `search-sort-file-1-${random}.jpg`, + name: `search-sort-${random}-file-1.jpg`, source: FILES.jpgFile }; const filePdf = { - name: `search-sort-file-2-${random}.pdf`, + name: `search-sort-${random}-file-2.pdf`, title: 'search sort title', description: 'search sort', source: FILES.pdfFile @@ -67,7 +67,7 @@ describe('Search sorting', () => { await apis.user1.upload.uploadFileWithRename(fileJpg.source, parentId, fileJpg.name); await apis.user2.upload.uploadFileWithRename(filePdf.source, parentId, filePdf.name, filePdf.title, filePdf.description); - await apis.user1.search.waitForNodes('search-sort', { expect: 2 }); + await apis.user1.search.waitForNodes(`search-sort-${random}`, { expect: 2 }); await loginPage.loginWith(user1); done(); @@ -78,7 +78,7 @@ describe('Search sorting', () => { await page.clickPersonalFilesAndWait(); await searchInput.clickSearchButton(); - await searchInput.searchFor('search sort'); + await searchInput.searchFor(`search sort ${random}`); await dataTable.waitForBody(); done(); }); diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/suites/viewer/viewer-actions.test.ts index 60b8feb7c..c58506be0 100755 --- a/e2e/suites/viewer/viewer-actions.test.ts +++ b/e2e/suites/viewer/viewer-actions.test.ts @@ -288,8 +288,7 @@ describe('Viewer actions', () => { await manageVersionsDialog.clickClose(); }); - // TODO: disabled until ACA-2176 is done - xit('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => { + it('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => { await dataTable.doubleClickOnRowByName(docxPersonalFiles); await viewer.waitForViewerToOpen(); @@ -714,7 +713,6 @@ describe('Viewer actions', () => { await apis.user.nodes.lockFile(fileForCancelEditingId); await apis.user.nodes.lockFile(fileForUploadNewVersionId); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await apis.user.shared.shareFilesByIds([ docxFileId, xlsxFileId, @@ -724,7 +722,15 @@ describe('Viewer actions', () => { fileForUploadNewVersionId, fileSharedId ]); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 }); + await apis.user.shared.waitForFilesToBeShared([ + docxFileId, + xlsxFileId, + pdfFileId, + fileForCancelEditingId, + fileForEditOfflineId, + fileForUploadNewVersionId, + fileSharedId + ]); await loginPage.loginWith(username); done(); diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts index 7a4ecfb56..51572f9b3 100755 --- a/e2e/suites/viewer/viewer-general.test.ts +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -73,12 +73,11 @@ describe('Viewer general', () => { docLibSiteUserId = await apis.user.sites.getDocLibId(siteUser); await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId); - const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems(); await userActions.shareNodes([xlsxFileId]); - await apis.user.favorites.addFavoriteById('file', xlsxFileId); + await apis.user.favorites.waitForApi({ expect: 2 }); - await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 }); + await apis.user.shared.waitForFilesToBeShared([xlsxFileId]); await loginPage.loginWith(username); done(); diff --git a/projects/aca-testing-shared/src/components/dialog/manage-versions-dialog.ts b/projects/aca-testing-shared/src/components/dialog/manage-versions-dialog.ts index 35598be52..5f1e8c299 100755 --- a/projects/aca-testing-shared/src/components/dialog/manage-versions-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/manage-versions-dialog.ts @@ -26,10 +26,13 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; import { BrowserActions } from '@alfresco/adf-testing'; +import { Menu } from '../menu/menu'; export class ManageVersionsDialog extends GenericDialog { closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close')); + menu = new Menu(); + constructor() { super('.aca-node-versions-dialog'); } @@ -38,4 +41,14 @@ export class ManageVersionsDialog extends GenericDialog { await BrowserActions.click(this.closeButton); await this.waitForDialogToClose(); } + + async clickActionButton(version: string): Promise { + await BrowserActions.click(this.childElement(by.id(`adf-version-list-action-menu-button-${version}`))); + await this.menu.waitForMenuToOpen(); + } + + async viewFileVersion(version: string): Promise { + await this.clickActionButton(version); + await this.menu.clickMenuItem('View'); + } } diff --git a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts index 39d216124..d20a8492a 100755 --- a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts +++ b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts @@ -84,16 +84,7 @@ export class Toolbar extends Component { await this.menu.waitForMenuToOpen(); } - async closeMoreMenu(): Promise { - await this.isButtonPresent('More Actions'); - - const moreMenu = this.getButtonByTitleAttribute('More Actions'); - await BrowserActions.click(moreMenu); - - await this.menu.waitForMenuToClose(); - } - - async closeMoreMenuEscape() { + async closeMoreMenu() { await Utils.pressEscape(); } diff --git a/projects/aca-testing-shared/src/components/version-manage/version-manager.ts b/projects/aca-testing-shared/src/components/version-manage/version-manager.ts deleted file mode 100644 index 9347146e5..000000000 --- a/projects/aca-testing-shared/src/components/version-manage/version-manager.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2020 Alfresco Software Limited - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; -import { by, element, ElementFinder } from 'protractor'; - -export class VersionManagePage { - async clickActionButton(version: string): Promise { - await BrowserActions.click(element(by.id(`adf-version-list-action-menu-button-${version}`))); - await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.cdk-overlay-container .mat-menu-content'))); - } - - async viewFileVersion(version: string): Promise { - await this.clickActionButton(version); - const viewButton: ElementFinder = element(by.id(`adf-version-list-action-view-${version}`)); - await BrowserActions.click(viewButton); - } -} diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts index 9066372d8..5a23c9b2e 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts @@ -406,12 +406,23 @@ export class NodesApi extends RepoApi { } } - async editNodeContent(nodeId: string, content: string): Promise { + async updateNodeContent( + nodeId: string, + content: string, + majorVersion: boolean = true, + comment?: string, + newName?: string + ): Promise { try { + const opts = { + majorVersion, + comment, + name: newName + }; await this.apiAuth(); - return await this.nodesApi.updateNodeContent(nodeId, content); + return await this.nodesApi.updateNodeContent(nodeId, content, opts); } catch (error) { - this.handleError(`${this.constructor.name} ${this.editNodeContent.name}`, error); + this.handleError(`${this.constructor.name} ${this.updateNodeContent.name}`, error); return null; } } diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts index 5ab8ba1fa..2a50a2436 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/shared-links/shared-links-api.ts @@ -64,10 +64,10 @@ export class SharedLinksApi extends RepoApi { return sharedLinks; } - async getSharedIdOfNode(name: string): Promise { + async getSharedIdOfNode(fileId: string): Promise { try { const sharedLinksEntries = (await this.getSharedLinks())?.list.entries; - const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.name === name); + const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId); return (found || { entry: { id: null } }).entry.id; } catch (error) { this.handleError(`SharedLinksApi getSharedIdOfNode : catch : `, error); @@ -75,20 +75,20 @@ export class SharedLinksApi extends RepoApi { } } - async unshareFile(name: string) { + async unshareFileById(fileId: string) { try { - const id = await this.getSharedIdOfNode(name); - return await this.sharedlinksApi.deleteSharedLink(id); + const sharedId = await this.getSharedIdOfNode(fileId); + return await this.sharedlinksApi.deleteSharedLink(sharedId); } catch (error) { - this.handleError(`SharedLinksApi unshareFile : catch : `, error); + this.handleError(`SharedLinksApi unshareFileById : catch : `, error); } } - async getSharedLinks() { + async getSharedLinks(maxItems: number = 250) { try { await this.apiAuth(); const opts = { - maxItems: 250 + maxItems }; return await this.sharedlinksApi.listSharedLinks(opts); } catch (error) { @@ -128,4 +128,46 @@ export class SharedLinksApi extends RepoApi { Logger.error(`\tExpected: ${data.expect} items, but found ${error}`); } } + + async waitForFilesToBeShared(filesIds: string[]) { + try { + const sharedFile = async () => { + const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId); + const foundItems = filesIds.every((id) => sharedFiles.includes(id)); + if (foundItems) { + return Promise.resolve(foundItems); + } else { + return Promise.reject(foundItems); + } + }; + + return await Utils.retryCall(sharedFile); + } catch (error) { + Logger.error(`SharedLinksApi waitForFilesToBeShared : catch : `); + Logger.error(`\tWait timeout reached waiting for files to be shared`); + } + } + + async waitForFilesToNotBeShared(filesIds: string[]) { + try { + const sharedFile = async () => { + const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId); + + const foundItems = filesIds.some((id) => { + return sharedFiles.includes(id); + }); + + if (foundItems) { + return Promise.reject(foundItems); + } else { + return Promise.resolve(foundItems); + } + }; + + return await Utils.retryCall(sharedFile); + } catch (error) { + Logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : `); + Logger.error(`\tWait timeout reached waiting for files to no longer be shared`); + } + } } diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts index 88ec5849b..e822b5d86 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/sites/sites-api.ts @@ -273,6 +273,25 @@ export class SitesApi extends RepoApi { } } + async waitForSitesToBeCreated(sitesIds: string[]) { + try { + const site = async () => { + const sitesList = (await this.getSites()).list.entries.map((link) => link.entry.id); + const foundItems = sitesIds.every((id) => sitesList.includes(id)); + if (foundItems) { + return Promise.resolve(foundItems); + } else { + return Promise.reject(foundItems); + } + }; + + return await Utils.retryCall(site); + } catch (error) { + Logger.error(`SitesApi waitForSitesToBeCreated : catch : `); + Logger.error(`\tWait timeout reached waiting for sites to be created`); + } + } + async waitForApi(data: { expect: number }) { try { const sites = async () => { diff --git a/protractor.conf.js b/protractor.conf.js index 536b62e71..f94a929fa 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -2,14 +2,14 @@ // https://github.com/angular/protractor/blob/master/lib/config.ts const path = require('path'); -const { SpecReporter } = require('jasmine-spec-reporter'); +const {SpecReporter} = require('jasmine-spec-reporter'); const fs = require('fs'); const resolve = require('path').resolve; const logger = require('./tools/helpers/logger'); const retry = require('protractor-retry-angular-cli').retry; -const { uploadScreenshot } = require('./e2e/e2e-config/utils/upload-output'); +const {uploadScreenshot} = require('./e2e/e2e-config/utils/upload-output'); -require('dotenv').config({ path: process.env.ENV_FILE }); +require('dotenv').config({path: process.env.ENV_FILE}); const SmartRunner = require('protractor-smartrunner'); const projectRoot = path.resolve(__dirname); @@ -36,6 +36,7 @@ exports.config = { allScriptsTimeout: 150000, params: { + index_search: 25000, config: appConfig, downloadFolder: downloadFolder, ADMIN_USERNAME: process.env.ADMIN_EMAIL || 'admin', @@ -44,56 +45,43 @@ exports.config = { }, specs: [ - './e2e/suites/authentication/*.test.ts', - './e2e/suites/list-views/*.test.ts', - './e2e/suites/application/*.test.ts', - './e2e/suites/navigation/*.test.ts', - './e2e/suites/pagination/*.test.ts', - './e2e/suites/search/*.test.ts', - './e2e/suites/actions-available/**/*.test.ts', - './e2e/suites/actions/**/*.test.ts', - './e2e/suites/viewer/*.test.ts', - './e2e/suites/info-drawer/*.test.ts', - './e2e/suites/extensions/*.test.ts' + './e2e/suites/actions/**/**/*test.ts', + './e2e/suites/actions-available/**/**/*test.ts', + './e2e/suites/application/**/*test.ts', + './e2e/suites/authentication/**/*test.ts', + './e2e/suites/extensions/**/*test.ts', + './e2e/suites/info-drawer/**/*test.ts', + './e2e/suites/list-views/**/*test.ts', + './e2e/suites/navigation/**/*test.ts', + './e2e/suites/pagination/**/*test.ts', + './e2e/suites/search/**/*test.ts', + './e2e/suites/viewer/**/*test.ts' ], suites: { - authentication: './e2e/suites/authentication/*.test.ts', - listViews: './e2e/suites/list-views/*.test.ts', - application: './e2e/suites/application/*.test.ts', - navigation: './e2e/suites/navigation/*.test.ts', - pagination: './e2e/suites/pagination/*.test.ts', - search: './e2e/suites/search/*.test.ts', - actionsAvailable: './e2e/suites/actions-available/**/*.test.ts', - addRemoveContent: [ - './e2e/suites/actions/new-menu.test.ts', - './e2e/suites/actions/create-folder.test.ts', - './e2e/suites/actions/create-folder-from-template.test.ts', - './e2e/suites/actions/create-library.test.ts', - './e2e/suites/actions/create-file-from-template.test.ts', - './e2e/suites/actions/upload-file.test.ts', - './e2e/suites/actions/upload-new-version.test.ts', - './e2e/suites/actions/version-actions.test.ts', - './e2e/suites/actions/delete-undo-delete.test.ts', - './e2e/suites/actions/permanently-delete.test.ts', - './e2e/suites/actions/restore.test.ts', - './e2e/suites/actions/download.test.ts' - ], - manageContent: [ - './e2e/suites/actions/copy-move/*.test.ts', - './e2e/suites/actions/library-actions.test.ts', - './e2e/suites/actions/edit-folder.test.ts', - './e2e/suites/actions/edit-offline.test.ts' - ], - sharingContent: [ - './e2e/suites/actions/mark-favorite.test.ts', - './e2e/suites/actions/share-file.test.ts', - './e2e/suites/actions/unshare-file-search-results.test.ts', - './e2e/suites/actions/unshare-file.test.ts' - ], - viewer: './e2e/suites/viewer/*.test.ts', - infoDrawer: './e2e/suites/info-drawer/*.test.ts', - extensions: './e2e/suites/extensions/*.test.ts' + copyMoveActions: './e2e/suites/actions/copy-move/**/**/*test.ts', + createActions: './e2e/suites/actions/create/**/**/*test.ts', + deleteActions: './e2e/suites/actions/delete/**/**/*test.ts', + editActions: './e2e/suites/actions/edit/**/**/*test.ts', + favoriteActions: './e2e/suites/actions/favorite/**/**/*test.ts', + libraryActions: './e2e/suites/actions/library/**/**/*test.ts', + shareActions: './e2e/suites/actions/share/**/**/*test.ts', + uploadDownloadActions: './e2e/suites/actions/upload-download/**/**/*test.ts', + + actionsAvailableFilesFolders: './e2e/suites/actions-available/files-folders/**/**/*test.ts', + actionsAvailableLibraries: './e2e/suites/actions-available/libraries/**/**/*test.ts', + actionsAvailableSpecialPermissions: './e2e/suites/actions-available/special-permissions/**/**/*test.ts', + actionsAvailableNewMenu: './e2e/suites/actions-available/new-menu/**/**/*test.ts', + + application: './e2e/suites/application/**/*test.ts', + authentication: './e2e/suites/authentication/**/*test.ts', + extensions: './e2e/suites/extensions/**/*test.ts', + infoDrawer: './e2e/suites/info-drawer/**/*test.ts', + listViews: './e2e/suites/list-views/**/*test.ts', + navigation: './e2e/suites/navigation/**/*test.ts', + pagination: './e2e/suites/pagination/**/*test.ts', + search: './e2e/suites/search/**/*test.ts', + viewer: './e2e/suites/viewer/**/*test.ts' }, SELENIUM_PROMISE_MANAGER: false, @@ -145,9 +133,10 @@ exports.config = { framework: 'jasmine', jasmineNodeOpts: { showColors: true, - defaultTimeoutInterval: 600000, + defaultTimeoutInterval: 200000, includeStackTrace: true, - print: function () {}, + print: function () { + }, ...SmartRunner.withOptionalExclusions(resolve(__dirname, './e2e/protractor.excludes.json')) }, @@ -179,7 +168,7 @@ exports.config = { const outputDirectory = process.env.SMART_RUNNER_DIRECTORY; logger.info(`SmartRunner's repoHash : "${repoHash}"`); logger.info(`SmartRunner's outputDirectory: "${outputDirectory}"`); - SmartRunner.apply({ outputDirectory, repoHash }); + SmartRunner.apply({outputDirectory, repoHash}); } const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json'); @@ -215,8 +204,8 @@ exports.config = { }); }, - afterLaunch: async function () { - if (SAVE_SCREENSHOT) { + afterLaunch: async function (statusCode) { + if (SAVE_SCREENSHOT && statusCode !== 0) { console.log(`Save screenshot is ${SAVE_SCREENSHOT}, trying to save screenshots.`); try { diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts index 63030354d..b7e54031d 100644 --- a/src/app/components/favorites/favorites.component.spec.ts +++ b/src/app/components/favorites/favorites.component.spec.ts @@ -25,8 +25,8 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { Router } from '@angular/router'; -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; -import { AlfrescoApiService, NodeFavoriteDirective, DataTableComponent, AppConfigPipe, UploadService } from '@alfresco/adf-core'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { AlfrescoApiService, NodeFavoriteDirective, DataTableComponent, AppConfigPipe } from '@alfresco/adf-core'; import { DocumentListComponent } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; import { FavoritesComponent } from './favorites.component'; @@ -45,7 +45,6 @@ describe('FavoritesComponent', () => { }; let page; let node; - let uploadService: UploadService; beforeEach(() => { page = { @@ -86,7 +85,6 @@ describe('FavoritesComponent', () => { spyOn(alfrescoApi.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve(page)); contentApi = TestBed.inject(ContentApiService); - uploadService = TestBed.inject(UploadService); router = TestBed.inject(Router); }); @@ -122,28 +120,6 @@ describe('FavoritesComponent', () => { }); }); - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadComplete event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadComplete.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadDeleted event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadDeleted.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - it('should navigate if node is folder', () => { const nodeEntity: any = { entry: { isFolder: true } }; spyOn(component, 'navigate').and.stub(); diff --git a/src/app/components/preview/preview.component.spec.ts b/src/app/components/preview/preview.component.spec.ts index 6a0a9ca39..cd9efbe2f 100644 --- a/src/app/components/preview/preview.component.spec.ts +++ b/src/app/components/preview/preview.component.spec.ts @@ -368,47 +368,6 @@ describe('PreviewComponent', () => { expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']); }); - // todo: Fix after Angular6 migration - xit('should navigate to original location in case of internal errors', async () => { - spyOn(router, 'navigate').and.stub(); - spyOn(contentApi, 'getNodeInfo').and.returnValue( - of({ - isFile: true - } as Node) - ); - spyOn(component, 'getNearestNodes').and.returnValue(Promise.reject('error')); - - component.previewLocation = 'personal-files'; - await component.displayNode('folder1'); - - expect(contentApi.getNodeInfo).toHaveBeenCalledWith('folder1'); - expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']); - }); - - xit('should setup node for displaying', async () => { - spyOn(router, 'navigate').and.stub(); - spyOn(component, 'getNearestNodes').and.returnValue( - Promise.resolve({ - left: 'node1', - right: 'node3' - }) - ); - spyOn(contentApi, 'getNodeInfo').and.returnValue( - of({ - id: 'node2', - parentId: 'parent1', - isFile: true - } as Node) - ); - - await component.displayNode('node2'); - - expect(component.previousNodeId).toBe('node1'); - expect(component.nextNodeId).toBe('node3'); - expect(component.nodeId).toBe('node2'); - expect(router.navigate).not.toHaveBeenCalled(); - }); - it('should fetch and sort file ids for personal-files', async () => { preferences.set('personal-files.sorting.key', 'name'); preferences.set('personal-files.sorting.direction', 'desc'); @@ -441,11 +400,6 @@ describe('PreviewComponent', () => { expect(ids).toEqual(['node1', 'node2']); }); - xit('should require folder id to fetch ids for personal-files', async () => { - const ids = await component.getFileIds('personal-files', null); - expect(ids).toEqual([]); - }); - it('should sort file ids for personal-files with [modifiedAt desc]', async () => { spyOn(preferences, 'get').and.returnValue(null); diff --git a/src/app/components/recent-files/recent-files.component.spec.ts b/src/app/components/recent-files/recent-files.component.spec.ts index bd8ef121e..1b4ba5ddc 100644 --- a/src/app/components/recent-files/recent-files.component.spec.ts +++ b/src/app/components/recent-files/recent-files.component.spec.ts @@ -23,9 +23,9 @@ * along with Alfresco. If not, see . */ -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { AlfrescoApiService, NodeFavoriteDirective, DataTableComponent, AppConfigPipe, UploadService } from '@alfresco/adf-core'; +import { AlfrescoApiService, NodeFavoriteDirective, DataTableComponent, AppConfigPipe } from '@alfresco/adf-core'; import { DocumentListComponent } from '@alfresco/adf-content-services'; import { RecentFilesComponent } from './recent-files.component'; import { AppTestingModule } from '../../testing/app-testing.module'; @@ -37,7 +37,6 @@ describe('RecentFilesComponent', () => { let component: RecentFilesComponent; let alfrescoApi: AlfrescoApiService; let page; - let uploadService: UploadService; const mockRouter = { url: 'recent-files' }; @@ -68,7 +67,6 @@ describe('RecentFilesComponent', () => { component = fixture.componentInstance; alfrescoApi = TestBed.inject(AlfrescoApiService); - uploadService = TestBed.inject(UploadService); alfrescoApi.reset(); spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue( @@ -80,28 +78,6 @@ describe('RecentFilesComponent', () => { spyOn(alfrescoApi.searchApi, 'search').and.returnValue(Promise.resolve(page)); }); - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadComplete event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadComplete.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadDeleted event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadDeleted.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - it('should call showPreview method', () => { const node: any = { entry: {} }; spyOn(component, 'showPreview'); diff --git a/src/app/components/shared-files/shared-files.component.spec.ts b/src/app/components/shared-files/shared-files.component.spec.ts deleted file mode 100644 index dca128818..000000000 --- a/src/app/components/shared-files/shared-files.component.spec.ts +++ /dev/null @@ -1,135 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2020 Alfresco Software Limited - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; -import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { - AlfrescoApiService, - AlfrescoApiServiceMock, - NodeFavoriteDirective, - DataTableComponent, - AppConfigPipe, - UploadService -} from '@alfresco/adf-core'; -import { CustomResourcesService, DocumentListComponent } from '@alfresco/adf-content-services'; -import { SharedFilesComponent } from './shared-files.component'; -import { AppTestingModule } from '../../testing/app-testing.module'; -import { Router } from '@angular/router'; -import { ContentManagementService } from '../../services/content-management.service'; -import { of } from 'rxjs'; - -describe('SharedFilesComponent', () => { - let fixture: ComponentFixture; - let component: SharedFilesComponent; - let alfrescoApi: AlfrescoApiService; - let page; - let uploadService: UploadService; - let customResourcesService: CustomResourcesService; - let contentManagementService: ContentManagementService; - const mockRouter = { - url: 'shared-files' - }; - - beforeEach(() => { - page = { - list: { - entries: [{ entry: { id: 1 } }, { entry: { id: 2 } }], - pagination: { data: 'data' } - } - }; - }); - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule], - declarations: [DataTableComponent, NodeFavoriteDirective, DocumentListComponent, SharedFilesComponent, AppConfigPipe], - providers: [ - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, - { - provide: Router, - useValue: mockRouter - } - ], - schemas: [NO_ERRORS_SCHEMA] - }); - - fixture = TestBed.createComponent(SharedFilesComponent); - uploadService = TestBed.inject(UploadService); - contentManagementService = TestBed.inject(ContentManagementService); - customResourcesService = TestBed.inject(CustomResourcesService); - component = fixture.componentInstance; - - alfrescoApi = TestBed.inject(AlfrescoApiService); - alfrescoApi.reset(); - - spyOn(alfrescoApi.sharedLinksApi, 'findSharedLinks').and.returnValue(Promise.resolve(page)); - spyOn(customResourcesService, 'loadSharedLinks').and.returnValue(of(page)); - }); - - // TODO: fix with ADF 4.1 - xit('should call document list reload on linksUnshared event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - contentManagementService.linksUnshared.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadComplete event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadComplete.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - - // TODO: fix with ADF 4.1 - xit('should call document list reload on fileUploadDeleted event', fakeAsync(() => { - spyOn(component, 'reload'); - - fixture.detectChanges(); - uploadService.fileUploadDeleted.next(); - tick(500); - - expect(component.reload).toHaveBeenCalled(); - })); - - // TODO: fix with ADF 4.1 - xit('should call showPreview method', () => { - const node: any = { entry: {} }; - spyOn(component, 'showPreview'); - fixture.detectChanges(); - - component.preview(node); - expect(component.showPreview).toHaveBeenCalledWith(node, { - location: mockRouter.url - }); - }); -}); diff --git a/src/app/components/sidenav/sidenav.component.spec.ts b/src/app/components/sidenav/sidenav.component.spec.ts index 20bfb53ac..30646c251 100644 --- a/src/app/components/sidenav/sidenav.component.spec.ts +++ b/src/app/components/sidenav/sidenav.component.spec.ts @@ -63,7 +63,7 @@ describe('SidenavComponent', () => { })); // TODO: fix with ADF 4.1 - xit('should set the sidenav data', async(() => { + it('should set the sidenav data', async(() => { expect(component.groups).toEqual([ { items: [ diff --git a/tslint.json b/tslint.json index e5143cbc0..6c30be6d0 100644 --- a/tslint.json +++ b/tslint.json @@ -16,7 +16,9 @@ true, "eval", "fdescribe", - "fit" + "fit", + "xit", + "xdescribe" ], "arrow-return-shorthand": true, "callable-types": true,