From 8308573f3c7ec7f58b393c561c1a1c20cd3dfa9d Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Thu, 19 Nov 2020 16:07:57 +0000 Subject: [PATCH] Unexclude due the timeout (#1805) * change base method to wait * fix import * reduce log * fix * data placeholder * fix * fix * fix * fix style * change visibility with common method * fix * use common get value method * remove unused import * fix a few incorrect api calls * - use separate variables * correctly wait for items after they have been created * use browseraction click * Exclude failing tests * increase timeout and some fix * check env before execute test * simplify conf * exclude * rerun * logs * refactor pagination tests to use only 51 items take out pagination tests into a separate stage * fix check * remove hardcoded total items. other shared files might already exist Co-authored-by: Adina Parpalita Co-authored-by: iuliaib --- .travis.yml | 27 +++-- e2e/protractor.excludes.json | 59 ++++++--- .../files-folders-actions.test.ts | 4 +- e2e/suites/actions-available/generic.test.ts | 3 +- .../libraries/library.test.ts | 2 +- .../special-permissions-actions.test.ts | 2 +- e2e/suites/actions/copy-move/copy.test.ts | 25 ++-- e2e/suites/actions/copy-move/move.test.ts | 41 +++---- .../actions/create-file-from-template.test.ts | 13 +- .../create-folder-from-template.test.ts | 13 +- e2e/suites/actions/create-folder.test.ts | 13 +- e2e/suites/actions/create-library.test.ts | 19 +-- e2e/suites/actions/download.test.ts | 27 +++-- e2e/suites/actions/edit-folder.test.ts | 47 ++++---- e2e/suites/actions/library-actions.test.ts | 37 +++--- e2e/suites/actions/permanently-delete.test.ts | 23 ++-- e2e/suites/actions/restore.test.ts | 19 +-- e2e/suites/actions/share-file.test.ts | 113 ++++++++++-------- e2e/suites/actions/version-actions.test.ts | 7 +- e2e/suites/application/general.test.ts | 4 +- e2e/suites/authentication/login.test.ts | 4 +- e2e/suites/extensions/ext-info-drawer.test.ts | 13 +- e2e/suites/extensions/ext-metadata.test.ts | 5 +- e2e/suites/extensions/ext-viewer.test.ts | 3 +- e2e/suites/info-drawer/comments.test.ts | 43 +++---- .../file-folder-properties.test.ts | 20 ++-- e2e/suites/info-drawer/general.test.ts | 5 +- .../info-drawer/library-properties.test.ts | 19 +-- e2e/suites/list-views/favorites.test.ts | 9 +- e2e/suites/list-views/tooltips.test.ts | 25 +++- e2e/suites/navigation/breadcrumb.test.ts | 23 ++-- e2e/suites/navigation/single-click.test.ts | 14 ++- e2e/suites/pagination/favorites.ts | 53 ++++---- .../pagination/multiple-pages-files.test.ts | 20 ++-- .../multiple-pages-libraries.test.ts | 103 ++++++++-------- .../pagination/multiple-pages-trash.test.ts | 45 ++++--- e2e/suites/pagination/personal-files.ts | 39 +++--- e2e/suites/pagination/recent-files.ts | 53 ++++---- e2e/suites/pagination/search-results.ts | 47 ++++---- e2e/suites/pagination/shared-files.ts | 39 +++--- e2e/suites/search/search-filters.test.ts | 15 +-- e2e/suites/viewer/viewer-actions.test.ts | 25 +++- e2e/suites/viewer/viewer-general.test.ts | 6 +- .../viewer/viewer-protected-file.test.ts | 5 +- .../breadcrumb/dropdown-breadcrumb.ts | 5 +- .../src/components/data-table/data-table.ts | 6 +- .../datetime-picker/datetime-picker.ts | 3 +- .../dialog/content-node-selector-dialog.ts | 15 ++- .../dialog/create-edit-folder-dialog.ts | 15 +-- .../dialog/create-from-template-dialog.ts | 13 +- .../dialog/create-library-dialog.ts | 13 +- .../src/components/dialog/generic-dialog.ts | 5 +- .../dialog/manage-versions-dialog.ts | 3 +- .../src/components/dialog/password-dialog.ts | 6 +- .../dialog/select-template-dialog.ts | 5 +- .../src/components/dialog/share-dialog.ts | 9 +- .../src/components/header/header.ts | 6 +- .../src/components/header/user-info.ts | 3 +- .../info-drawer/info-drawer-comments-tab.ts | 9 +- .../info-drawer-metadata-content.ts | 7 +- .../info-drawer-metadata-library.ts | 12 +- .../src/components/info-drawer/info-drawer.ts | 13 +- .../src/components/menu/menu.ts | 18 ++- .../src/components/pagination/pagination.ts | 13 +- .../search/filters/created-date-filter.ts | 23 ++-- .../components/search/filters/facet-filter.ts | 7 +- .../search/filters/generic-filter-panel.ts | 3 +- .../components/search/filters/size-filter.ts | 13 +- .../src/components/search/search-input.ts | 21 ++-- .../search/search-sorting-picker.ts | 17 ++- .../src/components/sidenav/sidenav.ts | 17 ++- .../src/components/toolbar/toolbar.ts | 2 +- .../src/pages/login-page.ts | 5 +- projects/aca-testing-shared/src/pages/page.ts | 11 +- .../src/pages/search-results-page.ts | 3 +- .../apis/favorites/favorites-api.ts | 14 ++- .../apis/shared-links/shared-links-api.ts | 14 ++- .../repo-client/apis/sites/sites-api.ts | 14 ++- .../aca-testing-shared/src/utilities/utils.ts | 49 ++------ projects/aca-testing-shared/tslint.json | 14 +-- protractor.conf.js | 23 +--- scripts/ci/job_hooks/before_e2e.sh | 5 + 82 files changed, 815 insertions(+), 750 deletions(-) diff --git a/.travis.yml b/.travis.yml index de0e24544..1d3b18b76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,8 +37,7 @@ stages: env: global: - - API_CONTENT_HOST=$API_CONTENT_HOST_REMOTE - - API_AOS_HOST=$API_CONTENT_HOST_REMOTE + - API_AOS_HOST=$API_CONTENT_HOST - ADMIN_EMAIL=$ADMIN_EMAIL_REMOTE - ADMIN_PASSWORD=$ADMIN_PASSWORD_REMOTE @@ -84,44 +83,52 @@ jobs: cache: false - stage: e2e - name: 'Test Suites: authentication,listViews,navigation,application,pagination,search' + name: 'Test Suites: authentication,listViews,navigation,application,search' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=authentication,listViews,navigation,application,pagination,search" + - ./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" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + + - stage: e2e + name: 'Test Suites: pagination' + 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=pagination" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - name: 'Test Suites: actionsAvailable' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" + - ./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" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - name: 'Test Suites: addRemoveContent' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" + - ./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" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - name: 'Test Suites: manageContent' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" + - ./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" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - name: 'Test Suite: sharingContent' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" + - ./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" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - name: 'Test Suites: viewer,infoDrawer,extensions' before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" + - ./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=viewer,infoDrawer,extensions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index a7248ed77..5ae1f21b9 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -1,19 +1,44 @@ { - "C586766" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586767" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586768" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586769" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586770" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586771" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586772" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586773" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586774" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586776" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586777" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586778" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586779" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586780" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C586781" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601", - "C280132" : "Shared files list is not empty on the live environment", - "C280094" : "Shared files list is not empty on the live environment" + "C586766" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586767" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586768" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586769" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586770" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586771" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586772" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586773" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586774" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586776" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586777" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586778" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586779" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586780" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C586781" : "Include once ACA starts using ACS 7+, https://alfresco.atlassian.net/browse/ACA-3601", + "C280132" : "https://alfresco.atlassian.net/browse/ACA-4167", + "C280094" : "https://alfresco.atlassian.net/browse/ACA-4167", + "MNT-21058" : "https://alfresco.atlassian.net/browse/ACA-4145", + "C217171" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280202" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C217172" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C217174" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280214" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280226" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280227" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280229" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C306938" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C306939" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C306941" : "https://alfresco.atlassian.net/browse/ACA-4166", + "C280536" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C217132" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280503" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280504" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280324" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280514" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280524" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280526" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280525" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C217181" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C217178" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C217179" : "https://alfresco.atlassian.net/browse/ACA-4165", + "C280537" : "https://alfresco.atlassian.net/browse/ACA-4165" } diff --git a/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts b/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts index 914bcd0dd..e912b6de0 100644 --- a/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/files-folders-actions.test.ts @@ -90,7 +90,7 @@ describe('Files / folders actions : ', () => { await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 12 }); - const initialFavoritesTotalItems = await userApi.favorites.getFavoritesTotalItems(); + const initialFavoritesTotalItems = (await userApi.favorites.getFavoritesTotalItems()) || 0; await userApi.favorites.addFavoritesByIds('folder', [folderFavId, folderFav2Id]); await userApi.favorites.addFavoritesByIds('file', [ fileDocxFavId, @@ -119,7 +119,7 @@ describe('Files / folders actions : ', () => { await userApi.nodes.lockFile(fileSharedFavLockedId); await loginPage.loginWith(username); - }); + }, 300000); afterAll(async () => { await userActions.deleteNodes([parentId]); diff --git a/e2e/suites/actions-available/generic.test.ts b/e2e/suites/actions-available/generic.test.ts index 8e4429d1c..0bbadae91 100755 --- a/e2e/suites/actions-available/generic.test.ts +++ b/e2e/suites/actions-available/generic.test.ts @@ -24,6 +24,7 @@ */ import { LoginPage, BrowsingPage, RepoClient, NodeContentTree, Utils, AdminActions } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Generic tests : ', () => { const random = Utils.random(); @@ -109,7 +110,7 @@ describe('Generic tests : ', () => { it('[C280619] Context menu closes when clicking away from it', async () => { await dataTable.rightClickOnItem(file1); expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - await page.breadcrumb.currentItem.click(); + await BrowserActions.click(page.breadcrumb.currentItem); expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); }); }); diff --git a/e2e/suites/actions-available/libraries/library.test.ts b/e2e/suites/actions-available/libraries/library.test.ts index 3f368867c..88fb7c380 100755 --- a/e2e/suites/actions-available/libraries/library.test.ts +++ b/e2e/suites/actions-available/libraries/library.test.ts @@ -84,7 +84,7 @@ describe('Library actions : ', () => { await userActions.waitForTrashcanSize(initialDeletedTotalItems + 2); await loginPage.loginWith(username); - }); + }, 300000); afterAll(async () => { await userActions.deleteSites([ 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..0fdec1112 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 @@ -145,7 +145,7 @@ describe('Special permissions : ', () => { userManagerApi.search.waitForApi(userManager, { expect: managerSearchTotalItems + 14 }), userCollaboratorApi.favorites.waitForApi({ expect: collaboratorFavoritesTotalItems + 2 }) ]); - }); + }, 300000); afterAll(async () => { await userManagerApi.sites.deleteSite(sitePrivate); diff --git a/e2e/suites/actions/copy-move/copy.test.ts b/e2e/suites/actions/copy-move/copy.test.ts index 2d9fd7f11..2aab97fc9 100755 --- a/e2e/suites/actions/copy-move/copy.test.ts +++ b/e2e/suites/actions/copy-move/copy.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Copy content', () => { const username = `user-${Utils.random()}`; @@ -478,7 +479,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -498,7 +499,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -522,7 +523,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 2 items'); expect(msg).toContain('Undo'); @@ -544,7 +545,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -564,7 +565,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -590,7 +591,7 @@ describe('Copy content', () => { await copyDialog.dataTable.doubleClickOnRowByName(siteName); await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`Copied ${noOfItems} ${noOfItems === 1 ? 'item' : 'items'}`); expect(msg).toContain('Undo'); @@ -618,7 +619,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -641,7 +642,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -672,7 +673,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -695,7 +696,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -720,7 +721,7 @@ describe('Copy content', () => { await copyDialog.selectLocation('Personal Files'); await copyDialog.dataTable.doubleClickOnRowByName(source); await copyDialog.selectDestination(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -746,7 +747,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.dataTable.doubleClickOnRowByName(destination); - await copyDialog.copyButton.click(); + await BrowserActions.click(copyDialog.copyButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); diff --git a/e2e/suites/actions/copy-move/move.test.ts b/e2e/suites/actions/copy-move/move.test.ts index 0f49cb0f3..fe74f367c 100755 --- a/e2e/suites/actions/copy-move/move.test.ts +++ b/e2e/suites/actions/copy-move/move.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Move content', () => { const username = `user-${Utils.random()}`; @@ -166,7 +167,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -184,7 +185,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -206,7 +207,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -226,7 +227,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -245,7 +246,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -268,7 +269,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSitePF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -325,7 +326,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -344,7 +345,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -366,7 +367,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -388,7 +389,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteRF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -451,7 +452,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -470,7 +471,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -492,7 +493,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -514,7 +515,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteSF); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -603,7 +604,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -622,7 +623,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -645,7 +646,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -667,7 +668,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -687,7 +688,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -711,7 +712,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteFav); - await moveDialog.moveButton.click(); + await BrowserActions.click(moveDialog.moveButton); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); diff --git a/e2e/suites/actions/create-file-from-template.test.ts b/e2e/suites/actions/create-file-from-template.test.ts index 00335dcd5..a39d97bf4 100755 --- a/e2e/suites/actions/create-file-from-template.test.ts +++ b/e2e/suites/actions/create-file-from-template.test.ts @@ -34,6 +34,7 @@ import { RepoClient, NodeContentTree } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Create file from template', () => { const random = Utils.random(); @@ -311,7 +312,7 @@ describe('Create file from template', () => { it('[C325030] Create a file from a template - with a new Name', async () => { await createFromTemplateDialog.enterName(file1.name); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -322,7 +323,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(file2.name); await createFromTemplateDialog.enterTitle(file2.title); await createFromTemplateDialog.enterDescription(file2.description); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -335,7 +336,7 @@ describe('Create file from template', () => { it('[C325028] Create a file with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFileName); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -351,7 +352,7 @@ describe('Create file from template', () => { it('[C325042] Trim spaces from file Name', async () => { await createFromTemplateDialog.enterName(nameWithSpaces); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -376,7 +377,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(fileSite.name); await createFromTemplateDialog.enterTitle(fileSite.title); await createFromTemplateDialog.enterDescription(fileSite.description); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -397,7 +398,7 @@ describe('Create file from template', () => { it('[C325025] Create a file with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFileSite); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-folder-from-template.test.ts b/e2e/suites/actions/create-folder-from-template.test.ts index 8c7f88307..d8f3b3ee8 100755 --- a/e2e/suites/actions/create-folder-from-template.test.ts +++ b/e2e/suites/actions/create-folder-from-template.test.ts @@ -34,6 +34,7 @@ import { RepoClient, NodeContentTree } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Create folder from template', () => { const random = Utils.random(); @@ -296,7 +297,7 @@ describe('Create folder from template', () => { it('[C325157] Create a folder from a template - with a new Name', async () => { await createFromTemplateDialog.enterName(folder1.name); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -307,7 +308,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folder2.name); await createFromTemplateDialog.enterTitle(folder2.title); await createFromTemplateDialog.enterDescription(folder2.description); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -320,7 +321,7 @@ describe('Create folder from template', () => { it('[C325156] Create a folder with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFolderName); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -336,7 +337,7 @@ describe('Create folder from template', () => { it('[C325158] Trim spaces from folder Name', async () => { await createFromTemplateDialog.enterName(nameWithSpaces); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -361,7 +362,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folderSite.name); await createFromTemplateDialog.enterTitle(folderSite.title); await createFromTemplateDialog.enterDescription(folderSite.description); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -382,7 +383,7 @@ describe('Create folder from template', () => { it('[C325163] Create a folder with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFolderSite); - await createFromTemplateDialog.createButton.click(); + await BrowserActions.click(createFromTemplateDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index 55cf7ce2b..b9313e852 100755 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -32,6 +32,7 @@ import { clearTextWithBackspace, RepoClient } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Create folder', () => { const username = `user-${Utils.random()}`; @@ -96,7 +97,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderName1); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -109,7 +110,7 @@ describe('Create folder', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderName2); await createDialog.enterDescription(folderDescription); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -191,7 +192,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateFolderName); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -202,7 +203,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(nameWithSpaces); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -229,7 +230,7 @@ describe('Create folder', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderSite); await createDialog.enterDescription(folderDescription); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -254,7 +255,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateFolderSite); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-library.test.ts b/e2e/suites/actions/create-library.test.ts index adf8a474a..f8f29580a 100755 --- a/e2e/suites/actions/create-library.test.ts +++ b/e2e/suites/actions/create-library.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, SITE_VISIBILITY, LoginPage, BrowsingPage, CreateLibraryDialog, Utils, RepoClient } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Create library', () => { const username = `user-${Utils.random()}`; @@ -98,7 +99,7 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site1Name); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); expect(await page.breadcrumb.currentItem.getText()).toEqual(site1Name, `Not navigated into ${site1Name}`); @@ -111,8 +112,8 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site2Name); - await createDialog.visibilityModerated.click(); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.visibilityModerated); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); expect(await page.breadcrumb.currentItem.getText()).toEqual(site2Name, `Not navigated into ${site2Name}`); @@ -125,8 +126,8 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site3Name); - await createDialog.visibilityPrivate.click(); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.visibilityPrivate); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); expect(await page.breadcrumb.currentItem.getText()).toEqual(site3Name, `Not navigated into ${site3Name}`); @@ -141,8 +142,8 @@ describe('Create library', () => { await createDialog.enterName(site4.name); await createDialog.enterLibraryId(site4.id); await createDialog.enterDescription(site4.description); - await createDialog.visibilityPublic.click(); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.visibilityPublic); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); expect(await page.breadcrumb.currentItem.getText()).toEqual(site4.name, `Not navigated into ${site4.name}`); @@ -167,7 +168,7 @@ describe('Create library', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(siteInTrash.name); await createDialog.enterLibraryId(siteInTrash.id); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); expect(await createDialog.getErrorMessage()).toEqual(`This Library ID is already used. Check the trashcan.`); }); @@ -201,7 +202,7 @@ describe('Create library', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateSite.name); await createDialog.enterLibraryId(`${duplicateSite.id}-2`); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); await createDialog.waitForDialogToClose(); expect(await page.breadcrumb.currentItem.getText()).toEqual(duplicateSite.name, `Not navigated into ${duplicateSite.name}`); diff --git a/e2e/suites/actions/download.test.ts b/e2e/suites/actions/download.test.ts index e26808102..7198946ef 100755 --- a/e2e/suites/actions/download.test.ts +++ b/e2e/suites/actions/download.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, SearchResultsPage, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Download', () => { const username = `user-${Utils.random()}`; @@ -140,14 +141,14 @@ describe('Download', () => { it('[C213179] Download a file', async () => { await dataTable.selectItem(filePersonal); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(filePersonal)).toBe(true, 'File not found in download location'); }); it('[C216352] Download a folder', async () => { await dataTable.selectItem(folderPersonal); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); const folderZip = `${folderPersonal}.zip`; @@ -160,7 +161,7 @@ describe('Download', () => { it('[C216353] Download multiple items', async () => { await dataTable.selectMultipleItems([filePersonal, folderPersonal]); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -183,14 +184,14 @@ describe('Download', () => { it('[C280173] Download a file', async () => { await dataTable.selectItem(fileFavorites); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(fileFavorites)).toBe(true, 'File not found in download location'); }); it('[C280188] Download a folder', async () => { await dataTable.selectItem(folderFavorites); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); const folderZip = `${folderFavorites}.zip`; @@ -203,7 +204,7 @@ describe('Download', () => { it('[C280189] Download multiple items', async () => { await dataTable.selectMultipleItems([fileFavorites, folderFavorites]); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -226,14 +227,14 @@ describe('Download', () => { it('[C280170] Download a file', async () => { await dataTable.selectItem(fileShared1); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(fileShared1)).toBe(true, 'File not found in download location'); }); it('[C280183] Download multiple items', async () => { await dataTable.selectMultipleItems([fileShared1, fileShared2]); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -252,14 +253,14 @@ describe('Download', () => { it('[C280167] Download a file', async () => { await dataTable.selectItem(fileRecent1); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(fileRecent1)).toBe(true, 'File not found in download location'); }); it('[C280177] Download multiple items', async () => { await dataTable.selectMultipleItems([fileRecent1, fileRecent2]); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -281,14 +282,14 @@ describe('Download', () => { it('[C279164] Download a file', async () => { await dataTable.selectItem(fileSearch, parent); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(fileSearch)).toBe(true, 'File not found in download location'); }); it('[C297694] Download a folder', async () => { await dataTable.selectItem(folderSearch, parent); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); const folderZip = `${folderSearch}.zip`; @@ -301,7 +302,7 @@ describe('Download', () => { it('[C297695] Download multiple items', async () => { await dataTable.selectMultipleItems([fileSearch, folderSearch], parent); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index bd18f5201..7b5816e35 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -34,6 +34,7 @@ import { Utils, clearTextWithBackspace } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Edit folder', () => { const username = `user-${Utils.random()}`; @@ -142,7 +143,7 @@ describe('Edit folder', () => { await dataTable.doubleClickOnRowByName(parent); await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); expect(await editDialog.getTitle()).toEqual('Edit folder'); expect(await editDialog.getName()).toBe(folderName); @@ -162,11 +163,11 @@ describe('Edit folder', () => { it('[C216335] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderNameToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -179,7 +180,7 @@ describe('Edit folder', () => { it('[C216332] with empty folder name', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await clearTextWithBackspace(editDialog.nameInput); expect(await editDialog.isUpdateButtonEnabled()).toBe(false, 'upload button is not enabled'); @@ -191,7 +192,7 @@ describe('Edit folder', () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); for (const name of namesWithSpecialChars) { await editDialog.enterName(name); @@ -203,7 +204,7 @@ describe('Edit folder', () => { it('[C216334] with name ending with a dot', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.nameInput.sendKeys('.'); @@ -214,7 +215,7 @@ describe('Edit folder', () => { it('[C216336] Cancel button', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.clickCancel(); @@ -224,10 +225,10 @@ describe('Edit folder', () => { it('[C216337] with duplicate folder name', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterName(duplicateFolderName); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -236,9 +237,9 @@ describe('Edit folder', () => { it('[C216338] trim ending spaces', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.nameInput.sendKeys(' '); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); await editDialog.waitForDialogToClose(); expect(await page.snackBar.isPresent()).not.toBe(true, 'notification appears'); @@ -255,11 +256,11 @@ describe('Edit folder', () => { it('[C280384] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderFavoriteToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -272,10 +273,10 @@ describe('Edit folder', () => { it('[C280386] with duplicate folder name', async () => { await dataTable.selectItem(folderFavorite); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterName(folderFavoriteDuplicate); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -292,11 +293,11 @@ describe('Edit folder', () => { it('[C280509] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderSiteToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -309,10 +310,10 @@ describe('Edit folder', () => { it('[C280511] with duplicate folder name', async () => { await dataTable.selectItem(folderSite); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterName(duplicateFolderSite); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -329,11 +330,11 @@ describe('Edit folder', () => { await dataTable.selectItem(folderSearchToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited2); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); await editDialog.waitForDialogToClose(); await page.refresh(); @@ -351,10 +352,10 @@ describe('Edit folder', () => { await dataTable.selectItem(folderSearch); await toolbar.openMoreMenu(); - await toolbar.menu.editFolderAction.click(); + await BrowserActions.click(toolbar.menu.editFolderAction); await editDialog.waitForDialogToOpen(); await editDialog.enterName(folderSearchDuplicate); - await editDialog.updateButton.click(); + await BrowserActions.click(editDialog.updateButton); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/library-actions.test.ts b/e2e/suites/actions/library-actions.test.ts index 0146b422b..71b9f3d75 100755 --- a/e2e/suites/actions/library-actions.test.ts +++ b/e2e/suites/actions/library-actions.test.ts @@ -34,6 +34,7 @@ import { ConfirmDialog, RepoClient } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Library actions', () => { const username = `user-${Utils.random()}`; @@ -89,12 +90,9 @@ describe('Library actions', () => { await adminApiActions.sites.createSite(siteSearchModerated2Admin, SITE_VISIBILITY.MODERATED); await apis.user.sites.createSite(siteSearchForDelete); - await apis.user.queries.waitForSites('site-public-search', { expect: 5 }); - await apis.user.queries.waitForSites('site-moderated-search', { expect: 2 }); - await loginPage.loginWith(username); done(); - }); + }, 300000); beforeEach(async () => { await Utils.pressEscape(); @@ -141,7 +139,7 @@ describe('Library actions', () => { it('[C290105] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(sitePublic1Admin); - await toolbar.joinButton.click(); + await BrowserActions.click(toolbar.joinButton); expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual(SITE_ROLES.SITE_CONSUMER.LABEL); }); @@ -153,7 +151,7 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic1Admin); - await toolbar.joinButton.click(); + await BrowserActions.click(toolbar.joinButton); expect(await dataTable.getLibraryRole(siteSearchPublic1Admin)).toEqual(SITE_ROLES.SITE_CONSUMER.LABEL); }); @@ -170,7 +168,7 @@ describe('Library actions', () => { it('[C290109] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(siteModerated1Admin); - await toolbar.joinButton.click(); + await BrowserActions.click(toolbar.joinButton); expect(await dataTable.getLibraryRole(siteModerated1Admin)).toEqual(SITE_ROLES.NONE.LABEL); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteModerated1Admin); @@ -184,7 +182,7 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchModerated1Admin); - await toolbar.joinButton.click(); + await BrowserActions.click(toolbar.joinButton); expect(await dataTable.getLibraryRole(siteSearchModerated1Admin)).toEqual(SITE_ROLES.NONE.LABEL); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated1Admin); @@ -212,9 +210,9 @@ describe('Library actions', () => { it('[C290106] from My Libraries', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic2Admin); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); - await confirmDialog.okButton.click(); + await BrowserActions.click(confirmDialog.okButton); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`); @@ -223,9 +221,9 @@ describe('Library actions', () => { it('[C290110] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(sitePublic3Admin); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); - await confirmDialog.okButton.click(); + await BrowserActions.click(confirmDialog.okButton); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`); @@ -238,9 +236,9 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic2Admin); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); - await confirmDialog.okButton.click(); + await BrowserActions.click(confirmDialog.okButton); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(siteSearchPublic2Admin)).toBe(true, `${siteSearchPublic2Admin} is not displayed`); @@ -249,7 +247,7 @@ describe('Library actions', () => { it('[C290136] Confirmation dialog UI', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic4Admin); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); @@ -262,20 +260,21 @@ describe('Library actions', () => { it('[C290111] Cancel Leave Library', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic5Admin); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); - await confirmDialog.cancelButton.click(); + await BrowserActions.click(confirmDialog.cancelButton); + expect(await dataTable.isItemPresent(sitePublic5Admin)).toBe(true, `${sitePublic5Admin} was deleted`); }); it('[C290107] Leave a library - failure notification', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublicUser); - await toolbar.leaveButton.click(); + await BrowserActions.click(toolbar.leaveButton); await page.waitForDialog(); - await confirmDialog.okButton.click(); + await BrowserActions.click(confirmDialog.okButton); expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`); }); diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/permanently-delete.test.ts index 46b5ca63e..a3a079357 100755 --- a/e2e/suites/actions/permanently-delete.test.ts +++ b/e2e/suites/actions/permanently-delete.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, ConfirmDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Permanently delete from Trash', () => { const username = `user-${Utils.random()}`; @@ -79,9 +80,9 @@ describe('Permanently delete from Trash', () => { it('[C217091] delete a file', async () => { await dataTable.selectItem(file1); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); - await confirmDialog.deleteButton.click(); + await BrowserActions.click(confirmDialog.deleteButton); expect(await page.getSnackBarMessage()).toEqual(`${file1} deleted`); expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not deleted'); @@ -89,9 +90,9 @@ describe('Permanently delete from Trash', () => { it('[C280416] delete a folder', async () => { await dataTable.selectItem(folder1); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); - await confirmDialog.deleteButton.click(); + await BrowserActions.click(confirmDialog.deleteButton); expect(await page.getSnackBarMessage()).toEqual(`${folder1} deleted`); expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not deleted'); @@ -99,9 +100,9 @@ describe('Permanently delete from Trash', () => { it('[C290103] delete a library', async () => { await dataTable.selectItem(site); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); - await confirmDialog.deleteButton.click(); + await BrowserActions.click(confirmDialog.deleteButton); expect(await page.getSnackBarMessage()).toEqual(`${site} deleted`); expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not deleted`); @@ -109,9 +110,9 @@ describe('Permanently delete from Trash', () => { it('[C280417] delete multiple items', async () => { await dataTable.selectMultipleItems([file2, folder2]); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); - await confirmDialog.deleteButton.click(); + await BrowserActions.click(confirmDialog.deleteButton); expect(await page.getSnackBarMessage()).toEqual(`2 items deleted`); expect(await dataTable.isItemPresent(file2)).toBe(false, 'Item was not deleted'); @@ -120,7 +121,7 @@ describe('Permanently delete from Trash', () => { it('[C269113] Confirmation dialog UI', async () => { await dataTable.selectItem(file3); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); @@ -135,11 +136,11 @@ describe('Permanently delete from Trash', () => { it('[C269115] Keep action cancels the deletion', async () => { await dataTable.selectItem(file3); - await toolbar.permanentlyDeleteButton.click(); + await BrowserActions.click(toolbar.permanentlyDeleteButton); await page.waitForDialog(); expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled'); - await confirmDialog.keepButton.click(); + await BrowserActions.click(confirmDialog.keepButton); expect(await dataTable.isItemPresent(file3)).toBe(true, 'Item was deleted'); }); }); diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index 8c08ec45b..4941605b6 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -25,6 +25,7 @@ import { browser } from 'protractor'; import { AdminActions, UserActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Restore from Trash', () => { const username = `user-${Utils.random()}`; @@ -82,7 +83,7 @@ describe('Restore from Trash', () => { it('[C217177] restore file', async () => { await dataTable.selectItem(file); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); const text = await page.getSnackBarMessage(); expect(text).toContain(`${file} restored`); expect(text).toContain(`View`); @@ -95,7 +96,7 @@ describe('Restore from Trash', () => { it('[C280438] restore folder', async () => { await dataTable.selectItem(folder); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); const text = await page.getSnackBarMessage(); expect(text).toContain(`${folder} restored`); expect(text).toContain(`View`); @@ -108,7 +109,7 @@ describe('Restore from Trash', () => { it('[C290104] restore library', async () => { await dataTable.selectItem(site); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); const text = await page.getSnackBarMessage(); expect(text).toContain(`${site} restored`); expect(text).toContain(`View`); @@ -119,7 +120,7 @@ describe('Restore from Trash', () => { it('[C217182] restore multiple items', async () => { await dataTable.selectMultipleItems([file, folder]); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); const text = await page.getSnackBarMessage(); expect(text).toContain(`Restore successful`); expect(text).not.toContain(`View`); @@ -134,7 +135,7 @@ describe('Restore from Trash', () => { it('[C217181] View from notification', async () => { await dataTable.selectItem(file); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); await page.clickSnackBarAction(); await page.dataTable.waitForHeader(); expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); @@ -183,14 +184,14 @@ describe('Restore from Trash', () => { it('[C217178] Restore a file when another file with same name exists on the restore location', async () => { await page.clickTrashAndWait(); await dataTable.selectItem(file1); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`); }); it('[C217179] Restore a file when original location no longer exists', async () => { await page.clickTrashAndWait(); await dataTable.selectItem(file2); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`); }); }); @@ -247,13 +248,13 @@ describe('Restore from Trash', () => { it('[C217183] one failure', async () => { await dataTable.selectMultipleItems([file1, file2]); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file1}, the original location no longer exists`); }); it('[C217184] multiple failures', async () => { await dataTable.selectMultipleItems([file3, file4, file5]); - await toolbar.restoreButton.click(); + await BrowserActions.click(toolbar.restoreButton); expect(await page.getSnackBarMessage()).toEqual('2 items not restored because of issues with the restore location'); }); }); diff --git a/e2e/suites/actions/share-file.test.ts b/e2e/suites/actions/share-file.test.ts index e52d6d0e5..79cc65db6 100755 --- a/e2e/suites/actions/share-file.test.ts +++ b/e2e/suites/actions/share-file.test.ts @@ -35,6 +35,7 @@ import { Viewer, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Share a file', () => { const username = `user-${Utils.random()}`; @@ -109,7 +110,7 @@ describe('Share a file', () => { expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.getFileTitle()).toEqual(file6); - await toolbar.downloadButton.click(); + await BrowserActions.click(toolbar.downloadButton); expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location'); }); }); @@ -170,7 +171,7 @@ describe('Share a file', () => { it('[C286327] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); @@ -186,7 +187,7 @@ describe('Share a file', () => { it('[C286328] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -196,7 +197,7 @@ describe('Share a file', () => { it('[C286329] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -208,12 +209,13 @@ describe('Share a file', () => { it('[C286330] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.urlAction.click(); + await BrowserActions.click(shareDialog.urlAction); + expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -225,12 +227,15 @@ describe('Share a file', () => { it('[C286332] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); - await shareDialog.expireToggle.click(); + await BrowserActions.click(shareDialog.expireToggle); + expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.datetimePickerButton.click(); + + await BrowserActions.click(shareDialog.datetimePickerButton); + expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -247,7 +252,7 @@ describe('Share a file', () => { it('[C286337] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -258,7 +263,7 @@ describe('Share a file', () => { it('[C286333] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -274,7 +279,7 @@ describe('Share a file', () => { it('[C286335] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -282,7 +287,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -349,7 +354,7 @@ describe('Share a file', () => { it('[C286639] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); @@ -365,7 +370,7 @@ describe('Share a file', () => { it('[C286640] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -375,7 +380,7 @@ describe('Share a file', () => { it('[C286641] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -387,7 +392,7 @@ describe('Share a file', () => { it('[C286642] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -404,7 +409,7 @@ describe('Share a file', () => { it('[C286643] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); await shareDialog.expireToggle.click(); @@ -426,7 +431,7 @@ describe('Share a file', () => { it('[C286644] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -437,7 +442,7 @@ describe('Share a file', () => { it('[C286645] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -453,7 +458,7 @@ describe('Share a file', () => { it('[C286646] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -461,7 +466,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -525,7 +530,7 @@ describe('Share a file', () => { it('[C286657] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); @@ -541,7 +546,7 @@ describe('Share a file', () => { it('[C286658] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -551,7 +556,7 @@ describe('Share a file', () => { it('[C286659] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -563,7 +568,7 @@ describe('Share a file', () => { it('[C286660] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -580,7 +585,7 @@ describe('Share a file', () => { it('[C286661] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); await shareDialog.expireToggle.click(); @@ -602,7 +607,7 @@ describe('Share a file', () => { it('[C286662] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -613,7 +618,7 @@ describe('Share a file', () => { it('[C286663] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -629,7 +634,7 @@ describe('Share a file', () => { it('[C286664] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -637,7 +642,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -699,7 +704,7 @@ describe('Share a file', () => { it('[C286648] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); @@ -715,7 +720,7 @@ describe('Share a file', () => { it('[C286649] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -725,7 +730,7 @@ describe('Share a file', () => { it('[C286651] Copy shared file URL', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -742,7 +747,7 @@ describe('Share a file', () => { it('[C286653] Expire date is displayed correctly', async () => { await dataTable.selectItem(file4); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file4Id); @@ -753,7 +758,7 @@ describe('Share a file', () => { it('[C286654] Disable the share link expiration', async () => { await dataTable.selectItem(file5); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -769,7 +774,7 @@ describe('Share a file', () => { it('[C286655] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -777,7 +782,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -856,7 +861,7 @@ describe('Share a file', () => { it('[C286666] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); @@ -872,7 +877,7 @@ describe('Share a file', () => { it('[C286667] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -882,7 +887,7 @@ describe('Share a file', () => { it('[C286668] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -894,7 +899,7 @@ describe('Share a file', () => { it('[C286669] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -911,7 +916,7 @@ describe('Share a file', () => { it('[C286670] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); await shareDialog.expireToggle.click(); @@ -933,7 +938,7 @@ describe('Share a file', () => { it('[C286671] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -944,7 +949,7 @@ describe('Share a file', () => { it('[C286672] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); @@ -960,7 +965,7 @@ describe('Share a file', () => { it('[C286673] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -968,7 +973,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -1035,7 +1040,7 @@ describe('Share a file', () => { it('[C306975] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -1047,7 +1052,7 @@ describe('Share a file', () => { it('[C306977] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.shareButton.click(); + await BrowserActions.click(toolbar.shareButton); await shareDialog.waitForDialogToOpen(); await shareDialog.expireToggle.click(); @@ -1069,7 +1074,7 @@ describe('Share a file', () => { it('[C306978] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -1080,13 +1085,14 @@ describe('Share a file', () => { it('[C306979] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.expireToggle.click(); + await BrowserActions.click(shareDialog.expireToggle); + expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -1097,7 +1103,8 @@ describe('Share a file', () => { it('[C306981] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.shareAction.click(); + await BrowserActions.click(contextMenu.shareAction); + await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); diff --git a/e2e/suites/actions/version-actions.test.ts b/e2e/suites/actions/version-actions.test.ts index 4a2a57449..272ecec33 100644 --- a/e2e/suites/actions/version-actions.test.ts +++ b/e2e/suites/actions/version-actions.test.ts @@ -27,6 +27,7 @@ import { AdminActions, LoginPage, BrowsingPage, FILES, RepoClient, Utils, Upload import { VersionManagePage } from '../../../projects/aca-testing-shared/src/components/version-manage/version-manager'; import { Viewer } from '../../../projects/aca-testing-shared/src/components'; import { browser } from 'protractor'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Version component actions', () => { const versionManagePage = new VersionManagePage(); @@ -62,9 +63,11 @@ describe('Version component actions', () => { await page.waitForDialog(); - await uploadNewVersionDialog.majorOption.click(); + await BrowserActions.click(uploadNewVersionDialog.majorOption); + await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.uploadButton.click(); + await BrowserActions.click(uploadNewVersionDialog.uploadButton); + await uploadNewVersionDialog.waitForDialogToClose(); } done(); diff --git a/e2e/suites/application/general.test.ts b/e2e/suites/application/general.test.ts index dc1c430c1..542eddab1 100644 --- a/e2e/suites/application/general.test.ts +++ b/e2e/suites/application/general.test.ts @@ -24,7 +24,7 @@ */ import { browser } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserActions, Logger } from '@alfresco/adf-testing'; import { BrowsingPage, LoginPage, CreateOrEditFolderDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; describe('General', () => { @@ -55,7 +55,7 @@ describe('General', () => { await adminApi.logout(); - await createDialog.createButton.click(); + await BrowserActions.click(createDialog.createButton); expect(await page.getSnackBarMessage()).toEqual('The action was unsuccessful. Try again or contact your IT Team.'); diff --git a/e2e/suites/authentication/login.test.ts b/e2e/suites/authentication/login.test.ts index b70e69211..3557d4770 100755 --- a/e2e/suites/authentication/login.test.ts +++ b/e2e/suites/authentication/login.test.ts @@ -25,6 +25,7 @@ import { browser } from 'protractor'; import { AdminActions, APP_ROUTES, LoginPage, Utils, navigate } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Login', () => { const loginPage = new LoginPage(); @@ -87,7 +88,8 @@ describe('Login', () => { it('[C213091] change password visibility', async () => { await login.enterPassword('some password'); expect(await login.isPasswordDisplayed()).toBe(false, 'password is visible'); - await login.passwordVisibility.click(); + await BrowserActions.click(login.passwordVisibility); + expect(await login.isPasswordHidden()).toBe(false, 'Password visibility not changed'); expect(await login.isPasswordDisplayed()).toBe(true, 'password is not visible'); }); diff --git a/e2e/suites/extensions/ext-info-drawer.test.ts b/e2e/suites/extensions/ext-info-drawer.test.ts index 2947bdfff..5e5a2b336 100755 --- a/e2e/suites/extensions/ext-info-drawer.test.ts +++ b/e2e/suites/extensions/ext-info-drawer.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, BrowsingPage, InfoDrawer, RepoClient, EXTENSIBILITY_CONFIGS, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Extensions - Info Drawer', () => { const username = `user-${Utils.random()}`; @@ -90,7 +91,7 @@ describe('Extensions - Info Drawer', () => { it('[C284646] Add a new tab with icon and title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); const val = await infoDrawer.getTabTitle(custom_tab.order); @@ -100,7 +101,7 @@ describe('Extensions - Info Drawer', () => { it('[C284647] Remove existing tab', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`); @@ -108,7 +109,7 @@ describe('Extensions - Info Drawer', () => { it('[C284648] Change tab title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`); @@ -117,7 +118,7 @@ describe('Extensions - Info Drawer', () => { it('[C284649] Tab with icon and no title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`); @@ -126,7 +127,7 @@ describe('Extensions - Info Drawer', () => { it('[C284651] Insert new component in tab', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`); @@ -146,7 +147,7 @@ describe('Extensions - Info Drawer', () => { it('[C284650] Remove all tabs', async () => { await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty'); diff --git a/e2e/suites/extensions/ext-metadata.test.ts b/e2e/suites/extensions/ext-metadata.test.ts index 6400f792c..53f5612e5 100644 --- a/e2e/suites/extensions/ext-metadata.test.ts +++ b/e2e/suites/extensions/ext-metadata.test.ts @@ -33,6 +33,7 @@ import { InfoDrawer, MetadataCard } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Extensions - Metadata presets', () => { const username = `user-${Utils.random()}`; @@ -87,11 +88,11 @@ describe('Extensions - Metadata presets', () => { await page.refresh(); await page.dataTable.selectItem(file); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickTab(properties_tab.title); - await metadataCard.expandButton.click(); + await BrowserActions.click(metadataCard.expandButton); await metadataCard.waitForFirstExpansionPanel(); done(); diff --git a/e2e/suites/extensions/ext-viewer.test.ts b/e2e/suites/extensions/ext-viewer.test.ts index ca8ff4351..28677dfee 100755 --- a/e2e/suites/extensions/ext-viewer.test.ts +++ b/e2e/suites/extensions/ext-viewer.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, BrowsingPage, Viewer, RepoClient, EXTENSIBILITY_CONFIGS, FILES, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Extensions - Viewer', () => { const username = `user-${Utils.random()}`; @@ -105,7 +106,7 @@ describe('Extensions - Viewer', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present'); expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component); - await viewer.closeButton.click(); + await BrowserActions.click(viewer.closeButton); await page.dataTable.doubleClickOnRowByName(docxFile.file_name); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/suites/info-drawer/comments.test.ts index 1a03ff53f..746210d9c 100755 --- a/e2e/suites/info-drawer/comments.test.ts +++ b/e2e/suites/info-drawer/comments.test.ts @@ -25,6 +25,7 @@ import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared'; const moment = require('moment'); +import { BrowserActions } from '@alfresco/adf-testing'; describe('Comments', () => { const username = `user1-${Utils.random()}`; @@ -119,7 +120,7 @@ describe('Comments', () => { it('[C299173] Comments tab default fields', async () => { await dataTable.selectItem(file1); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -131,7 +132,7 @@ describe('Comments', () => { it('[C280583] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -141,7 +142,7 @@ describe('Comments', () => { it('[C280585] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -150,7 +151,7 @@ describe('Comments', () => { it('[C280589] Add button is enabled when typing in the comment field', async () => { await dataTable.selectItem(file1); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -164,7 +165,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Personal); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -179,7 +180,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(folder1); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -192,7 +193,7 @@ describe('Comments', () => { it('[C280591] Escape key clears the text when focus is on the textarea', async () => { await dataTable.selectItem(file2Personal); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment('myComment'); @@ -218,7 +219,7 @@ describe('Comments', () => { it('[C299197] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -228,7 +229,7 @@ describe('Comments', () => { it('[C299198] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -239,7 +240,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Favorites); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -254,7 +255,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(folder2); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -274,7 +275,7 @@ describe('Comments', () => { it('[C299189] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -284,7 +285,7 @@ describe('Comments', () => { it('[C299190] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -295,7 +296,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Shared); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -320,7 +321,7 @@ describe('Comments', () => { it('[C299193] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -330,7 +331,7 @@ describe('Comments', () => { it('[C299194] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -341,7 +342,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Recent); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -368,7 +369,7 @@ describe('Comments', () => { await dataTable.doubleClickOnRowByName(parent); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -390,7 +391,7 @@ describe('Comments', () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -412,7 +413,7 @@ describe('Comments', () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -434,7 +435,7 @@ describe('Comments', () => { await page.clickRecentFilesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); diff --git a/e2e/suites/info-drawer/file-folder-properties.test.ts b/e2e/suites/info-drawer/file-folder-properties.test.ts index aba4c5622..734e8621b 100755 --- a/e2e/suites/info-drawer/file-folder-properties.test.ts +++ b/e2e/suites/info-drawer/file-folder-properties.test.ts @@ -34,6 +34,7 @@ import { DATE_TIME_FORMAT, DATE_FORMAT } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; const moment = require('moment'); @@ -104,7 +105,7 @@ describe('File / Folder properties', () => { describe('View properties', () => { it('[C299162] Default tabs', async () => { await dataTable.selectItem(file1.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); @@ -142,7 +143,7 @@ describe('File / Folder properties', () => { ]; await dataTable.selectItem(file1.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); @@ -167,7 +168,7 @@ describe('File / Folder properties', () => { ]; await dataTable.selectItem(folder1.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); @@ -178,19 +179,19 @@ describe('File / Folder properties', () => { it('[C269004] Less / More information buttons', async () => { await dataTable.selectItem(file1.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); - await propertiesTab.moreInfoButton.click(); + await BrowserActions.click(propertiesTab.moreInfoButton); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); - await propertiesTab.lessInfoButton.click(); + await BrowserActions.click(propertiesTab.lessInfoButton); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(true, 'More information button not displayed'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(false, 'Less information button enabled'); @@ -231,11 +232,12 @@ describe('File / Folder properties', () => { ]; await dataTable.selectItem(image1.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); - await propertiesTab.moreInfoButton.click(); - await propertiesTab.imagePropertiesPanel.click(); + await BrowserActions.click(propertiesTab.moreInfoButton); + await BrowserActions.click(propertiesTab.imagePropertiesPanel); + await propertiesTab.waitForImagePropertiesPanelToExpand(); expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed'); diff --git a/e2e/suites/info-drawer/general.test.ts b/e2e/suites/info-drawer/general.test.ts index b0429ca20..5ebb87875 100755 --- a/e2e/suites/info-drawer/general.test.ts +++ b/e2e/suites/info-drawer/general.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('General', () => { const username = `user1-${Utils.random()}`; @@ -69,14 +70,14 @@ describe('General', () => { afterEach(async (done) => { if (await infoDrawer.isOpen()) { - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); } done(); }); it('[C268999] Info drawer closes on page refresh', async () => { await dataTable.selectItem(file1); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); await page.refresh(); diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/suites/info-drawer/library-properties.test.ts index a6a8ec448..a6c89b9cc 100755 --- a/e2e/suites/info-drawer/library-properties.test.ts +++ b/e2e/suites/info-drawer/library-properties.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, BrowsingPage, SITE_VISIBILITY, SITE_ROLES, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Library properties', () => { const username = `user1-${Utils.random()}`; @@ -93,14 +94,14 @@ describe('Library properties', () => { afterEach(async (done) => { if (await infoDrawer.isOpen()) { - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); } done(); }); it('[C289336] Info drawer opens for a library', async () => { await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); @@ -120,7 +121,7 @@ describe('Library properties', () => { it('[C289338] Editable properties', async () => { await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -139,7 +140,7 @@ describe('Library properties', () => { it('[C289339] Edit site details', async () => { await dataTable.selectItem(siteForUpdate.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -166,7 +167,7 @@ describe('Library properties', () => { const newDesc = `new desc ${Utils.random}`; await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -187,7 +188,7 @@ describe('Library properties', () => { await apis.user.queries.waitForSites(site.name, { expect: 1 }); await dataTable.selectItem(siteDup); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -198,7 +199,7 @@ describe('Library properties', () => { it('[C289342] Site name too long', async () => { await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -211,7 +212,7 @@ describe('Library properties', () => { it('[C289343] Site description too long', async () => { await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -240,7 +241,7 @@ describe('Library properties', () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(site.name); - await page.toolbar.viewDetailsButton.click(); + await BrowserActions.click(page.toolbar.viewDetailsButton); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index ae5df3936..288c450ff 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -47,6 +47,9 @@ describe('Favorites', () => { const adminApiActions = new AdminActions(); const userActions = new UserActions(); + let parentId: string; + let folderId: string; + beforeAll(async (done) => { await adminApiActions.login(); await adminApiActions.createUser({ username }); @@ -57,8 +60,8 @@ describe('Favorites', () => { await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE); const file1Id = (await adminApiActions.nodes.createFile(fileName1, docLibId)).entry.id; - const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; - const parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id; + folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id; + parentId = (await apis.user.nodes.createFolder(parentFolder)).entry.id; const file2Id = (await apis.user.nodes.createFile(fileName2, parentId)).entry.id; const file3Id = (await apis.user.nodes.createFile(fileName3, parentId)).entry.id; const file4Id = (await apis.user.nodes.createFile(fileName4, parentId)).entry.id; @@ -82,7 +85,7 @@ describe('Favorites', () => { afterAll(async (done) => { await adminApiActions.deleteSites([siteName]); - await userActions.deleteNodes([favFolderName, parentFolder]); + await userActions.deleteNodes([folderId, parentId]); await userActions.emptyTrashcan(); done(); }); diff --git a/e2e/suites/list-views/tooltips.test.ts b/e2e/suites/list-views/tooltips.test.ts index 52807b056..1a9606600 100755 --- a/e2e/suites/list-views/tooltips.test.ts +++ b/e2e/suites/list-views/tooltips.test.ts @@ -42,7 +42,15 @@ describe('File / folder tooltips', () => { const fileNameEqTitleDiffDesc = `file6-${Utils.random()}`; const fileNameEqDescDiffTitle = `file7-${Utils.random()}`; const fileTitleEqDesc = `file8-${Utils.random()}`; - let parentId, file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id; + let parentId: string; + let file1Id: string; + let file2Id: string; + let file3Id: string; + let file4Id: string; + let file5Id: string; + let file6Id: string; + let file7Id: string; + let file8Id: string; const fileTitle = 'file title'; const fileDescription = 'file description'; @@ -82,7 +90,7 @@ describe('File / folder tooltips', () => { }); afterAll(async (done) => { - await userActions.deleteNodes([parent]); + await userActions.deleteNodes([parentId]); await userActions.emptyTrashcan(); done(); }); @@ -248,8 +256,15 @@ describe('File / folder tooltips', () => { describe('on Trash', () => { const parentForTrash = `parent-${Utils.random()}`; - let parentForTrashId, file1TrashId, file2TrashId, file3TrashId, file4TrashId; - let file5TrashId, file6TrashId, file7TrashId, file8TrashId; + let parentForTrashId: string; + let file1TrashId: string; + let file2TrashId: string; + let file3TrashId: string; + let file4TrashId: string; + let file5TrashId: string; + let file6TrashId: string; + let file7TrashId: string; + let file8TrashId: string; beforeAll(async (done) => { parentForTrashId = (await apis.user.nodes.createFolder(parentForTrash)).entry.id; @@ -273,7 +288,7 @@ describe('File / folder tooltips', () => { }); afterAll(async (done) => { - await userActions.deleteNodes([parentForTrash]); + await userActions.deleteNodes([parentForTrashId]); await userActions.emptyTrashcan(); done(); }); diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index 49273e938..a961bcade 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -39,6 +39,13 @@ describe('Breadcrumb', () => { const fileName1 = `file1-${Utils.random()}.txt`; const siteName = `site-${Utils.random()}`; + const parentFromSite = `parent-in-site-${Utils.random()}`; + let parentFromSiteId: string; + const subFolder1FromSite = `subFolder1-in-site-${Utils.random()}`; + let subFolder1FromSiteId: string; + const subFolder2FromSite = `subFolder2-in-site-${Utils.random()}`; + let subFolder2FromSiteId: string; + const fileName1FromSite = `file1-in-site-${Utils.random()}.txt`; const parent2 = `parent2-${Utils.random()}`; let parent2Id: string; @@ -67,10 +74,10 @@ describe('Breadcrumb', () => { await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); const docLibId = await apis.user.sites.getDocLibId(siteName); - parentId = (await apis.user.nodes.createFolder(parent, docLibId)).entry.id; - subFolder1Id = (await apis.user.nodes.createFolder(subFolder1, parentId)).entry.id; - subFolder2Id = (await apis.user.nodes.createFolder(subFolder2, subFolder1Id)).entry.id; - await apis.user.nodes.createFile(fileName1, subFolder2Id); + parentFromSiteId = (await apis.user.nodes.createFolder(parentFromSite, docLibId)).entry.id; + subFolder1FromSiteId = (await apis.user.nodes.createFolder(subFolder1FromSite, parentFromSiteId)).entry.id; + subFolder2FromSiteId = (await apis.user.nodes.createFolder(subFolder2FromSite, subFolder1FromSiteId)).entry.id; + await apis.user.nodes.createFile(fileName1FromSite, subFolder2FromSiteId); await loginPage.loginWith(username); done(); @@ -135,10 +142,10 @@ describe('Breadcrumb', () => { it('[C260967] File Libraries breadcrumb for a folder hierarchy', async () => { await page.clickFileLibrariesAndWait(); await page.dataTable.doubleClickOnRowByName(siteName); - await page.dataTable.doubleClickOnRowByName(parent); - await page.dataTable.doubleClickOnRowByName(subFolder1); - await page.dataTable.doubleClickOnRowByName(subFolder2); - const expectedItems = ['Favorite Libraries', siteName, parent, subFolder1, subFolder2]; + await page.dataTable.doubleClickOnRowByName(parentFromSite); + await page.dataTable.doubleClickOnRowByName(subFolder1FromSite); + await page.dataTable.doubleClickOnRowByName(subFolder2FromSite); + const expectedItems = ['Favorite Libraries', siteName, parentFromSite, subFolder1FromSite, subFolder2FromSite]; expect(await breadcrumb.getAllItems()).toEqual(expectedItems); }); diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/suites/navigation/single-click.test.ts index 269ddae7d..e9e8b5332 100755 --- a/e2e/suites/navigation/single-click.test.ts +++ b/e2e/suites/navigation/single-click.test.ts @@ -59,18 +59,22 @@ describe('Single click on item name', () => { await adminApiActions.createUser({ username }); await userActions.login(username, username); + const initialRecentTotalItems = await apis.user.search.getTotalItems(username); + file1Id = (await apis.user.nodes.createFile(file1)).entry.id; folder1Id = (await apis.user.nodes.createFolder(folder1)).entry.id; + await apis.user.sites.createSite(siteName); + const docLibId = await apis.user.sites.getDocLibId(siteName); + await apis.user.nodes.createFile(fileSite, docLibId); + + await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 2 }); + deletedFile1Id = (await apis.user.nodes.createFile(deletedFile1)).entry.id; deletedFolder1Id = (await apis.user.nodes.createFolder(deletedFolder1)).entry.id; await userActions.deleteNodes([deletedFile1Id, deletedFolder1Id], false); - await apis.user.sites.createSite(siteName); - const docLibId = await apis.user.sites.getDocLibId(siteName); - await apis.user.nodes.createFile(fileSite, docLibId); - await loginPage.loginWith(username); done(); }); @@ -204,8 +208,6 @@ describe('Single click on item name', () => { describe('on Search Results', () => { beforeEach(async () => { - const initialRecentTotalItems = await apis.user.search.getTotalItems(username); - await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 2 }); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); }); diff --git a/e2e/suites/pagination/favorites.ts b/e2e/suites/pagination/favorites.ts index 9462fa156..e2fb3a73e 100755 --- a/e2e/suites/pagination/favorites.ts +++ b/e2e/suites/pagination/favorites.ts @@ -40,16 +40,16 @@ export function favoritesTests(username: string) { await Utils.pressEscape(); }); - it('Pagination control default values - [C280113]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + it('[C280113] Pagination control default values', async () => { + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); - it('Items per page values - [C280114]', async () => { + it('[C280114] Items per page values', async () => { await pagination.openMaxItemsMenu(); expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); @@ -57,51 +57,48 @@ export function favoritesTests(username: string) { await pagination.menu.closeMenu(); }); - it('current page menu items - [C280115]', async () => { + it('[C280115] current page menu items', async () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); - it('change the current page from menu - [C280116]', async () => { + it('[C280116] change the current page from menu', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('my-file-1')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); - it('navigate to next and previous pages - [C280119]', async () => { + it('[C280119] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('my-file-21')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -109,22 +106,22 @@ export function favoritesTests(username: string) { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('1-25 of 51'); + expect(await dataTable.isItemPresent('my-file-50')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); - it('Previous button is disabled on first page - [C280117]', async () => { + it('[C280117] Previous button is disabled on first page', async () => { expect(await pagination.getCurrentPage()).toContain('Page 1'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); }); - it('Next button is disabled on last page - [C280118]', async () => { + it('[C280118] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/multiple-pages-files.test.ts b/e2e/suites/pagination/multiple-pages-files.test.ts index e84e30610..2a3c6429c 100644 --- a/e2e/suites/pagination/multiple-pages-files.test.ts +++ b/e2e/suites/pagination/multiple-pages-files.test.ts @@ -37,7 +37,7 @@ describe('Pagination on multiple pages : ', () => { const parent = `parent-${random}`; let parentId: string; - const files = Array(101) + const files = Array(51) .fill('my-file') .map((name, index): string => `${name}-${index + 1}-${random}.txt`); let filesIds: string[]; @@ -61,7 +61,7 @@ describe('Pagination on multiple pages : ', () => { initialFavoritesTotalItems = await userApi.favorites.getFavoritesTotalItems(); await userApi.shared.shareFilesByIds(filesIds); await userApi.favorites.addFavoritesByIds('file', filesIds); - }, 150000); + }, 300000); afterAll(async () => { await userApi.nodes.deleteNodeById(parentId); @@ -73,29 +73,29 @@ describe('Pagination on multiple pages : ', () => { describe('on Recent Files', () => { beforeAll(async () => { - await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 }); - }, 120000); + await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 }); + }, 300000); recentFilesTests(username); }); describe('on Search Results', () => { beforeAll(async () => { - await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 }); - }, 120000); + await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 }); + }, 300000); searchResultsTests(username); }); describe('on Shared Files', () => { beforeAll(async () => { - await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 101 }); - }, 120000); + await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 51 }); + }, 300000); sharedFilesTests(username); }); describe('on Favorites', () => { beforeAll(async () => { - await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 101 }); - }, 120000); + await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 51 }); + }, 300000); favoritesTests(username); }); }); diff --git a/e2e/suites/pagination/multiple-pages-libraries.test.ts b/e2e/suites/pagination/multiple-pages-libraries.test.ts index 9409f1adc..15cdd5bad 100755 --- a/e2e/suites/pagination/multiple-pages-libraries.test.ts +++ b/e2e/suites/pagination/multiple-pages-libraries.test.ts @@ -24,6 +24,7 @@ */ import { LoginPage, BrowsingPage, Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared'; +import { Logger } from '@alfresco/adf-testing'; describe('Pagination on multiple pages', () => { const random = Utils.random(); @@ -37,25 +38,33 @@ describe('Pagination on multiple pages', () => { const page = new BrowsingPage(); const { dataTable, pagination } = page; - const sites = Array(101) + const sites = Array(51) .fill('site') .map((name, index): string => `${name}-${index + 1}-${random}`); let initialSitesTotalItems: number; beforeAll(async () => { - await adminApiActions.createUser({ username }); + try { + await adminApiActions.createUser({ username }); - initialSitesTotalItems = await userApi.sites.getSitesTotalItems(); - await userApi.sites.createSitesPrivate(sites); - await userApi.sites.waitForApi({ expect: initialSitesTotalItems + 101 }); + initialSitesTotalItems = await userApi.sites.getSitesTotalItems(); + await userApi.sites.createSitesPrivate(sites); + await userApi.sites.waitForApi({ expect: initialSitesTotalItems + 51 }); - await loginPage.loginWith(username); + await loginPage.loginWith(username); + } catch (error) { + Logger.error(`----- beforeAll failed : ${error}`); + } }, 450000); afterAll(async () => { - await userApi.sites.deleteSites(sites); - await userApi.sites.waitForApi({ expect: initialSitesTotalItems }); + try { + await userApi.sites.deleteSites(sites); + await userApi.sites.waitForApi({ expect: initialSitesTotalItems }); + } catch (error) { + Logger.error(`----- afterAll failed : ${error}`); + } }, 420000); describe('on My Libraries', () => { @@ -68,10 +77,10 @@ describe('Pagination on multiple pages', () => { }); it('[C280086] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); @@ -88,39 +97,36 @@ describe('Pagination on multiple pages', () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); it('[C280089] change the current page from menu', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); + await pagination.menu.clickNthItem(2); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await pagination.getCurrentPage()).toContain('Page 2'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('site-60')).toBe(true, 'Site-60 not found on page'); + expect(await dataTable.isItemPresent('site-34')).toBe(true, 'Site-34 not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -128,8 +134,8 @@ describe('Pagination on multiple pages', () => { it('[C280092] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('site-31')).toBe(true, 'Site-31 not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('site-34')).toBe(true, 'Site-34 not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -137,7 +143,7 @@ describe('Pagination on multiple pages', () => { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await dataTable.isItemPresent('site-12')).toBe(true, 'Site-12 not found on page'); await pagination.resetToDefaultPageNumber(); @@ -150,9 +156,9 @@ describe('Pagination on multiple pages', () => { it('[C280091] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); @@ -167,10 +173,10 @@ describe('Pagination on multiple pages', () => { }); it('[C291875] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); @@ -187,27 +193,24 @@ describe('Pagination on multiple pages', () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); @@ -215,11 +218,11 @@ describe('Pagination on multiple pages', () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('site-40')).toBe(true, 'Site-60 not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('site-1')).toBe(true, 'Site-1 not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -227,8 +230,8 @@ describe('Pagination on multiple pages', () => { it('[C291881] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('site-70')).toBe(true, 'Site-31 not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('site-21')).toBe(true, 'Site-21 not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -236,8 +239,8 @@ describe('Pagination on multiple pages', () => { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('site-88')).toBe(true, 'Site-12 not found on page'); + expect(await pagination.getRange()).toContain('1-25 of 51'); + expect(await dataTable.isItemPresent('site-32')).toBe(true, 'Site-32 not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -249,9 +252,9 @@ describe('Pagination on multiple pages', () => { it('[C291880] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/multiple-pages-trash.test.ts b/e2e/suites/pagination/multiple-pages-trash.test.ts index 959a5c9f0..78daf457c 100755 --- a/e2e/suites/pagination/multiple-pages-trash.test.ts +++ b/e2e/suites/pagination/multiple-pages-trash.test.ts @@ -29,7 +29,7 @@ describe('Pagination on multiple pages on Trash', () => { const random = Utils.random(); const username = `user-${random}`; - const filesForDelete = Array(101) + const filesForDelete = Array(51) .fill('file') .map((name, index): string => `${name}-${index + 1}-${random}.txt`); let filesDeletedIds: string[]; @@ -50,11 +50,11 @@ describe('Pagination on multiple pages on Trash', () => { filesDeletedIds = (await userApi.nodes.createFiles(filesForDelete)).list.entries.map((entries: any) => entries.entry.id); await userActions.deleteNodes(filesDeletedIds, false); - await userActions.waitForTrashcanSize(101); + await userActions.waitForTrashcanSize(51); await loginPage.loginWith(username); await page.clickTrashAndWait(); - }, 120000); + }, 300000); afterEach(async () => { await Utils.pressEscape(); @@ -65,10 +65,10 @@ describe('Pagination on multiple pages on Trash', () => { }); it('[C280122] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); @@ -85,27 +85,24 @@ describe('Pagination on multiple pages on Trash', () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); @@ -113,11 +110,11 @@ describe('Pagination on multiple pages on Trash', () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('file-40')).toBe(true, 'File not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('file-1')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -125,8 +122,8 @@ describe('Pagination on multiple pages on Trash', () => { it('[C280128] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('file-26')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -134,8 +131,8 @@ describe('Pagination on multiple pages on Trash', () => { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('1-25 of 51'); + expect(await dataTable.isItemPresent('file-50')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -147,9 +144,9 @@ describe('Pagination on multiple pages on Trash', () => { it('[C280127] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/personal-files.ts b/e2e/suites/pagination/personal-files.ts index 4931451ef..46fd69f05 100755 --- a/e2e/suites/pagination/personal-files.ts +++ b/e2e/suites/pagination/personal-files.ts @@ -43,10 +43,10 @@ export function personalFilesTests(username: string, parentName: string) { }); it('[C280077] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); @@ -63,27 +63,24 @@ export function personalFilesTests(username: string, parentName: string) { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); @@ -91,11 +88,11 @@ export function personalFilesTests(username: string, parentName: string) { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('my-file-60')).toBe(true, 'File not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('my-file-9')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -103,8 +100,8 @@ export function personalFilesTests(username: string, parentName: string) { it('[C280083] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('my-file-31')).toBe(true, 'file-31 not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('my-file-34')).toBe(true, 'my-file-34 not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -112,8 +109,8 @@ export function personalFilesTests(username: string, parentName: string) { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('my-file-12')).toBe(true, 'my-file-12 not found on page'); + expect(await pagination.getRange()).toContain('1-25 of 51'); + expect(await dataTable.isItemPresent('my-file-15')).toBe(true, 'my-file-15 not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -125,9 +122,9 @@ export function personalFilesTests(username: string, parentName: string) { it('[C280082] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/recent-files.ts b/e2e/suites/pagination/recent-files.ts index da25559ea..7911f2287 100755 --- a/e2e/suites/pagination/recent-files.ts +++ b/e2e/suites/pagination/recent-files.ts @@ -40,16 +40,16 @@ export function recentFilesTests(username: string) { await Utils.pressEscape(); }); - it('Pagination control default values - [C280104]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + it('[C280104] Pagination control default values', async () => { + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); - it('Items per page values - [C280105]', async () => { + it('[C280105] Items per page values', async () => { await pagination.openMaxItemsMenu(); expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); @@ -57,52 +57,49 @@ export function recentFilesTests(username: string) { await pagination.menu.closeMenu(); }); - it('current page menu items - [C280106]', async () => { + it('[C280106] current page menu items', async () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); - it('change the current page from menu - [C280107]', async () => { + it('[C280107] change the current page from menu', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('my-file-1')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); - it('navigate to next and previous pages - [C280110]', async () => { + it('[C280110] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 101'); - expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('26-50 of 51'); + expect(await dataTable.isItemPresent('my-file-21')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -110,22 +107,22 @@ export function recentFilesTests(username: string) { await dataTable.waitForHeader(); await pagination.clickPrevious(); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 101'); - expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + expect(await pagination.getRange()).toContain('1-25 of 51'); + expect(await dataTable.isItemPresent('my-file-50')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); - it('Previous button is disabled on first page - [C280108]', async () => { + it('[C280108] Previous button is disabled on first page', async () => { expect(await pagination.getCurrentPage()).toContain('Page 1'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); }); - it('Next button is disabled on last page - [C280109]', async () => { + it('[C280109] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/search-results.ts b/e2e/suites/pagination/search-results.ts index eb0c7bf99..7fab312d3 100755 --- a/e2e/suites/pagination/search-results.ts +++ b/e2e/suites/pagination/search-results.ts @@ -43,16 +43,16 @@ export function searchResultsTests(username: string) { await Utils.pressEscape(); }); - it('Pagination control default values - [C290125]', async () => { - expect(await pagination.getRange()).toContain('1-25 of 101'); + it('[C290125] Pagination control default values', async () => { + expect(await pagination.getRange()).toContain('1-25 of 51'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); - it('Items per page values - [C290126]', async () => { + it('[C290126] Items per page values', async () => { await pagination.openMaxItemsMenu(); expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); @@ -60,50 +60,47 @@ export function searchResultsTests(username: string) { await pagination.menu.closeMenu(); }); - it('current page menu items - [C290127]', async () => { + it('[C290127] current page menu items', async () => { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); - it('change the current page from menu - [C290128]', async () => { + it('[C290128] change the current page from menu', async () => { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('51-75 of 101'); + expect(await pagination.getRange()).toContain('51-51 of 51'); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); await pagination.resetToDefaultPageNumber(); }); - it('navigate to next and previous pages - [C290131]', async () => { + it('[C290131] navigate to next and previous pages', async () => { await pagination.clickNext(); await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('26-50 of 101'); + expect(await pagination.getRange()).toContain('26-50 of 51'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -111,21 +108,21 @@ export function searchResultsTests(username: string) { await dataTable.waitForBody(); await pagination.clickPrevious(); await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('1-25 of 101'); + expect(await pagination.getRange()).toContain('1-25 of 51'); await pagination.resetToDefaultPageNumber(); }); - it('Previous button is disabled on first page - [C290129]', async () => { + it('[C290129] Previous button is disabled on first page - ', async () => { expect(await pagination.getCurrentPage()).toContain('Page 1'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); }); - it('Next button is disabled on last page - [C290130]', async () => { + it('[C290130] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); + await pagination.menu.clickNthItem(3); expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/pagination/shared-files.ts b/e2e/suites/pagination/shared-files.ts index 25f6f9202..d44c88b1f 100755 --- a/e2e/suites/pagination/shared-files.ts +++ b/e2e/suites/pagination/shared-files.ts @@ -23,17 +23,21 @@ * along with Alfresco. If not, see . */ -import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; +import { BrowsingPage, LoginPage, Utils, RepoClient } from '@alfresco/aca-testing-shared'; export function sharedFilesTests(username: string) { const page = new BrowsingPage(); const loginPage = new LoginPage(); const { dataTable, pagination } = page; + const userApi = new RepoClient(username, username); + let sharedTotalItems: number; + describe('Pagination controls : ', () => { beforeAll(async () => { await loginPage.loginWith(username); await page.clickSharedFilesAndWait(); + sharedTotalItems = await userApi.shared.getSharedLinksTotalItems(); }); afterEach(async () => { @@ -44,7 +48,7 @@ export function sharedFilesTests(username: string) { expect(await pagination.getRange()).toContain('1-25'); expect(await pagination.getMaxItems()).toContain('25'); expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 5'); + expect(await pagination.getTotalPages()).toContain('of 3'); expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); }); @@ -61,27 +65,24 @@ export function sharedFilesTests(username: string) { await pagination.openMaxItemsMenu(); await pagination.menu.clickMenuItem('25'); expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 5'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(5); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 3'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(3); await pagination.menu.closeMenu(); await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); + await pagination.menu.clickMenuItem('50'); + expect(await pagination.getMaxItems()).toContain('50'); expect(await pagination.getTotalPages()).toContain('of 2'); await pagination.openCurrentPageMenu(); expect(await pagination.menu.getItemsCount()).toBe(2); await pagination.menu.closeMenu(); + await pagination.openMaxItemsMenu(); + await pagination.menu.clickMenuItem('100'); + expect(await pagination.getMaxItems()).toContain('100'); + expect(await pagination.getTotalPages()).toContain('of 1'); + await pagination.resetToDefaultPageSize(); }); @@ -89,11 +90,11 @@ export function sharedFilesTests(username: string) { await pagination.openCurrentPageMenu(); await pagination.menu.clickNthItem(3); await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-75'); + expect(await pagination.getRange()).toContain(`51-${sharedTotalItems}`); expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('my-file-40')).toBe(true, 'File not found on page'); + expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); + expect(await dataTable.isItemPresent('my-file-1')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -102,7 +103,7 @@ export function sharedFilesTests(username: string) { await pagination.clickNext(); await dataTable.waitForHeader(); expect(await pagination.getRange()).toContain('26-50'); - expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page'); + expect(await dataTable.isItemPresent('my-file-21')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); await pagination.openCurrentPageMenu(); @@ -111,7 +112,7 @@ export function sharedFilesTests(username: string) { await pagination.clickPrevious(); await dataTable.waitForHeader(); expect(await pagination.getRange()).toContain('1-25'); - expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page'); + expect(await dataTable.isItemPresent('my-file-50')).toBe(true, 'File not found on page'); await pagination.resetToDefaultPageNumber(); }); @@ -123,8 +124,8 @@ export function sharedFilesTests(username: string) { it('[C280100] Next button is disabled on last page', async () => { await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(5); - expect(await pagination.getCurrentPage()).toContain('Page 5'); + await pagination.menu.clickNthItem(3); + expect(await pagination.getCurrentPage()).toContain('Page 3'); expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); }); }); diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts index 276c4ae15..c909db195 100644 --- a/e2e/suites/search/search-filters.test.ts +++ b/e2e/suites/search/search-filters.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, SearchResultsPage, RepoClient, Utils, FILES, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; const moment = require('moment'); @@ -181,6 +182,7 @@ describe('Search filters', () => { const future = moment().add(1, 'month').format('DD-MMM-YY'); afterEach(async (done) => { + await createdDateFilter.expandPanel(); await createdDateFilter.resetPanel(); done(); }); @@ -283,7 +285,7 @@ describe('Search filters', () => { describe('Filter by File type', () => { afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); done(); }); @@ -337,7 +339,7 @@ describe('Search filters', () => { describe('Filter by Creator', () => { afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); done(); }); @@ -392,7 +394,7 @@ describe('Search filters', () => { describe('Filter by Modifier', () => { afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); done(); }); @@ -447,7 +449,7 @@ describe('Search filters', () => { describe('Filter by Location', () => { afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); done(); }); @@ -504,7 +506,7 @@ describe('Search filters', () => { const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)']; afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); done(); }); @@ -561,9 +563,8 @@ describe('Search filters', () => { describe('Multiple filters', () => { afterEach(async (done) => { - await filters.resetAllButton.click(); + await BrowserActions.click(filters.resetAllButton); await sizeFilter.resetPanel(); - await createdDateFilter.resetPanel(); done(); }); diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/suites/viewer/viewer-actions.test.ts index 60b8feb7c..07b6d24de 100755 --- a/e2e/suites/viewer/viewer-actions.test.ts +++ b/e2e/suites/viewer/viewer-actions.test.ts @@ -37,6 +37,7 @@ import { ManageVersionsDialog, UploadNewVersionDialog } from '@alfresco/aca-testing-shared'; +import { BrowserVisibility } from '@alfresco/adf-testing'; describe('Viewer actions', () => { const username = `user-${Utils.random()}`; @@ -244,8 +245,16 @@ describe('Viewer actions', () => { await viewer.waitForViewerToOpen(); await toolbar.openMoreMenu(); - expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(true, `'Cancel Editing' button should be shown`); - expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(false, `'Edit Offline' shouldn't be shown`); + await BrowserVisibility.waitUntilElementIsVisible( + toolbar.menu.cancelEditingAction, + BrowserVisibility.DEFAULT_TIMEOUT, + `'Cancel Editing' button should be shown` + ); + await BrowserVisibility.waitUntilElementIsVisible( + toolbar.menu.editOfflineAction, + BrowserVisibility.DEFAULT_TIMEOUT, + `'Edit Offline' shouldn't be shown` + ); await toolbar.menu.clickMenuItem('Upload New Version'); await Utils.uploadFileNewVersion(docxFile); @@ -254,8 +263,16 @@ describe('Viewer actions', () => { await uploadNewVersionDialog.uploadButton.click(); await toolbar.openMoreMenu(); - expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); - expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`); + await BrowserVisibility.waitUntilElementIsVisible( + toolbar.menu.cancelEditingAction, + BrowserVisibility.DEFAULT_TIMEOUT, + `'Cancel Editing' button shouldn't be shown` + ); + await BrowserVisibility.waitUntilElementIsVisible( + toolbar.menu.editOfflineAction, + BrowserVisibility.DEFAULT_TIMEOUT, + `'Edit Offline' should be shown` + ); }); it('[C279282] Full screen action', async () => { diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts index 271dea565..7a4ecfb56 100755 --- a/e2e/suites/viewer/viewer-general.test.ts +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, UserActions, LoginPage, BrowsingPage, FILES, SITE_VISIBILITY, RepoClient, Utils, Viewer } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Viewer general', () => { const username = `user-${Utils.random()}`; @@ -111,7 +112,8 @@ describe('Viewer general', () => { it('[C279270] Viewer opens when clicking the View action for a file', async () => { await dataTable.selectItem(xlsxFile); - await page.toolbar.viewButton.click(); + await BrowserActions.click(page.toolbar.viewButton); + expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); }); @@ -126,7 +128,7 @@ describe('Viewer general', () => { it('[C279271] Close the viewer', async () => { await dataTable.doubleClickOnRowByName(xlsxFile); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await viewer.closeButton.click(); + await BrowserActions.click(viewer.closeButton); expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close'); }); diff --git a/e2e/suites/viewer/viewer-protected-file.test.ts b/e2e/suites/viewer/viewer-protected-file.test.ts index 950e28196..2849fe512 100755 --- a/e2e/suites/viewer/viewer-protected-file.test.ts +++ b/e2e/suites/viewer/viewer-protected-file.test.ts @@ -24,6 +24,7 @@ */ import { AdminActions, LoginPage, BrowsingPage, FILES, RepoClient, Utils, Viewer, PasswordDialog } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Viewer - password protected file', () => { const username = `user-${Utils.random()}`; @@ -83,7 +84,7 @@ describe('Viewer - password protected file', () => { await passwordDialog.enterPassword(protectedFile.password); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); - await passwordDialog.submitButton.click(); + await BrowserActions.click(passwordDialog.submitButton); await passwordDialog.waitForDialogToClose(); expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed'); @@ -92,7 +93,7 @@ describe('Viewer - password protected file', () => { it('[C268960] Error appears when entering an incorrect password', async () => { await passwordDialog.enterPassword('incorrect'); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); - await passwordDialog.submitButton.click(); + await BrowserActions.click(passwordDialog.submitButton); expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong'); expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed'); diff --git a/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts b/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts index 119bb0576..952df93b7 100755 --- a/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts +++ b/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts @@ -26,6 +26,7 @@ import { browser, by } from 'protractor'; import { Component } from '../component'; import { waitForPresence, waitForStaleness } from '../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class DropDownBreadcrumb extends Component { pathOptionCss = '.adf-dropdown-breadcrumb-path-option .mat-option-text'; @@ -47,13 +48,13 @@ export class DropDownBreadcrumb extends Component { } async openPath(): Promise { - await this.trigger.click(); + await BrowserActions.click(this.trigger); await this.waitForPathListDropdownToOpen(); } async clickPathItem(name: string): Promise { const elem = browser.element(by.cssContainingText(this.pathOptionCss, name)); - await elem.click(); + await BrowserActions.click(elem); } async getPathItems(): Promise { diff --git a/projects/aca-testing-shared/src/components/data-table/data-table.ts b/projects/aca-testing-shared/src/components/data-table/data-table.ts index 6f257c8e7..31f01cf14 100755 --- a/projects/aca-testing-shared/src/components/data-table/data-table.ts +++ b/projects/aca-testing-shared/src/components/data-table/data-table.ts @@ -24,11 +24,11 @@ */ import { browser, by, ElementArrayFinder, ElementFinder, protractor } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserVisibility, Logger } from '@alfresco/adf-testing'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Component } from '../component'; import { Menu } from '../menu/menu'; -import { Utils, waitForClickable, waitForPresence } from '../../utilities/utils'; +import { Utils, waitForPresence } from '../../utilities/utils'; export class DataTable extends Component { private static selectors = { @@ -223,7 +223,7 @@ export class DataTable extends Component { async doubleClickOnRowByName(name: string, location: string = ''): Promise { try { const item = this.getRowFirstCell(name, location); - await waitForClickable(item); + await BrowserVisibility.waitUntilElementIsClickable(item); await browser.actions().mouseMove(item).perform(); await browser.actions().doubleClick().perform(); } catch (error) { diff --git a/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts b/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts index a4d9ac2c0..3559ec43f 100755 --- a/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts +++ b/projects/aca-testing-shared/src/components/datetime-picker/datetime-picker.ts @@ -27,6 +27,7 @@ import { by, browser } from 'protractor'; import { Component } from '../component'; import { isPresentAndDisplayed, waitForStaleness } from '../../utilities/utils'; const moment = require('moment'); +import { BrowserActions } from '@alfresco/adf-testing'; export class DateTimePicker extends Component { calendar = this.byCss('.mat-datetimepicker-popup', browser); @@ -57,7 +58,7 @@ export class DateTimePicker extends Component { const year = await this.headerYear.getText(); const firstActiveDay = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content'; const elem = this.dayPicker.element(by.cssContainingText(firstActiveDay, `${dayOfTomorrow}`)); - await elem.click(); + await BrowserActions.click(elem); return `${date} ${year}`; } } diff --git a/projects/aca-testing-shared/src/components/dialog/content-node-selector-dialog.ts b/projects/aca-testing-shared/src/components/dialog/content-node-selector-dialog.ts index 8da8982f7..24c635d69 100755 --- a/projects/aca-testing-shared/src/components/dialog/content-node-selector-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/content-node-selector-dialog.ts @@ -25,9 +25,10 @@ import { by, browser, protractor } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { Utils, isPresentAndDisplayed, waitForStaleness, waitForPresence, isPresentAndEnabled, waitForClickable } from '../../utilities/utils'; +import { isPresentAndDisplayed, waitForStaleness, waitForPresence, isPresentAndEnabled } from '../../utilities/utils'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DataTable } from '../data-table/data-table'; +import { BrowserActions } from '@alfresco/adf-testing'; export class ContentNodeSelectorDialog extends GenericDialog { cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]')); @@ -53,13 +54,12 @@ export class ContentNodeSelectorDialog extends GenericDialog { } async selectLocation(location: string): Promise { - await this.locationDropDown.click(); - await waitForPresence(this.locationPersonalFiles); + await BrowserActions.click(this.locationDropDown); if (location === 'Personal Files') { - await this.locationPersonalFiles.click(); + await BrowserActions.click(this.locationPersonalFiles); } else { - await this.locationFileLibraries.click(); + await BrowserActions.click(this.locationFileLibraries); } await this.waitForDropDownToClose(); @@ -67,8 +67,7 @@ export class ContentNodeSelectorDialog extends GenericDialog { async selectDestination(folderName: string): Promise { const row = this.dataTable.getRowByName(folderName); - await waitForClickable(row); - await row.click(); + await BrowserActions.click(row); await waitForPresence(browser.element(by.css('.adf-is-selected'))); } @@ -85,7 +84,7 @@ export class ContentNodeSelectorDialog extends GenericDialog { } async searchFor(text: string): Promise { - await Utils.clearFieldWithBackspace(this.searchInput); + await BrowserActions.clearWithBackSpace(this.searchInput); await this.searchInput.sendKeys(text); await this.searchInput.sendKeys(protractor.Key.ENTER); } diff --git a/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts index cb381472c..816f71f39 100755 --- a/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/create-edit-folder-dialog.ts @@ -25,15 +25,16 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndDisplayed, waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export class CreateOrEditFolderDialog extends GenericDialog { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); cancelButton = this.childElement(by.id('adf-folder-cancel-button')); updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update')); - nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]')); - descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]')); + nameInput = this.rootElem.element(by.css('input[data-placeholder="Name" i]')); + descriptionTextArea = this.rootElem.element(by.css('textarea[data-placeholder="Description" i]')); validationMessage = this.rootElem.element(by.css('.mat-hint span')); constructor() { @@ -42,7 +43,7 @@ export class CreateOrEditFolderDialog extends GenericDialog { async waitForDialogToOpen() { await super.waitForDialogToOpen(); - await waitForClickable(this.nameInput); + await BrowserVisibility.waitUntilElementIsClickable(this.nameInput); } async isUpdateButtonEnabled(): Promise { @@ -66,11 +67,11 @@ export class CreateOrEditFolderDialog extends GenericDialog { } async getName(): Promise { - return this.nameInput.getAttribute('value'); + return BrowserActions.getInputValue(this.nameInput); } async getDescription(): Promise { - return this.descriptionTextArea.getAttribute('value'); + return BrowserActions.getInputValue(this.descriptionTextArea); } async enterName(name: string): Promise { @@ -82,7 +83,7 @@ export class CreateOrEditFolderDialog extends GenericDialog { } async clickCancel(): Promise { - await this.cancelButton.click(); + await BrowserActions.click(this.cancelButton); await this.waitForDialogToClose(); } } diff --git a/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts index ca838c669..28fc7f30a 100755 --- a/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/create-from-template-dialog.ts @@ -26,14 +26,15 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class CreateFromTemplateDialog extends GenericDialog { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL')); - nameInput = this.childElement(by.css('input[placeholder="Name" i]')); - titleInput = this.childElement(by.css('input[placeholder="Title" i]')); - descriptionTextArea = this.childElement(by.css('textarea[placeholder="Description" i]')); + nameInput = this.childElement(by.css('input[data-placeholder="Name" i]')); + titleInput = this.childElement(by.css('input[data-placeholder="Title" i]')); + descriptionTextArea = this.childElement(by.css('textarea[data-placeholder="Description" i]')); validationMessage = this.childElement(by.css('.mat-error')); constructor() { @@ -61,11 +62,11 @@ export class CreateFromTemplateDialog extends GenericDialog { } async getName(): Promise { - return this.nameInput.getAttribute('value'); + return BrowserActions.getInputValue(this.nameInput); } async getDescription(): Promise { - return this.descriptionTextArea.getAttribute('value'); + return BrowserActions.getInputValue(this.descriptionTextArea); } async enterName(name: string): Promise { @@ -81,7 +82,7 @@ export class CreateFromTemplateDialog extends GenericDialog { } async clickCancel(): Promise { - await this.cancelButton.click(); + await BrowserActions.click(this.cancelButton); await this.waitForDialogToClose(); } } diff --git a/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts b/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts index 4a235759a..9cab2531d 100755 --- a/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/create-library-dialog.ts @@ -25,15 +25,16 @@ import { by, ElementFinder } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export class CreateLibraryDialog extends GenericDialog { createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel')); - nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]')); - libraryIdInput = this.rootElem.element(by.css('input[placeholder="Library ID" i]')); - descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]')); + nameInput = this.rootElem.element(by.css('input[data-placeholder="Name" i]')); + libraryIdInput = this.rootElem.element(by.css('input[data-placeholder="Library ID" i]')); + descriptionTextArea = this.rootElem.element(by.css('textarea[data-placeholder="Description" i]')); visibilityPublic = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Public')); visibilityModerated = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Moderated')); visibilityPrivate = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Private')); @@ -46,7 +47,7 @@ export class CreateLibraryDialog extends GenericDialog { async waitForDialogToOpen(): Promise { await super.waitForDialogToOpen(); - await waitForClickable(this.nameInput); + await BrowserVisibility.waitUntilElementIsClickable(this.nameInput); } async getErrorMessage(): Promise { @@ -77,7 +78,7 @@ export class CreateLibraryDialog extends GenericDialog { } async clickCancel(): Promise { - await this.cancelButton.click(); + await BrowserActions.click(this.cancelButton); await this.waitForDialogToClose(); } diff --git a/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts b/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts index 196ae76d4..2a729bff7 100644 --- a/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts @@ -24,7 +24,8 @@ */ import { ElementFinder, by, browser, Locator } from 'protractor'; -import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils'; +import { isPresentAndDisplayed, waitForPresence, waitForStaleness } from '../../utilities/utils'; +import { BrowserVisibility } from '@alfresco/adf-testing'; export abstract class GenericDialog { protected constructor(private rootCssSelector?: string) {} @@ -47,7 +48,7 @@ export abstract class GenericDialog { async waitForDialogToOpen(): Promise { await waitForPresence(this.rootElem); - await waitForVisibility(this.content); + await BrowserVisibility.waitUntilElementIsVisible(this.content); await waitForPresence(browser.element(by.css('.cdk-overlay-backdrop'))); } 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 2989d543e..35598be52 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 @@ -25,6 +25,7 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; +import { BrowserActions } from '@alfresco/adf-testing'; export class ManageVersionsDialog extends GenericDialog { closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close')); @@ -34,7 +35,7 @@ export class ManageVersionsDialog extends GenericDialog { } async clickClose(): Promise { - await this.closeButton.click(); + await BrowserActions.click(this.closeButton); await this.waitForDialogToClose(); } } diff --git a/projects/aca-testing-shared/src/components/dialog/password-dialog.ts b/projects/aca-testing-shared/src/components/dialog/password-dialog.ts index f776c8546..a2ce6dc8f 100755 --- a/projects/aca-testing-shared/src/components/dialog/password-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/password-dialog.ts @@ -25,7 +25,8 @@ import { by, browser } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { isPresentAndEnabled, typeText } from '../../utilities/utils'; +import { BrowserVisibility } from '@alfresco/adf-testing'; export class PasswordDialog extends GenericDialog { closeButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-close"]')); @@ -38,8 +39,7 @@ export class PasswordDialog extends GenericDialog { } async waitForDialogToOpen(): Promise { - await super.waitForDialogToOpen(); - await waitForClickable(this.passwordInput); + await BrowserVisibility.waitUntilElementIsClickable(this.passwordInput); } async isDialogOpen(): Promise { diff --git a/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts b/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts index ddf6f6d91..6c150ec2f 100755 --- a/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/select-template-dialog.ts @@ -28,6 +28,7 @@ import { GenericDialog } from '../dialog/generic-dialog'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DataTable } from '../data-table/data-table'; import { isPresentAndEnabled } from '../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class SelectTemplateDialog extends GenericDialog { nextButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-choose"]')); @@ -49,12 +50,12 @@ export class SelectTemplateDialog extends GenericDialog { } async clickCancel(): Promise { - await this.cancelButton.click(); + await BrowserActions.click(this.cancelButton); await this.waitForDialogToClose(); } async clickNext(): Promise { - await this.nextButton.click(); + await BrowserActions.click(this.nextButton); await this.waitForDialogToClose(); } } diff --git a/projects/aca-testing-shared/src/components/dialog/share-dialog.ts b/projects/aca-testing-shared/src/components/dialog/share-dialog.ts index f438b02ab..7cdba60b3 100755 --- a/projects/aca-testing-shared/src/components/dialog/share-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/share-dialog.ts @@ -27,6 +27,7 @@ import { by } from 'protractor'; import { DateTimePicker } from '../../components/datetime-picker/datetime-picker'; import { GenericDialog } from '../dialog/generic-dialog'; import { isPresentAndEnabled } from '../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class ShareDialog extends GenericDialog { dateTimePicker = new DateTimePicker(); @@ -56,7 +57,7 @@ export class ShareDialog extends GenericDialog { } async getLinkUrl(): Promise { - return this.url.getAttribute('value'); + return BrowserActions.getInputValue(this.url); } async isUrlReadOnly(): Promise { @@ -69,7 +70,7 @@ export class ShareDialog extends GenericDialog { } async clickClose(): Promise { - await this.closeButton.click(); + await BrowserActions.click(this.closeButton); await this.waitForDialogToClose(); } @@ -90,11 +91,11 @@ export class ShareDialog extends GenericDialog { async closeDatetimePicker(): Promise { if (await this.dateTimePicker.isCalendarOpen()) { - await this.datetimePickerButton.click(); + await BrowserActions.click(this.datetimePickerButton); } } async getExpireDate(): Promise { - return this.expireInput.getAttribute('value'); + return BrowserActions.getInputValue(this.expireInput); } } diff --git a/projects/aca-testing-shared/src/components/header/header.ts b/projects/aca-testing-shared/src/components/header/header.ts index e9c782cc8..4ed1a4ec6 100755 --- a/projects/aca-testing-shared/src/components/header/header.ts +++ b/projects/aca-testing-shared/src/components/header/header.ts @@ -47,7 +47,7 @@ export class Header extends Component { } async openMoreMenu(): Promise { - await this.moreActions.click(); + await BrowserActions.click(this.moreActions); await this.menu.waitForMenuToOpen(); } @@ -63,7 +63,7 @@ export class Header extends Component { async expandSideNav(): Promise { const expanded = await this.isSidenavExpanded(); if (!expanded) { - await this.sidenavToggle.click(); + await BrowserActions.click(this.sidenavToggle); await waitElement(`[data-automation-id='expanded']`); } } @@ -71,7 +71,7 @@ export class Header extends Component { async collapseSideNav(): Promise { const expanded = await this.isSidenavExpanded(); if (expanded) { - await this.sidenavToggle.click(); + await BrowserActions.click(this.sidenavToggle); await waitElement(`[data-automation-id='collapsed']`); } } diff --git a/projects/aca-testing-shared/src/components/header/user-info.ts b/projects/aca-testing-shared/src/components/header/user-info.ts index 0437b99fa..3955c8c16 100755 --- a/projects/aca-testing-shared/src/components/header/user-info.ts +++ b/projects/aca-testing-shared/src/components/header/user-info.ts @@ -25,6 +25,7 @@ import { Menu } from '../menu/menu'; import { Component } from '../component'; +import { BrowserActions } from '@alfresco/adf-testing'; export class UserInfo extends Component { fullName = this.byCss('.current-user__full-name'); @@ -37,7 +38,7 @@ export class UserInfo extends Component { } async openMenu(): Promise { - await this.avatar.click(); + await BrowserActions.click(this.avatar); await this.menu.wait(); return this.menu; diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts index 77de76631..02767fed9 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-comments-tab.ts @@ -26,7 +26,8 @@ import { by, browser, until } from 'protractor'; import { Component } from '../component'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; -import { waitForVisibility, typeText } from '../../utilities/utils'; +import { typeText } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export class CommentsTab extends Component { commentsContainer = this.byCss('.adf-comments-container'); @@ -44,7 +45,7 @@ export class CommentsTab extends Component { } async waitForCommentsContainer() { - await waitForVisibility(this.commentsContainer); + await BrowserVisibility.waitUntilElementIsVisible(this.commentsContainer); } async getCommentsTabHeaderText(): Promise { @@ -111,10 +112,10 @@ export class CommentsTab extends Component { } async clickAddButton(): Promise { - await this.addCommentButton.click(); + await BrowserActions.click(this.addCommentButton); } async getCommentTextFromTextArea(): Promise { - return this.commentTextarea.getAttribute('value'); + return BrowserActions.getInputValue(this.commentTextarea); } } diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts index ba7279647..cc4187b38 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-content.ts @@ -25,7 +25,8 @@ import { by, browser, ElementFinder } from 'protractor'; import { Component } from '../component'; -import { isPresentAndEnabled, isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils'; +import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export class ContentMetadata extends Component { expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded'); @@ -47,7 +48,7 @@ export class ContentMetadata extends Component { } async waitForImagePropertiesPanelToExpand(): Promise { - await waitForVisibility(this.expandedImagePropertiesPanel); + await BrowserVisibility.waitUntilElementIsVisible(this.expandedImagePropertiesPanel); } async getVisiblePropertiesLabels(): Promise { @@ -95,7 +96,7 @@ export class ContentMetadata extends Component { const tagName = await elem.getTagName(); if (tagName === 'input' || tagName === 'textarea') { - return elem.getAttribute('value'); + return BrowserActions.getInputValue(elem); } return elem.getText(); diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-library.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-library.ts index 5661ef3e4..539ccff26 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-library.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer-metadata-library.ts @@ -24,7 +24,7 @@ */ import { by, browser } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserActions, Logger } from '@alfresco/adf-testing'; import { Component } from '../component'; import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils'; @@ -83,7 +83,7 @@ export class LibraryMetadata extends Component { } private async clickButton(button: string) { - await this.getButton(button).click(); + await BrowserActions.click(this.getButton(button)); } async waitForVisibilityDropDownToClose() { @@ -155,15 +155,15 @@ export class LibraryMetadata extends Component { async setVisibility(visibility: string) { const val = visibility.toLowerCase(); - await this.visibilityDropDown.click(); + await BrowserActions.click(this.visibilityDropDown); await waitForPresence(this.visibilityDropDown); if (val === 'public') { - await this.visibilityPublic.click(); + await BrowserActions.click(this.visibilityPublic); } else if (val === 'private') { - await this.visibilityPrivate.click(); + await BrowserActions.click(this.visibilityPrivate); } else if (val === 'moderated') { - await this.visibilityModerated.click(); + await BrowserActions.click(this.visibilityModerated); } else { Logger.error('----- invalid visibility', val); } diff --git a/projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts b/projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts index 139ce1265..6a6dd1dc9 100755 --- a/projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts +++ b/projects/aca-testing-shared/src/components/info-drawer/info-drawer.ts @@ -24,12 +24,12 @@ */ import { by, browser } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing'; import { Component } from '../component'; import { CommentsTab } from './info-drawer-comments-tab'; import { LibraryMetadata } from './info-drawer-metadata-library'; import { ContentMetadata } from './info-drawer-metadata-content'; -import { waitForVisibility, waitForInvisibility, waitForPresence } from '../../utilities/utils'; +import { waitForPresence } from '../../utilities/utils'; export class InfoDrawer extends Component { commentsTab = new CommentsTab('adf-info-drawer'); @@ -89,7 +89,7 @@ export class InfoDrawer extends Component { } async clickTab(title: string) { - await this.getTabByTitle(title).click(); + await BrowserActions.click(this.getTabByTitle(title)); } async getComponentIdOfTab(): Promise { @@ -118,9 +118,12 @@ export class InfoDrawer extends Component { async clickCommentsTab() { try { - await this.getTabByTitle('Comments').click(); + await BrowserActions.click(this.getTabByTitle('Comments')); await this.commentsTab.waitForCommentsContainer(); - await Promise.all([waitForVisibility(this.commentsTab.component), waitForInvisibility(this.propertiesTab.component)]); + await Promise.all([ + BrowserVisibility.waitUntilElementIsVisible(this.commentsTab.component), + BrowserVisibility.waitUntilElementIsNotVisible(this.propertiesTab.component) + ]); } catch (error) { Logger.error('--- info-drawer clickCommentsTab catch error: ', error); } diff --git a/projects/aca-testing-shared/src/components/menu/menu.ts b/projects/aca-testing-shared/src/components/menu/menu.ts index de159841b..bd9acfbdd 100755 --- a/projects/aca-testing-shared/src/components/menu/menu.ts +++ b/projects/aca-testing-shared/src/components/menu/menu.ts @@ -24,9 +24,9 @@ */ import { ElementFinder, by, browser } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { Logger, BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; import { Component } from '../component'; -import { Utils, isPresentAndEnabled, waitForPresence, waitForVisibility, waitForStaleness, waitForClickable } from '../../utilities/utils'; +import { Utils, isPresentAndEnabled, waitForPresence, waitForStaleness } from '../../utilities/utils'; export class Menu extends Component { items = this.allByCss('.mat-menu-item'); @@ -72,7 +72,7 @@ export class Menu extends Component { async waitForMenuToOpen(): Promise { await waitForPresence(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))); - await waitForVisibility(this.items.get(0)); + await BrowserVisibility.waitUntilElementIsVisible(this.items.get(0)); } async waitForMenuToClose(): Promise { @@ -126,7 +126,7 @@ export class Menu extends Component { async clickNthItem(nth: number): Promise { try { const elem = this.getNthItem(nth); - await waitForClickable(elem); + await BrowserVisibility.waitUntilElementIsClickable(elem); await browser.actions().mouseMove(elem).perform(); await browser.actions().click().perform(); await this.waitForMenuToClose(); @@ -138,8 +138,7 @@ export class Menu extends Component { async clickMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await waitForClickable(elem); - await elem.click(); + await BrowserActions.click(elem); } catch (e) { Logger.error('___click menu item catch___', e); } @@ -148,7 +147,7 @@ export class Menu extends Component { async mouseOverMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await waitForClickable(elem); + await BrowserVisibility.waitUntilElementIsClickable(elem); await browser.actions().mouseMove(elem).perform(); await browser.sleep(500); } catch (error) { @@ -159,7 +158,7 @@ export class Menu extends Component { async hasSubMenu(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await waitForClickable(elem); + await BrowserVisibility.waitUntilElementIsClickable(elem); const elemClass = await elem.getAttribute('class'); return elemClass.includes('mat-menu-item-submenu-trigger'); } catch (error) { @@ -171,8 +170,7 @@ export class Menu extends Component { async clickSubMenuItem(subMenuItem: string): Promise { try { const elem = this.getSubItemByLabel(subMenuItem); - await waitForClickable(elem); - await elem.click(); + await BrowserActions.click(elem); } catch (e) { Logger.error('___click submenu item catch___', e); } diff --git a/projects/aca-testing-shared/src/components/pagination/pagination.ts b/projects/aca-testing-shared/src/components/pagination/pagination.ts index fb98f2fea..a12f4f0a5 100755 --- a/projects/aca-testing-shared/src/components/pagination/pagination.ts +++ b/projects/aca-testing-shared/src/components/pagination/pagination.ts @@ -24,10 +24,9 @@ */ import { browser } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserActions, Logger } from '@alfresco/adf-testing'; import { Menu } from '../menu/menu'; import { Component } from '../component'; -import { waitForClickable } from '../../utilities/utils'; export class Pagination extends Component { range = this.byCss('.adf-pagination__range'); @@ -47,8 +46,7 @@ export class Pagination extends Component { async openMaxItemsMenu() { try { - await waitForClickable(this.maxItemsButton, 'timeout waiting for maxItemsButton to be clickable'); - await this.maxItemsButton.click(); + await BrowserActions.click(this.maxItemsButton); await this.menu.waitForMenuToOpen(); } catch (error) { Logger.error('____ open max items catch ___', error); @@ -57,8 +55,7 @@ export class Pagination extends Component { async openCurrentPageMenu() { try { - await waitForClickable(this.pagesButton, 'timeout waiting for pagesButton to be clickable'); - await this.pagesButton.click(); + await BrowserActions.click(this.pagesButton); await this.menu.waitForMenuToOpen(); } catch (error) { Logger.error('____ open current page menu ___', error); @@ -86,11 +83,11 @@ export class Pagination extends Component { } async clickNext() { - await this.nextButton.click(); + await BrowserActions.click(this.nextButton); } async clickPrevious() { - await this.previousButton.click(); + await BrowserActions.click(this.previousButton); } async isNextEnabled() { diff --git a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts index 684d5215b..7733a6ece 100755 --- a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts @@ -25,7 +25,8 @@ import { ElementFinder, by, protractor } from 'protractor'; import { GenericFilterPanel } from './generic-filter-panel'; -import { Utils, isPresentAndDisplayed } from '../../../utilities/utils'; +import { isPresentAndDisplayed } from '../../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class CreatedDateFilter extends GenericFilterPanel { constructor() { @@ -67,22 +68,18 @@ export class CreatedDateFilter extends GenericFilterPanel { async clickClearButton(): Promise { if (await this.isClearButtonEnabled()) { - await this.clearButton.click(); + await BrowserActions.click(this.clearButton); } } async clickApplyButton(): Promise { if (await this.isApplyButtonEnabled()) { - await this.applyButton.click(); + await BrowserActions.click(this.applyButton); } } async getFromValue(): Promise { - try { - return await this.fromInput.getAttribute('value'); - } catch (error) { - return ''; - } + return BrowserActions.getInputValue(this.fromInput); } async getFromError(): Promise { @@ -94,11 +91,7 @@ export class CreatedDateFilter extends GenericFilterPanel { } async getToValue(): Promise { - try { - return await this.toInput.getAttribute('value'); - } catch (err) { - return ''; - } + return BrowserActions.getInputValue(this.fromInput); } async getToError(): Promise { @@ -121,13 +114,13 @@ export class CreatedDateFilter extends GenericFilterPanel { async enterFromDate(date: string): Promise { await this.expandPanel(); - await Utils.clearFieldWithBackspace(this.fromInput); + await BrowserActions.clearWithBackSpace(this.fromInput); await this.fromInput.sendKeys(date, protractor.Key.TAB); } async enterToDate(date: string): Promise { await this.expandPanel(); - await Utils.clearFieldWithBackspace(this.toInput); + await BrowserActions.clearWithBackSpace(this.toInput); await this.toInput.sendKeys(date, protractor.Key.TAB); } } diff --git a/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts b/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts index 9bf2f7322..f605d2786 100755 --- a/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts @@ -25,13 +25,14 @@ import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor'; import { GenericFilterPanel } from './generic-filter-panel'; +import { BrowserActions } from '@alfresco/adf-testing'; export class FacetFilter extends GenericFilterPanel { private readonly locators = { checkbox: '.mat-checkbox', checkboxChecked: '.mat-checkbox.mat-checkbox-checked', button: '.adf-facet-buttons button', - categoryInput: 'input[placeholder="Filter category"', + categoryInput: 'input[data-placeholder="Filter category"', facetsFilter: '.adf-facet-result-filter' }; @@ -67,7 +68,7 @@ export class FacetFilter extends GenericFilterPanel { if ((await this.selectedFacets.count()) > 0) { await this.expandPanel(); await this.selectedFacets.each(async (elem) => { - await elem.click(); + await BrowserActions.click(elem); }); } await this.expandPanel(); @@ -83,7 +84,7 @@ export class FacetFilter extends GenericFilterPanel { async clickClearButton(): Promise { if (await this.isClearButtonEnabled()) { - await this.clearButton.click(); + await BrowserActions.click(this.clearButton); } } diff --git a/projects/aca-testing-shared/src/components/search/filters/generic-filter-panel.ts b/projects/aca-testing-shared/src/components/search/filters/generic-filter-panel.ts index 798d70a82..81eabee76 100755 --- a/projects/aca-testing-shared/src/components/search/filters/generic-filter-panel.ts +++ b/projects/aca-testing-shared/src/components/search/filters/generic-filter-panel.ts @@ -25,6 +25,7 @@ import { ElementFinder, by, browser } from 'protractor'; import { isPresentAndDisplayed } from '../../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class GenericFilterPanel { private filterName: string; @@ -52,7 +53,7 @@ export class GenericFilterPanel { } async clickPanelHeader(): Promise { - await this.panelHeader.click(); + await BrowserActions.click(this.panelHeader); } async isPanelDisplayed(): Promise { diff --git a/projects/aca-testing-shared/src/components/search/filters/size-filter.ts b/projects/aca-testing-shared/src/components/search/filters/size-filter.ts index 139e38851..f41d6f705 100755 --- a/projects/aca-testing-shared/src/components/search/filters/size-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/size-filter.ts @@ -25,6 +25,7 @@ import { ElementFinder, by, ElementArrayFinder } from 'protractor'; import { GenericFilterPanel } from './generic-filter-panel'; +import { BrowserActions } from '@alfresco/adf-testing'; export class SizeFilter extends GenericFilterPanel { constructor() { @@ -51,7 +52,7 @@ export class SizeFilter extends GenericFilterPanel { if ((await this.selectedFacets.count()) > 0) { await this.expandPanel(); await this.selectedFacets.each(async (elem) => { - await elem.click(); + await BrowserActions.click(elem); }); } await this.collapsePanel(); @@ -63,27 +64,27 @@ export class SizeFilter extends GenericFilterPanel { async clickClearButton(): Promise { if (await this.isClearButtonEnabled()) { - await this.clearButton.click(); + await BrowserActions.click(this.clearButton); } } async checkSizeSmall(): Promise { const small = this.facets.filter(async (elem) => (await elem.getText()) === 'Small').first(); - await small.click(); + await BrowserActions.click(small); } async checkSizeMedium(): Promise { const medium = this.facets.filter(async (elem) => (await elem.getText()) === 'Medium').first(); - await medium.click(); + await BrowserActions.click(medium); } async checkSizeLarge(): Promise { const large = this.facets.filter(async (elem) => (await elem.getText()) === 'Large').first(); - await large.click(); + await BrowserActions.click(large); } async checkSizeHuge(): Promise { const huge = this.facets.filter(async (elem) => (await elem.getText()) === 'Huge').first(); - await huge.click(); + await BrowserActions.click(huge); } } diff --git a/projects/aca-testing-shared/src/components/search/search-input.ts b/projects/aca-testing-shared/src/components/search/search-input.ts index 7ce179ad7..2a189aa4e 100755 --- a/projects/aca-testing-shared/src/components/search/search-input.ts +++ b/projects/aca-testing-shared/src/components/search/search-input.ts @@ -25,7 +25,8 @@ import { browser, by, protractor } from 'protractor'; import { Component } from '../component'; -import { Utils, waitForPresence, waitForClickable, waitElement } from '../../utilities/utils'; +import { waitForPresence, waitElement } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export class SearchInput extends Component { searchButton = this.component.element(by.css('.app-search-button')); @@ -47,7 +48,7 @@ export class SearchInput extends Component { } async waitForSearchInputToBeInteractive() { - await waitForClickable(this.searchControl); + await BrowserVisibility.waitUntilElementIsClickable(this.searchControl); } async isSearchContainerDisplayed() { @@ -58,8 +59,7 @@ export class SearchInput extends Component { } async clickSearchButton() { - await waitForClickable(this.searchButton); - await this.searchButton.click(); + await BrowserActions.click(this.searchButton); await this.waitForSearchControl(); } @@ -69,18 +69,15 @@ export class SearchInput extends Component { } async clickFilesOption() { - await waitForClickable(this.searchFilesOption); - await this.searchFilesOption.click(); + await BrowserActions.click(this.searchFilesOption); } async clickFoldersOption() { - await waitForClickable(this.searchFoldersOption); - await this.searchFoldersOption.click(); + await BrowserActions.click(this.searchFoldersOption); } async clickLibrariesOption() { - await waitForClickable(this.searchLibrariesOption); - await this.searchLibrariesOption.click(); + await BrowserActions.click(this.searchLibrariesOption); } async isFilesOptionEnabled() { @@ -131,7 +128,7 @@ export class SearchInput extends Component { async clickClearSearchButton() { if (await this.isClearSearchButtonPresent()) { - await this.clearSearchButton.click(); + await BrowserActions.click(this.clearSearchButton); } } @@ -158,7 +155,7 @@ export class SearchInput extends Component { async searchFor(text: string) { await this.waitForSearchInputToBeInteractive(); - await Utils.clearFieldWithBackspace(this.searchInput); + await BrowserActions.clearWithBackSpace(this.searchInput); await this.searchInput.sendKeys(text); await this.searchInput.sendKeys(protractor.Key.ENTER); } diff --git a/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts b/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts index eb4105b40..cfda75751 100755 --- a/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts +++ b/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts @@ -25,7 +25,8 @@ import { by, browser } from 'protractor'; import { Component } from '../component'; -import { isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils'; +import { isPresentAndDisplayed } from '../../utilities/utils'; +import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing'; export type SortByType = 'Relevance' | 'Title' | 'Filename' | 'Modified date' | 'Modifier' | 'Created date' | 'Size' | 'Type'; export type SortOrderType = 'ASC' | 'DESC' | ''; @@ -41,7 +42,11 @@ export class SearchSortingPicker extends Component { } async waitForSortByDropdownToExpand(): Promise { - await waitForVisibility(this.sortByDropdownExpanded, 'Timeout waiting for sortBy dropdown to expand'); + await BrowserVisibility.waitUntilElementIsVisible( + this.sortByDropdownExpanded, + BrowserVisibility.DEFAULT_TIMEOUT, + 'Timeout waiting for sortBy dropdown to expand' + ); } async isSortOrderButtonDisplayed(): Promise { @@ -73,7 +78,7 @@ export class SearchSortingPicker extends Component { } async clickSortByDropdown(): Promise { - await this.sortByDropdownCollapsed.click(); + await BrowserActions.click(this.sortByDropdownCollapsed); await this.waitForSortByDropdownToExpand(); } @@ -88,18 +93,18 @@ export class SearchSortingPicker extends Component { await this.clickSortByDropdown(); } const elem = browser.element(by.cssContainingText('.mat-option .mat-option-text', option)); - await elem.click(); + await BrowserActions.click(elem); } async setSortOrderASC(): Promise { if ((await this.getSortOrder()) !== 'ASC') { - await this.sortOrderButton.click(); + await BrowserActions.click(this.sortOrderButton); } } async setSortOrderDESC(): Promise { if ((await this.getSortOrder()) !== 'DESC') { - await this.sortOrderButton.click(); + await BrowserActions.click(this.sortOrderButton); } } } diff --git a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts index ad0656b5c..59a696a51 100755 --- a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts +++ b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts @@ -28,7 +28,6 @@ import { Logger, BrowserActions } from '@alfresco/adf-testing'; import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Menu } from '../menu/menu'; import { Component } from '../component'; -import { waitForClickable } from '../../utilities/utils'; export class Sidenav extends Component { links = this.component.all(by.css('.item')); @@ -55,8 +54,7 @@ export class Sidenav extends Component { return Promise.resolve(); } else { const link = this.getLink(name); - await waitForClickable(link); - await link.click(); + await BrowserActions.click(link); await element(by.css('.mat-expansion-panel-body')).isPresent(); } } catch (e) { @@ -65,7 +63,7 @@ export class Sidenav extends Component { } async openNewMenu(): Promise { - await this.newButton.click(); + await BrowserActions.click(this.newButton.first()); await this.menu.waitForMenuToOpen(); } @@ -76,22 +74,22 @@ export class Sidenav extends Component { async openCreateFolderDialog(): Promise { await this.openNewMenu(); - await this.menu.createFolderAction.click(); + await BrowserActions.click(this.menu.createFolderAction); } async openCreateLibraryDialog(): Promise { await this.openNewMenu(); - await this.menu.createLibraryAction.click(); + await BrowserActions.click(this.menu.createLibraryAction); } async openCreateFileFromTemplateDialog(): Promise { await this.openNewMenu(); - await this.menu.createFileFromTemplateAction.click(); + await BrowserActions.click(this.menu.createFileFromTemplateAction); } async openCreateFolderFromTemplateDialog(): Promise { await this.openNewMenu(); - await this.menu.createFolderFromTemplateAction.click(); + await BrowserActions.click(this.menu.createFolderFromTemplateAction); } async isActive(name: string): Promise { @@ -144,8 +142,7 @@ export class Sidenav extends Component { async clickLink(name: string): Promise { try { const link = this.getLinkLabel(name); - await waitForClickable(link); - await link.click(); + await BrowserActions.click(link); } catch (error) { Logger.error('---- sidebar navigation clickLink catch error: ', error); } diff --git a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts index 8604c66ae..39d216124 100755 --- a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts +++ b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts @@ -102,7 +102,7 @@ export class Toolbar extends Component { } async clickButton(title: string): Promise { - await this.getButtonByTitleAttribute(title).click(); + await BrowserActions.click(this.getButtonByTitleAttribute(title)); } async isPrintPresent() { diff --git a/projects/aca-testing-shared/src/pages/login-page.ts b/projects/aca-testing-shared/src/pages/login-page.ts index 6fe205e57..0cf16a682 100755 --- a/projects/aca-testing-shared/src/pages/login-page.ts +++ b/projects/aca-testing-shared/src/pages/login-page.ts @@ -28,6 +28,7 @@ import { Page } from './page'; import { APP_ROUTES } from '../configs'; import { waitForPresence } from '../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; export class LoginPage extends Page { login = new LoginComponent(this.appRoot); @@ -45,7 +46,7 @@ export class LoginPage extends Page { const pass = password || username; await this.load(); await this.login.enterCredentials(username, pass); - await this.login.submitButton.click(); + await BrowserActions.click(this.login.submitButton); return super.waitForApp(); } @@ -58,7 +59,7 @@ export class LoginPage extends Page { const pass = password || username; await this.load(); await this.login.enterCredentials(username, pass); - await this.login.submitButton.click(); + await BrowserActions.click(this.login.submitButton); await waitForPresence(this.login.errorMessage); } } diff --git a/projects/aca-testing-shared/src/pages/page.ts b/projects/aca-testing-shared/src/pages/page.ts index 5f9a6dff4..864d9776f 100755 --- a/projects/aca-testing-shared/src/pages/page.ts +++ b/projects/aca-testing-shared/src/pages/page.ts @@ -24,9 +24,9 @@ */ import { browser, by, ElementFinder } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing'; import { USE_HASH_STRATEGY } from './../configs'; -import { Utils, waitElement, waitForPresence, waitForVisibility, isPresentAndDisplayed } from '../utilities/utils'; +import { Utils, waitElement, waitForPresence, isPresentAndDisplayed } from '../utilities/utils'; export abstract class Page { appRoot = 'app-root'; @@ -61,7 +61,7 @@ export abstract class Page { } async waitForDialog() { - await waitForVisibility(this.dialogContainer); + await BrowserVisibility.waitUntilElementIsVisible(this.dialogContainer); } async isDialogOpen() { @@ -80,7 +80,7 @@ export abstract class Page { async closeUploadDialog(): Promise { if (await this.isUploadDialogOpen()) { - await this.closeUploadButton.click(); + await BrowserActions.click(this.closeUploadButton); } } @@ -96,8 +96,7 @@ export abstract class Page { async clickSnackBarAction(): Promise { try { - const action = await waitElement('.mat-simple-snackbar-action button'); - await action.click(); + await BrowserActions.click(this.byCss('.mat-simple-snackbar-action button')); } catch (e) { Logger.error(e, '.......failed on click snack bar action.........'); } diff --git a/projects/aca-testing-shared/src/pages/search-results-page.ts b/projects/aca-testing-shared/src/pages/search-results-page.ts index 5b7c0a7c1..86092cd24 100755 --- a/projects/aca-testing-shared/src/pages/search-results-page.ts +++ b/projects/aca-testing-shared/src/pages/search-results-page.ts @@ -27,6 +27,7 @@ import { browser, by, By } from 'protractor'; import { BrowsingPage } from './browsing-page'; import { SearchSortingPicker } from '../components/search/search-sorting-picker'; import { SearchFilters } from '../components/search/search-filters'; +import { BrowserActions } from '@alfresco/adf-testing'; export class SearchResultsPage extends BrowsingPage { root = this.byCss('aca-search-results'); @@ -54,6 +55,6 @@ export class SearchResultsPage extends BrowsingPage { async removeChip(chipName: string): Promise { const chip = browser.element(By.cssContainingText('.mat-chip', chipName)); const closeChip = chip.element(by.css('.mat-chip-remove')); - await closeChip.click(); + await BrowserActions.click(closeChip); } } diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts index d6b07b7cb..93467564b 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts @@ -77,15 +77,19 @@ export class FavoritesApi extends RepoApi { } } - async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) { + async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise { + const favorites: FavoriteEntry[] = []; try { - return await ids.reduce(async (previous, current) => { - await previous; - await this.addFavoriteById(nodeType, current); - }, Promise.resolve()); + if (ids && ids.length > 0) { + for (const id of ids) { + const favorite = await this.addFavoriteById(nodeType, id); + favorites.push(favorite); + } + } } catch (error) { this.handleError(`FavoritesApi addFavoritesByIds : catch : `, error); } + return favorites; } async getFavorites() { 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 8ba655f07..5ab8ba1fa 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 @@ -49,15 +49,19 @@ export class SharedLinksApi extends RepoApi { } } - async shareFilesByIds(ids: string[]) { + async shareFilesByIds(ids: string[]): Promise { + const sharedLinks: SharedLinkEntry[] = []; try { - return await ids.reduce(async (previous: any, current: any) => { - await previous; - return this.shareFileById(current); - }, Promise.resolve()); + if (ids && ids.length > 0) { + for (const id of ids) { + const sharedLink = await this.shareFileById(id); + sharedLinks.push(sharedLink); + } + } } catch (error) { this.handleError(`SharedLinksApi shareFilesByIds : catch : `, error); } + return sharedLinks; } async getSharedIdOfNode(name: string): Promise { 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 30b785a2b..88ec5849b 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 @@ -139,15 +139,19 @@ export class SitesApi extends RepoApi { return this.createSite(title, SITE_VISIBILITY.MODERATED, description, siteId); } - async createSites(titles: string[], visibility?: string): Promise { + async createSites(siteNames: string[], visibility?: string): Promise { + const sites: SiteEntry[] = []; try { - return titles.reduce(async (previous: any, current: any) => { - await previous; - return this.createSite(current, visibility); - }, Promise.resolve()); + if (siteNames && siteNames.length > 0) { + for (const siteName of siteNames) { + const site = await this.createSite(siteName, visibility); + sites.push(site); + } + } } catch (error) { this.handleError(`SitesApi createSites : catch : `, error); } + return sites; } async createSitesPrivate(siteNames: string[]): Promise { diff --git a/projects/aca-testing-shared/src/utilities/utils.ts b/projects/aca-testing-shared/src/utilities/utils.ts index dc87f3ba6..fd95ea9b5 100644 --- a/projects/aca-testing-shared/src/utilities/utils.ts +++ b/projects/aca-testing-shared/src/utilities/utils.ts @@ -24,7 +24,7 @@ */ import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging, until, WebElement } from 'protractor'; -import { Logger } from '@alfresco/adf-testing'; +import { BrowserVisibility, Logger } from '@alfresco/adf-testing'; import { BROWSER_WAIT_TIMEOUT } from '../configs'; import * as path from 'path'; import * as fs from 'fs'; @@ -45,26 +45,6 @@ export async function waitElement(css: string, errorMessage?: string): Promise { - await browser.wait( - EC.elementToBeClickable(element), - BROWSER_WAIT_TIMEOUT, - errorMessage || `Timeout waiting for element to be clickable: ${element.locator()}` - ); -} - -export async function waitForVisibility(element: ElementFinder, errorMessage?: string): Promise { - await browser.wait(EC.visibilityOf(element), BROWSER_WAIT_TIMEOUT, errorMessage || `Timeout waiting for element visibility: ${element.locator()}`); -} - -export async function waitForInvisibility(element: ElementFinder, errorMessage?: string): Promise { - await browser.wait( - EC.invisibilityOf(element), - BROWSER_WAIT_TIMEOUT, - errorMessage || `Timeout waiting for element visibility: ${element.locator()}` - ); -} - export async function waitForPresence(element: ElementFinder, errorMessage?: string): Promise { await browser.wait(EC.presenceOf(element), BROWSER_WAIT_TIMEOUT, errorMessage || `Timeout waiting for element presence: ${element.locator()}`); } @@ -74,23 +54,21 @@ export async function waitForStaleness(element: ElementFinder, errorMessage?: st } export const isPresentAndEnabled = async (element: ElementFinder): Promise => { - const isPresent = await element.isPresent(); - - if (isPresent) { + try { + await BrowserVisibility.waitUntilElementIsPresent(element); return element.isEnabled(); + } catch (error) { + return false; } - - return false; }; export const isPresentAndDisplayed = async (element: ElementFinder): Promise => { - const isPresent = await element.isPresent(); - - if (isPresent) { - return element.isDisplayed(); + try { + await BrowserVisibility.waitUntilElementIsVisible(element); + return true; + } catch (error) { + return false; } - - return false; }; export class Utils { @@ -129,13 +107,6 @@ export class Utils { return run(retry); } - static async clearFieldWithBackspace(elem: ElementFinder): Promise { - const text = await elem.getAttribute('value'); - for (let i = 0; i < text.length; i++) { - await elem.sendKeys(protractor.Key.BACK_SPACE); - } - } - static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = ''): Promise { const config = await browser.getProcessedConfig(); const filePath = path.join(config.params.downloadFolder, folderName, subFolderName, fileName); diff --git a/projects/aca-testing-shared/tslint.json b/projects/aca-testing-shared/tslint.json index 124133f84..205aedaa5 100644 --- a/projects/aca-testing-shared/tslint.json +++ b/projects/aca-testing-shared/tslint.json @@ -1,17 +1,7 @@ { "extends": "../../tslint.json", "rules": { - "directive-selector": [ - true, - "attribute", - "lib", - "camelCase" - ], - "component-selector": [ - true, - "element", - "lib", - "kebab-case" - ] + "directive-selector": [true, "attribute", "lib", "camelCase"], + "component-selector": [true, "element", "lib", "kebab-case"] } } diff --git a/protractor.conf.js b/protractor.conf.js index 18ab46aee..214eed73d 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -17,7 +17,7 @@ const downloadFolder = path.join(__dirname, 'e2e-downloads'); const screenshotsFolder = path.resolve(__dirname, 'e2e-output'); const e2eFolder = path.resolve(projectRoot, 'e2e'); const E2E_HOST = process.env.E2E_HOST || 'http://localhost:4200'; -const BROWSER_RUN = process.env.BROWSER_RUN; +const BROWSER_RUN = !!process.env.BROWSER_RUN; const width = 1366; const height = 768; @@ -26,21 +26,6 @@ const API_CONTENT_HOST = process.env.API_CONTENT_HOST || 'http://localhost:8080' const MAXINSTANCES = process.env.MAXINSTANCES || 1; const MAX_RETRIES = process.env.MAX_RETRIES || 1; -function rmDir(dirPath) { - try { - const files = fs.readdirSync(dirPath); - } catch (e) { - return; - } - if (files.length > 0) - for (let i = 0; i < files.length; i++) { - const filePath = dirPath + '/' + files[i]; - if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath); - else rmDir(filePath); - } - fs.rmdirSync(dirPath); -} - const appConfig = { hostEcm: API_CONTENT_HOST, providers: 'ECM', @@ -139,12 +124,12 @@ exports.config = { } }, args: [ - '--incognito', `--window-size=${width},${height}`, '--disable-gpu', '--no-sandbox', '--disable-web-security', '--disable-browser-side-navigation', + '--allow-running-insecure-content', ...(BROWSER_RUN === true ? [] : ['--headless']) ] } @@ -217,14 +202,12 @@ exports.config = { jasmine.getEnv().addReporter( new SpecReporter({ spec: { - displayStacktrace: 'pretty', + displayStacktrace: 'raw', displayDuration: true } }) ); - rmDir(downloadFolder); - browser.driver.sendChromiumCommand('Page.setDownloadBehavior', { behavior: 'allow', downloadPath: downloadFolder diff --git a/scripts/ci/job_hooks/before_e2e.sh b/scripts/ci/job_hooks/before_e2e.sh index eae4ffac4..218824633 100755 --- a/scripts/ci/job_hooks/before_e2e.sh +++ b/scripts/ci/job_hooks/before_e2e.sh @@ -4,6 +4,11 @@ FROM=$1; TO=$2; PARAMS=$3; +echo "====== Check content UP =====" + +./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$API_CONTENT_HOST" -u "$ADMIN_EMAIL" -p "$ADMIN_PASSWORD" || exit 1 + +echo "====== Download artifacts =====" # Download built application artifact from S3 ./scripts/ci/utils/artifact-from-s3.sh -a "$FROM" -o "$TO" node "./scripts/app-config-replace.js" --config="$TO/app.config.json" $PARAMS