From 13fa06565496aac3eda3fa2ff3281bd5b703ee5e Mon Sep 17 00:00:00 2001 From: Adina Parpalita Date: Tue, 15 Dec 2020 12:10:01 +0200 Subject: [PATCH] exclude one test and do some fixes (#1869) * exclude one test and do some fixes * try to get more logs * some more fixes * try to workaround the slow update of toggle menus * more logging * no message * trigger another run * Update delete-undo-delete.test.ts * no message * rename methods * no message * no message * no message * no message * no message * no message * update travis.yml * run travis on branch * trigger travis * cleanup * no message --- .travis.yml | 57 +-- e2e/e2e-config/utils/upload-output.js | 4 +- e2e/protractor.excludes.json | 3 +- e2e/suites/actions-available/test-util.ts | 2 + e2e/suites/actions/copy-move/copy.test.ts | 14 +- .../destination-picker-dialog.test.ts | 4 +- e2e/suites/actions/copy-move/move.test.ts | 2 + .../create/create-file-from-template.test.ts | 10 +- .../create-folder-from-template.test.ts | 8 +- .../actions/create/create-folder.test.ts | 2 +- .../actions/create/create-library.test.ts | 2 +- .../actions/delete/delete-undo-delete.test.ts | 168 ++++---- .../actions/delete/permanently-delete.test.ts | 2 +- e2e/suites/actions/edit/edit-folder.test.ts | 2 +- e2e/suites/actions/edit/edit-offline.test.ts | 40 +- .../actions/library/library-actions.test.ts | 2 +- e2e/suites/actions/share/share-file.test.ts | 362 ++++++++++++------ .../share/unshare-file-search-results.test.ts | 32 +- e2e/suites/actions/share/unshare-file.test.ts | 140 ++++--- .../upload-new-version.test.ts | 10 +- .../upload-download/version-actions.test.ts | 48 ++- .../multiple-pages-libraries.test.ts | 8 +- e2e/suites/viewer/viewer-actions.test.ts | 6 +- .../src/components/data-table/data-table.ts | 2 + .../dialog/create-from-template-dialog.ts | 8 +- .../src/components/dialog/generic-dialog.ts | 2 +- .../src/components/dialog/share-dialog.ts | 2 +- .../src/components/toolbar/toolbar.ts | 1 + .../src/components/viewer/viewer.ts | 17 +- protractor.conf.js | 8 +- scripts/ci/job_hooks/before_e2e.sh | 2 +- 31 files changed, 581 insertions(+), 389 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97c61aeb0..e5c632b7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -98,6 +98,22 @@ jobs: after_script: - ./scripts/ci/job_hooks/after_e2e.sh + - stage: e2e + 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" || 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 + + - stage: e2e + name: 'Test Suites: shareActions' + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 + script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=shareActions" + after_script: + - ./scripts/ci/job_hooks/after_e2e.sh + - stage: e2e name: 'Test Suites: pagination' before_script: @@ -106,83 +122,78 @@ jobs: after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: actionsAvailableFilesFolders' + - stage: e2e + name: 'Test Suites: actionsAvailableFilesFolders' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableFilesFolders" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: actionsAvailableLibraries,actionsAvailableNewMenu' + - stage: e2e + name: 'Test Suites: actionsAvailableLibraries,actionsAvailableNewMenu' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableLibraries,actionsAvailableNewMenu" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: actionsAvailableSpecialPermissions' + - stage: e2e + name: 'Test Suites: actionsAvailableSpecialPermissions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailableSpecialPermissions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: copyMoveActions' + - stage: e2e + name: 'Test Suites: copyMoveActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=copyMoveActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: createActions' + - stage: e2e + name: 'Test Suites: createActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=createActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: deleteActions' + - stage: e2e + name: 'Test Suites: deleteActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=deleteActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: editActions,favoriteActions' + - stage: e2e + name: 'Test Suites: editActions,favoriteActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=editActions,favoriteActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: libraryActions' + - stage: e2e + name: 'Test Suites: libraryActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=libraryActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - name: 'Test Suites: shareActions' - before_script: - - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 - script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=shareActions" - after_script: - - ./scripts/ci/job_hooks/after_e2e.sh - - - name: 'Test Suites: uploadDownloadActions' + - stage: e2e + name: 'Test Suites: uploadDownloadActions' before_script: - ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a" || travis_terminate 1 script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=uploadDownloadActions" after_script: - ./scripts/ci/job_hooks/after_e2e.sh - - 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" || 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 - - stage: Publish Docker Registry name: Publish Docker Registry script: ./scripts/travis/deploy/publish.sh "app" diff --git a/e2e/e2e-config/utils/upload-output.js b/e2e/e2e-config/utils/upload-output.js index bcebb2322..6bd0236c0 100644 --- a/e2e/e2e-config/utils/upload-output.js +++ b/e2e/e2e-config/utils/upload-output.js @@ -12,7 +12,7 @@ function buildNumber() { } async function uploadScreenshot(retryCount) { - console.log(`Start uploading report ${retryCount}`); + console.log(`Start uploading report ${retryCount} on ${process.env.SCREENSHOT_URL}`); let alfrescoJsApi = new AlfrescoApi({ provider: 'ECM', @@ -101,7 +101,7 @@ async function uploadScreenshot(retryCount) { } ); } catch (error) { - console.log(`--- Upload output failed. ${error}`); + throw new Error(`--- Upload output failed. ${error}`); } fs.rmdirSync(path.resolve(__dirname, `../../e2e-output-${retryCount}/`), { recursive: true }); diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index c2de4df29..3bdeeda9f 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -1,5 +1,6 @@ { "C306956": "https://alfresco.atlassian.net/browse/ACA-4196", "C286314": "https://alfresco.atlassian.net/browse/ACA-2176", - "C213107": "https://alfresco.atlassian.net/browse/ACA-4197" + "C213107": "https://alfresco.atlassian.net/browse/ACA-4197", + "C325049": "https://alfresco.atlassian.net/browse/ACA-4219" } diff --git a/e2e/suites/actions-available/test-util.ts b/e2e/suites/actions-available/test-util.ts index f499df3ad..bfb10ddd8 100644 --- a/e2e/suites/actions-available/test-util.ts +++ b/e2e/suites/actions-available/test-util.ts @@ -35,6 +35,7 @@ const menu = new Menu(); export async function checkContextMenu(item: string, expectedContextMenu: string[]): Promise { await dataTable.rightClickOnItem(item); + await contextMenu.waitForMenuToOpen(); const actualActions = await contextMenu.getMenuItems(); expect(actualActions).toEqual(expectedContextMenu); @@ -77,6 +78,7 @@ export async function checkToolbarActions(item: string, expectedToolbarPrimary: export async function checkMultipleSelContextMenu(items: string[], expectedContextMenu: string[]): Promise { await dataTable.selectMultipleItems(items); await dataTable.rightClickOnMultipleSelection(); + await contextMenu.waitForMenuToOpen(); const actualActions = await contextMenu.getMenuItems(); expect(actualActions).toEqual(expectedContextMenu); diff --git a/e2e/suites/actions/copy-move/copy.test.ts b/e2e/suites/actions/copy-move/copy.test.ts index 04a15c9ee..d2d71131b 100755 --- a/e2e/suites/actions/copy-move/copy.test.ts +++ b/e2e/suites/actions/copy-move/copy.test.ts @@ -23,7 +23,16 @@ * along with Alfresco. If not, see . */ -import { AdminActions, UserActions, LoginPage, BrowsingPage, ContentNodeSelectorDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared'; +import { + AdminActions, + UserActions, + LoginPage, + BrowsingPage, + ContentNodeSelectorDialog, + RepoClient, + Utils, + SearchResultsPage +} from '@alfresco/aca-testing-shared'; import { BrowserActions, Logger } from '@alfresco/adf-testing'; describe('Copy content', () => { @@ -110,6 +119,7 @@ describe('Copy content', () => { const page = new BrowsingPage(); const { dataTable, toolbar } = page; const copyDialog = new ContentNodeSelectorDialog(); + const searchResultsPage = new SearchResultsPage(); const { searchInput } = page.header; const adminApiActions = new AdminActions(); @@ -416,7 +426,7 @@ describe('Copy content', () => { copyItemsIntoLibrary([file1, file2], source, folderSiteSearch, async () => { await searchInput.checkOnlyFiles(); await searchInput.searchFor(random); - await dataTable.waitForBody(); + await searchResultsPage.waitForResults(); })); it('[C306935] Copy locked file', async () => diff --git a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts index 401872ded..190e66647 100755 --- a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts +++ b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts @@ -137,7 +137,7 @@ describe('Destination picker dialog : ', () => { }); it('[C263875] Dialog UI', async () => { - expect(await dialog.getTitle()).toEqual(`Copy '${file}' to...`); + expect(await dialog.getDialogTitle()).toEqual(`Copy '${file}' to...`); expect(await dialog.searchInput.isPresent()).toBe(true, 'Search input is not displayed'); expect(await dialog.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed'); expect(await breadcrumb.currentFolder.getText()).toEqual('Personal Files'); @@ -196,7 +196,7 @@ describe('Destination picker dialog : ', () => { }); it('[C263879] Dialog title - multiple selection', async () => { - expect(await dialog.getTitle()).toEqual(`Copy 2 items to...`); + expect(await dialog.getDialogTitle()).toEqual(`Copy 2 items to...`); }); }); diff --git a/e2e/suites/actions/copy-move/move.test.ts b/e2e/suites/actions/copy-move/move.test.ts index 9d7572542..03f61b302 100755 --- a/e2e/suites/actions/copy-move/move.test.ts +++ b/e2e/suites/actions/copy-move/move.test.ts @@ -257,7 +257,9 @@ describe('Move content', () => { await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destinationPF); expect(await dataTable.isItemPresent(existingFolder)).toBe(true, `${existingFolder} not present in destination folder`); + await dataTable.doubleClickOnRowByName(existingFolder); + await dataTable.waitForBody(); expect(await dataTable.isItemPresent(file2InFolder)).toBe(true, `${file2InFolder} not present in destination folder`); expect(await dataTable.isItemPresent(file3InFolder)).toBe(true, `${file3InFolder} not present in destination folder`); }); diff --git a/e2e/suites/actions/create/create-file-from-template.test.ts b/e2e/suites/actions/create/create-file-from-template.test.ts index f3f979d3f..1788f9986 100755 --- a/e2e/suites/actions/create/create-file-from-template.test.ts +++ b/e2e/suites/actions/create/create-file-from-template.test.ts @@ -145,7 +145,7 @@ describe('Create file from template', () => { await sidenav.openCreateFileFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); - expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); + expect(await selectTemplateDialog.getDialogTitle()).toEqual('Select a document template'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'Datatable is not empty'); expect(await selectTemplateDialog.dataTable.getEmptyListText()).toEqual('No results found'); expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Node Templates'); @@ -167,7 +167,7 @@ describe('Create file from template', () => { }); it('[C325043] Select template - dialog UI - with existing templates', async () => { - expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); + expect(await selectTemplateDialog.getDialogTitle()).toEqual('Select a document template'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(false, 'Datatable is empty'); expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder1)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed'); @@ -249,7 +249,7 @@ describe('Create file from template', () => { }); it('[C325020] Create file from template - dialog UI', async () => { - expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new document from '${template1InRootFolder}'`); + expect(await createFromTemplateDialog.getDialogTitle()).toEqual(`Create new document from '${template1InRootFolder}'`); expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed'); expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed'); expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed'); @@ -258,7 +258,7 @@ describe('Create file from template', () => { }); it('[C325031] File name is required', async () => { - expect(await createFromTemplateDialog.getName()).toEqual(template1InRootFolder); + expect(await createFromTemplateDialog.getNameInputValue()).toEqual(template1InRootFolder); await clearTextWithBackspace(createFromTemplateDialog.nameInput); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); @@ -330,6 +330,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(file2.name); await createFromTemplateDialog.enterTitle(file2.title); await createFromTemplateDialog.enterDescription(file2.description); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -384,6 +385,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(fileSite.name); await createFromTemplateDialog.enterTitle(fileSite.title); await createFromTemplateDialog.enterDescription(fileSite.description); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); diff --git a/e2e/suites/actions/create/create-folder-from-template.test.ts b/e2e/suites/actions/create/create-folder-from-template.test.ts index 0065f57cf..353e4fc5f 100755 --- a/e2e/suites/actions/create/create-folder-from-template.test.ts +++ b/e2e/suites/actions/create/create-folder-from-template.test.ts @@ -155,7 +155,7 @@ describe('Create folder from template', () => { }); it('[C325147] Select template - dialog UI - with existing templates', async () => { - expect(await selectTemplateDialog.getTitle()).toEqual('Select a folder template'); + expect(await selectTemplateDialog.getDialogTitle()).toEqual('Select a folder template'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(false, 'Datatable is empty'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed'); @@ -235,7 +235,7 @@ describe('Create folder from template', () => { }); it('[C325142] Create folder from template - dialog UI', async () => { - expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new folder from '${templateFolder1}'`); + expect(await createFromTemplateDialog.getDialogTitle()).toEqual(`Create new folder from '${templateFolder1}'`); expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed'); expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed'); expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed'); @@ -244,7 +244,7 @@ describe('Create folder from template', () => { }); it('[C325143] Folder name is required', async () => { - expect(await createFromTemplateDialog.getName()).toEqual(templateFolder1); + expect(await createFromTemplateDialog.getNameInputValue()).toEqual(templateFolder1); await clearTextWithBackspace(createFromTemplateDialog.nameInput); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); @@ -316,6 +316,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folder2.name); await createFromTemplateDialog.enterTitle(folder2.title); await createFromTemplateDialog.enterDescription(folder2.description); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -371,6 +372,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folderSite.name); await createFromTemplateDialog.enterTitle(folderSite.title); await createFromTemplateDialog.enterDescription(folderSite.description); + await BrowserActions.click(createFromTemplateDialog.createButton); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); diff --git a/e2e/suites/actions/create/create-folder.test.ts b/e2e/suites/actions/create/create-folder.test.ts index c726b4328..129efab81 100755 --- a/e2e/suites/actions/create/create-folder.test.ts +++ b/e2e/suites/actions/create/create-folder.test.ts @@ -125,7 +125,7 @@ describe('Create folder', () => { it('[C216345] dialog UI elements', async () => { await openCreateFolderDialog(parent); - expect(await createDialog.getTitle()).toMatch('Create new folder'); + expect(await createDialog.getDialogTitle()).toMatch('Create new folder'); expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed'); expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed'); expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); diff --git a/e2e/suites/actions/create/create-library.test.ts b/e2e/suites/actions/create/create-library.test.ts index ca40ffacb..e14d93a6b 100755 --- a/e2e/suites/actions/create/create-library.test.ts +++ b/e2e/suites/actions/create/create-library.test.ts @@ -95,7 +95,7 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); - expect(await createDialog.getTitle()).toMatch('Create Library'); + expect(await createDialog.getDialogTitle()).toMatch('Create Library'); expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed'); expect(await createDialog.libraryIdInput.isDisplayed()).toBe(true, 'Library ID input is not displayed'); expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed'); diff --git a/e2e/suites/actions/delete/delete-undo-delete.test.ts b/e2e/suites/actions/delete/delete-undo-delete.test.ts index efb4152e6..af2cc49c9 100755 --- a/e2e/suites/actions/delete/delete-undo-delete.test.ts +++ b/e2e/suites/actions/delete/delete-undo-delete.test.ts @@ -55,25 +55,24 @@ describe('Delete and undo delete', () => { const parent = `parentRF-${Utils.random()}`; let parentId: string; - const recentFile1 = `recentFile1-${Utils.random()}.txt`; - const recentFile2 = `recentFile2-${Utils.random()}.txt`; - const recentFile3 = `recentFile3-${Utils.random()}.txt`; - const recentFile4 = `recentFile4-${Utils.random()}.txt`; - const recentFile5 = `recentFile5-${Utils.random()}.txt`; - const recentFile6 = `recentFile6-${Utils.random()}.txt`; + const random = Utils.random(); + const recentFile1 = `recentFile1-${random}.txt`; + const recentFile2 = `recentFile2-${random}.txt`; + const recentFile3 = `recentFile3-${random}.txt`; + const recentFile4 = `recentFile4-${random}.txt`; + const recentFile5 = `recentFile5-${random}.txt`; + const recentFile6 = `recentFile6-${random}.txt`; beforeAll(async (done) => { parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - const initialRecentTotalItems = await apis.user.search.getTotalItems(username); - await apis.user.nodes.createFile(recentFile1, parentId); await apis.user.nodes.createFile(recentFile2, parentId); await apis.user.nodes.createFile(recentFile3, parentId); await apis.user.nodes.createFile(recentFile4, parentId); await apis.user.nodes.createFile(recentFile5, parentId); await apis.user.nodes.createFile(recentFile6, parentId); - await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 6 }); + await apis.user.search.waitForNodes(random, { expect: 6 }); await loginPage.loginWith(username); done(); @@ -93,25 +92,25 @@ describe('Delete and undo delete', () => { }); it('[C280528] delete a file and check notification', async () => { - await dataTable.selectItem(recentFile1); + await dataTable.selectItem(recentFile1, parent); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`${recentFile1} deleted`); expect(message).toContain(`Undo`); - expect(await dataTable.isItemPresent(recentFile1)).toBe(false, 'Item was not removed from list'); - await page.clickTrash(); - expect(await dataTable.isItemPresent(recentFile1)).toBe(true, 'Item is not in trash'); + expect(await dataTable.isItemPresent(recentFile1)).toBe(false, `${recentFile1} was not removed from list`); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(recentFile1)).toBe(true, `${recentFile1} is not in trash`); }); it('[C280529] delete multiple files and check notification', async () => { - await dataTable.selectMultipleItems([recentFile2, recentFile3]); + await dataTable.selectMultipleItems([recentFile2, recentFile3], parent); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Undo`); expect(await dataTable.isItemPresent(recentFile2)).toBe(false, `${recentFile2} was not removed from list`); expect(await dataTable.isItemPresent(recentFile3)).toBe(false, `${recentFile3} was not removed from list`); - await page.clickTrash(); + await page.clickTrashAndWait(); expect(await dataTable.isItemPresent(recentFile2)).toBe(true, `${recentFile2} is not in trash`); expect(await dataTable.isItemPresent(recentFile3)).toBe(true, `${recentFile3} is not in trash`); }); @@ -125,7 +124,7 @@ describe('Delete and undo delete', () => { await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); await page.clickTrash(); - expect(await dataTable.isItemPresent(recentFile4)).toBe(false, 'Item is in Trash'); + expect(await dataTable.isItemPresent(recentFile4)).toBe(false, `${recentFile4} is in Trash`); }); // due to the fact that the search api is slow to update, @@ -220,7 +219,11 @@ describe('Delete and undo delete', () => { afterAll(async () => { try { - await userActions.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]); + await apis.user.nodes.unlockFile(fileLocked1Id); + await apis.user.nodes.unlockFile(fileLocked2Id); + await apis.user.nodes.unlockFile(fileLocked3Id); + await apis.user.nodes.unlockFile(fileLocked4Id); + await userActions.deleteNodes([parentId]); await userActions.emptyTrashcan(); } catch (error) { @@ -235,11 +238,11 @@ describe('Delete and undo delete', () => { const message = await page.getSnackBarMessage(); expect(message).toContain(`${file1} deleted`); expect(message).toContain(`Undo`); - expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not removed from list'); + expect(await dataTable.isItemPresent(file1)).toBe(false, `${file1} was not removed from list`); items--; expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); - expect(await dataTable.isItemPresent(file1)).toBe(true, 'Item is not in trash'); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(file1)).toBe(true, `${file1} is not in trash`); }); it('[C280502] delete multiple files and check notification', async () => { @@ -252,7 +255,7 @@ describe('Delete and undo delete', () => { expect(await dataTable.isItemPresent(file3)).toBe(false, `${file3} was not removed from list`); items = items - 2; expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); + await page.clickTrashAndWait(); expect(await dataTable.isItemPresent(file2)).toBe(true, `${file2} is not in trash`); expect(await dataTable.isItemPresent(file3)).toBe(true, `${file3} is not in trash`); }); @@ -261,12 +264,12 @@ describe('Delete and undo delete', () => { let items = await page.dataTable.getRowsCount(); await dataTable.selectItem(folder1); await toolbar.clickMoreActionsDelete(); - expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not removed from list'); + expect(await dataTable.isItemPresent(folder1)).toBe(false, `${folder1} was not removed from list`); items--; expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); - expect(await dataTable.isItemPresent(folder1)).toBe(true, 'Item is not in trash'); - expect(await dataTable.isItemPresent(file1InFolder)).toBe(false, 'Item is in trash'); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(folder1)).toBe(true, `${folder1} is not in trash`); + expect(await dataTable.isItemPresent(file1InFolder)).toBe(false, `${file1InFolder} is in trash`); }); it('[C217127] delete a folder containing locked files', async () => { @@ -275,10 +278,10 @@ describe('Delete and undo delete', () => { const message = await page.getSnackBarMessage(); expect(message).toContain(`${folder2} couldn't be deleted`); expect(message).not.toContain(`Undo`); - expect(await dataTable.isItemPresent(folder2)).toBe(true, 'Item was removed from list'); + expect(await dataTable.isItemPresent(folder2)).toBe(true, `${folder2} was removed from list`); await page.clickTrash(); - expect(await dataTable.isItemPresent(folder2)).toBe(false, 'Item is in trash'); - expect(await dataTable.isItemPresent(fileLocked1)).toBe(false, 'Item is in trash'); + expect(await dataTable.isItemPresent(folder2)).toBe(false, `${folder2} is in trash`); + expect(await dataTable.isItemPresent(fileLocked1)).toBe(false, `${fileLocked1} is in trash`); }); it('[C217129] notification on multiple items deletion - some items fail to delete', async () => { @@ -304,31 +307,29 @@ describe('Delete and undo delete', () => { await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(file5)).toBe(true, 'Item was not restored'); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(file5)).toBe(true, `${file5} was not restored`); expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); }); it('[C280503] undo delete of folder with content', async () => { - const items = await page.dataTable.getRowsCount(); - await dataTable.selectItem(folder6); await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(folder6)).toBe(true, 'Item was not restored'); - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(folder6)).toBe(true, `${folder6} was not restored`); await dataTable.doubleClickOnRowByName(folder6); - expect(await dataTable.isItemPresent(file2InFolder)).toBe(true, 'file from folder not restored'); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(file2InFolder)).toBe(true, `${file2InFolder} from ${folder6} not restored`); }); it('[C280504] undo delete of multiple files', async () => { - const items = await page.dataTable.getRowsCount(); - await dataTable.selectMultipleItems([file6, file7]); await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(file6)).toBe(true, `${file6} was not removed from list`); - expect(await dataTable.isItemPresent(file7)).toBe(true, `${file7} was not removed from list`); - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(file6)).toBe(true, `${file6} was removed from list`); + expect(await dataTable.isItemPresent(file7)).toBe(true, `${file7} was removed from list`); }); }); @@ -366,9 +367,8 @@ describe('Delete and undo delete', () => { done(); }); - beforeEach(async (done) => { + beforeEach(async () => { await page.clickSharedFilesAndWait(); - done(); }); afterAll(async () => { @@ -386,9 +386,9 @@ describe('Delete and undo delete', () => { const message = await page.getSnackBarMessage(); expect(message).toContain(`${sharedFile1} deleted`); expect(message).toContain(`Undo`); - expect(await dataTable.isItemPresent(sharedFile1)).toBe(false, 'Item was not removed from list'); - await page.clickTrash(); - expect(await dataTable.isItemPresent(sharedFile1)).toBe(true, 'Item is not in trash'); + expect(await dataTable.isItemPresent(sharedFile1)).toBe(false, `${sharedFile1} was not removed from list`); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(sharedFile1)).toBe(true, `${sharedFile1} is not in trash`); }); it('[C280513] delete multiple files and check notification', async () => { @@ -399,7 +399,7 @@ describe('Delete and undo delete', () => { expect(message).toContain(`Undo`); expect(await dataTable.isItemPresent(sharedFile2)).toBe(false, `${sharedFile2} was not removed from list`); expect(await dataTable.isItemPresent(sharedFile3)).toBe(false, `${sharedFile3} was not removed from list`); - await page.clickTrash(); + await page.clickTrashAndWait(); expect(await dataTable.isItemPresent(sharedFile2)).toBe(true, `${sharedFile2} is not in trash`); expect(await dataTable.isItemPresent(sharedFile3)).toBe(true, `${sharedFile3} is not in trash`); }); @@ -409,7 +409,7 @@ describe('Delete and undo delete', () => { await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); await page.clickTrash(); - expect(await dataTable.isItemPresent(sharedFile4)).toBe(false, 'Item was not restored'); + expect(await dataTable.isItemPresent(sharedFile4)).toBe(false, `${sharedFile4} was not restored`); }); it('[C280514] undo delete of multiple files', async () => { @@ -468,8 +468,6 @@ describe('Delete and undo delete', () => { beforeAll(async (done) => { parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems(); - favFile1Id = (await apis.user.nodes.createFile(favFile1, parentId)).entry.id; favFile2Id = (await apis.user.nodes.createFile(favFile2, parentId)).entry.id; favFile3Id = (await apis.user.nodes.createFile(favFile3, parentId)).entry.id; @@ -497,6 +495,7 @@ describe('Delete and undo delete', () => { await apis.user.nodes.lockFile(fileLocked3Id, 'FULL'); await apis.user.nodes.lockFile(fileLocked4Id, 'FULL'); + const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems(); await apis.user.favorites.addFavoritesByIds('file', [favFile1Id, favFile2Id, favFile3Id, favFile4Id, favFile5Id, favFile6Id, favFile7Id]); await apis.user.favorites.addFavoritesByIds('folder', [favFolder1Id, favFolder2Id, favFolder3Id, favFolder4Id, favFolder5Id, favFolder6Id]); await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 }); @@ -512,7 +511,11 @@ describe('Delete and undo delete', () => { afterAll(async () => { try { - await userActions.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]); + await apis.user.nodes.unlockFile(fileLocked1Id); + await apis.user.nodes.unlockFile(fileLocked2Id); + await apis.user.nodes.unlockFile(fileLocked3Id); + await apis.user.nodes.unlockFile(fileLocked4Id); + await userActions.deleteNodes([parentId]); await userActions.emptyTrashcan(); } catch (error) { @@ -521,47 +524,37 @@ describe('Delete and undo delete', () => { }); it('[C280516] delete a file and check notification', async () => { - let items = await page.dataTable.getRowsCount(); - await dataTable.selectItem(favFile1); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`${favFile1} deleted`); expect(message).toContain(`Undo`); - expect(await dataTable.isItemPresent(favFile1)).toBe(false, 'Item was not removed from list'); - items--; - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); - expect(await dataTable.isItemPresent(favFile1)).toBe(true, 'Item is not in trash'); + expect(await dataTable.isItemPresent(favFile1)).toBe(false, `${favFile1} was not removed from list`); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(favFile1)).toBe(true, `${favFile1} is not in trash`); }); it('[C280517] delete multiple files and check notification', async () => { - let items = await page.dataTable.getRowsCount(); - - await dataTable.selectMultipleItems([favFile2, favFile3]); + await dataTable.selectMultipleItems([favFile2, favFile3], parent); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`Deleted 2 items`); expect(message).toContain(`Undo`); expect(await dataTable.isItemPresent(favFile2)).toBe(false, `${favFile2} was not removed from list`); expect(await dataTable.isItemPresent(favFile3)).toBe(false, `${favFile3} was not removed from list`); - items = items - 2; - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); + await page.clickTrashAndWait(); expect(await dataTable.isItemPresent(favFile2)).toBe(true, `${favFile2} is not in trash`); expect(await dataTable.isItemPresent(favFile3)).toBe(true, `${favFile3} is not in trash`); }); it('[C280518] delete a folder with content', async () => { - let items = await page.dataTable.getRowsCount(); - await dataTable.selectItem(favFolder1); + await dataTable.selectItem(favFolder1, parent); await toolbar.clickMoreActionsDelete(); - expect(await dataTable.isItemPresent(favFolder1)).toBe(false, 'Item was not removed from list'); - items--; - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); - await page.clickTrash(); - expect(await dataTable.isItemPresent(favFolder1)).toBe(true, 'Item is not in trash'); - expect(await dataTable.isItemPresent(file1InFolder)).toBe(false, 'Item is in trash'); + await dataTable.waitForHeader(); + expect(await dataTable.isItemPresent(favFolder1)).toBe(false, `${favFolder1} was not removed from list`); + await page.clickTrashAndWait(); + expect(await dataTable.isItemPresent(favFolder1)).toBe(true, `${favFolder1} is not in trash`); + expect(await dataTable.isItemPresent(file1InFolder)).toBe(false, `${file1InFolder} is in trash`); }); it('[C280519] delete a folder containing locked files', async () => { @@ -569,14 +562,14 @@ describe('Delete and undo delete', () => { await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`${favFolder2} couldn't be deleted`); - expect(await dataTable.isItemPresent(favFolder2)).toBe(true, 'Item was removed from list'); + expect(await dataTable.isItemPresent(favFolder2)).toBe(true, `${favFolder2} was removed from list`); await page.clickTrash(); - expect(await dataTable.isItemPresent(favFolder2)).toBe(false, 'Item is in trash'); - expect(await dataTable.isItemPresent(fileLocked1)).toBe(false, 'Item is in trash'); + expect(await dataTable.isItemPresent(favFolder2)).toBe(false, `${favFolder2} is in trash`); + expect(await dataTable.isItemPresent(fileLocked1)).toBe(false, `${fileLocked1} is in trash`); }); it('[C280520] notification on multiple items deletion - some items fail to delete', async () => { - await dataTable.selectMultipleItems([favFile4, favFolder3]); + await dataTable.selectMultipleItems([favFile4, favFolder3], parent); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toContain(`Deleted 1 item, 1 couldn't be deleted`); @@ -584,7 +577,7 @@ describe('Delete and undo delete', () => { }); it('[C280521] notification on multiple items deletion - all items fail to delete', async () => { - await dataTable.selectMultipleItems([favFolder4, favFolder5]); + await dataTable.selectMultipleItems([favFolder4, favFolder5], parent); await toolbar.clickMoreActionsDelete(); const message = await page.getSnackBarMessage(); expect(message).toEqual(`2 items couldn't be deleted`); @@ -592,36 +585,31 @@ describe('Delete and undo delete', () => { }); it('[C280524] undo delete of file', async () => { - const items = await page.dataTable.getRowsCount(); - - await dataTable.selectItem(favFile5); + await dataTable.selectItem(favFile5, parent); await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(favFile5)).toBe(true, 'Item was not restored'); - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(favFile5)).toBe(true, `${favFile5} was not restored`); }); it('[C280526] undo delete of folder with content', async () => { - const items = await page.dataTable.getRowsCount(); - await dataTable.selectItem(favFolder6); await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(favFolder6)).toBe(true, 'Item was not restored'); - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(favFolder6)).toBe(true, `${favFolder6} was not restored`); await dataTable.doubleClickOnRowByName(favFolder6); - expect(await dataTable.isItemPresent(file2InFolder)).toBe(true, 'file from folder not restored'); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(file2InFolder)).toBe(true, `${file2InFolder} from ${favFolder6} not restored`); }); it('[C280525] undo delete of multiple files', async () => { - const items = await page.dataTable.getRowsCount(); - await dataTable.selectMultipleItems([favFile6, favFile7]); await toolbar.clickMoreActionsDelete(); await page.clickSnackBarAction(); - expect(await dataTable.isItemPresent(favFile6)).toBe(true, `${favFile6} was not removed from list`); - expect(await dataTable.isItemPresent(favFile7)).toBe(true, `${favFile7} was not removed from list`); - expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`); + await dataTable.waitForBody(); + expect(await dataTable.isItemPresent(favFile6)).toBe(true, `${favFile6} was not restored`); + expect(await dataTable.isItemPresent(favFile7)).toBe(true, `${favFile7} was not restored`); }); }); }); diff --git a/e2e/suites/actions/delete/permanently-delete.test.ts b/e2e/suites/actions/delete/permanently-delete.test.ts index a3a079357..e1ec6ff8e 100755 --- a/e2e/suites/actions/delete/permanently-delete.test.ts +++ b/e2e/suites/actions/delete/permanently-delete.test.ts @@ -125,7 +125,7 @@ describe('Permanently delete from Trash', () => { await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); - expect(await confirmDialog.getTitle()).toContain('Delete from trash'); + expect(await confirmDialog.getDialogTitle()).toContain('Delete from trash'); expect(await confirmDialog.getText()).toContain('This will permanently remove the selected item(s)'); expect(await confirmDialog.isDeleteEnabled()).toBe(true, 'DELETE button is not enabled'); expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled'); diff --git a/e2e/suites/actions/edit/edit-folder.test.ts b/e2e/suites/actions/edit/edit-folder.test.ts index 067b62397..add6cea92 100755 --- a/e2e/suites/actions/edit/edit-folder.test.ts +++ b/e2e/suites/actions/edit/edit-folder.test.ts @@ -143,7 +143,7 @@ describe('Edit folder', () => { await toolbar.openMoreMenu(); await BrowserActions.click(toolbar.menu.editFolderAction); - expect(await editDialog.getTitle()).toEqual('Edit folder'); + expect(await editDialog.getDialogTitle()).toEqual('Edit folder'); expect(await editDialog.getName()).toBe(folderName); expect(await editDialog.getDescription()).toBe(folderDescription); expect(await editDialog.isUpdateButtonEnabled()).toBe(true, 'upload button is not enabled'); diff --git a/e2e/suites/actions/edit/edit-offline.test.ts b/e2e/suites/actions/edit/edit-offline.test.ts index db4c79a8a..677c87d0a 100755 --- a/e2e/suites/actions/edit/edit-offline.test.ts +++ b/e2e/suites/actions/edit/edit-offline.test.ts @@ -29,30 +29,19 @@ describe('Edit offline', () => { const username = `user-${Utils.random()}`; const file1 = `file1-${Utils.random()}.docx`; - let file1Id: string; const fileLocked = `file-locked-${Utils.random()}.docx`; - let fileLockedId: string; const fileLocked2 = `file-locked2-${Utils.random()}.docx`; - let fileLocked2Id: string; const searchRandom = Utils.random(); const fileSearch1 = `file-search-1-${searchRandom}.docx`; - let fileSearch1Id: string; const fileSearchLocked = `file-search-locked-${searchRandom}.docx`; - let fileSearchLockedId: string; const fileSearchLocked2 = `file-search-locked2-${searchRandom}.docx`; - let fileSearchLocked2Id: string; const parentPF = `parentPersonal-${Utils.random()}`; - let parentPFId: string; const parentSF = `parentShared-${Utils.random()}`; - let parentSFId: string; const parentRF = `parentRecent-${Utils.random()}`; - let parentRFId: string; const parentFav = `parentFav-${Utils.random()}`; - let parentFavId: string; const parentSearch = `parentSearch-${Utils.random()}`; - let parentSearchId: string; const apis = { user: new RepoClient(username, username) @@ -70,6 +59,11 @@ describe('Edit offline', () => { }); describe('on Personal Files', () => { + let parentPFId: string; + let file1Id: string; + let fileLockedId: string; + let fileLocked2Id: string; + beforeAll(async () => { parentPFId = (await apis.user.nodes.createFolder(parentPF)).entry.id; @@ -121,6 +115,11 @@ describe('Edit offline', () => { }); describe('on Shared Files', () => { + let parentSFId: string; + let file1Id: string; + let fileLockedId: string; + let fileLocked2Id: string; + beforeAll(async () => { parentSFId = (await apis.user.nodes.createFolder(parentSF)).entry.id; @@ -174,6 +173,11 @@ describe('Edit offline', () => { }); describe('on Recent Files', () => { + let parentRFId: string; + let file1Id: string; + let fileLockedId: string; + let fileLocked2Id: string; + beforeAll(async () => { parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id; @@ -228,6 +232,11 @@ describe('Edit offline', () => { }); describe('on Favorite Files', () => { + let parentFavId: string; + let file1Id: string; + let fileLockedId: string; + let fileLocked2Id: string; + beforeAll(async () => { parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id; @@ -281,6 +290,11 @@ describe('Edit offline', () => { }); describe('on Search Results', () => { + let parentSearchId: string; + let fileSearch1Id: string; + let fileSearchLockedId: string; + let fileSearchLocked2Id: string; + beforeAll(async () => { parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id; @@ -312,7 +326,7 @@ describe('Edit offline', () => { }); it('[C306953] File is locked and downloaded when clicking Edit Offline', async () => { - await dataTable.selectItem(fileSearch1); + await dataTable.selectItem(fileSearch1, parentSearch); await toolbar.clickMoreActionsEditOffline(); expect(await Utils.fileExistsOnOS(fileSearch1)).toBe(true, 'File not found in download location'); @@ -329,7 +343,7 @@ describe('Edit offline', () => { }); it('[C306955] Cancel Editing unlocks the file', async () => { - await dataTable.selectItem(fileSearchLocked); + await dataTable.selectItem(fileSearchLocked, parentSearch); await toolbar.clickMoreActionsCancelEditing(); await dataTable.unselectItem(fileSearchLocked); diff --git a/e2e/suites/actions/library/library-actions.test.ts b/e2e/suites/actions/library/library-actions.test.ts index 4c3024671..8a749df53 100755 --- a/e2e/suites/actions/library/library-actions.test.ts +++ b/e2e/suites/actions/library/library-actions.test.ts @@ -252,7 +252,7 @@ describe('Library actions', () => { await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); - expect(await confirmDialog.getTitle()).toContain('Leave this library?'); + expect(await confirmDialog.getDialogTitle()).toContain('Leave this library?'); expect(await confirmDialog.getText()).toContain('Leaving will remove your access.'); expect(await confirmDialog.isOkEnabled()).toBe(true, 'OK button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); diff --git a/e2e/suites/actions/share/share-file.test.ts b/e2e/suites/actions/share/share-file.test.ts index ea282fa6a..d3a28b064 100755 --- a/e2e/suites/actions/share/share-file.test.ts +++ b/e2e/suites/actions/share/share-file.test.ts @@ -43,23 +43,14 @@ describe('Share a file', () => { let parentId: string; const file1 = `file1-${Utils.random()}.txt`; - let file1Id: string; const file2 = `file2-${Utils.random()}.txt`; - let file2Id: string; - let file3 = `file3-${Utils.random()}.txt`; - let file3Id: string; + const file3 = `file3-${Utils.random()}.txt`; const file4 = `file4-${Utils.random()}.txt`; - let file4Id: string; - let file5 = `file5-${Utils.random()}.txt`; - let file5Id: string; - let file6 = `file6-${Utils.random()}.txt`; - let file6Id: string; - let file7 = `file7-${Utils.random()}.txt`; - let file7Id: string; + const file5 = `file5-${Utils.random()}.txt`; + const file6 = `file6-${Utils.random()}.txt`; + const file7 = `file7-${Utils.random()}.txt`; const file8 = `file8-${Utils.random()}.txt`; - let file8Id: string; - let file9 = `file9-${Utils.random()}.txt`; - let file9Id: string; + const file9 = `file9-${Utils.random()}.txt`; const viewer = new Viewer(); const page = new BrowsingPage(); @@ -73,22 +64,21 @@ describe('Share a file', () => { const adminApiActions = new AdminActions(); const userActions = new UserActions(); - beforeAll(async (done) => { + beforeAll(async () => { await adminApiActions.login(); await adminApiActions.createUser({ username }); - await userActions.login(username, username); + await userActions.login(username, username); parentId = (await apis.user.nodes.createFolder(parent)).entry.id; - done(); }); - afterAll(async (done) => { + afterAll(async () => { await apis.user.nodes.deleteNodeById(parentId); - done(); }); describe('when logged out', () => { let file6SharedLink: string; + let file6Id: string; beforeAll(async () => { file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id; @@ -104,16 +94,17 @@ describe('Share a file', () => { it('[C286326] A non-logged user can download the shared file from the viewer', async () => { await browser.get(file6SharedLink); - expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); + await viewer.waitForTxtViewerToLoad(); + expect(await viewer.getFileTitle()).toEqual(file6); - await BrowserActions.click(toolbar.downloadButton); + await BrowserActions.click(viewer.toolbar.downloadButton); expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location'); }); }); describe('when logged in', () => { - const expiryDate: any = '2020-12-25T18:30:00.000+0000'; + const expiryDate: any = '2022-12-25T18:30:00.000+0000'; const loginPage = new LoginPage(); const shareDialog = new ShareDialog(); @@ -125,6 +116,16 @@ describe('Share a file', () => { }); describe('from Personal Files', () => { + let file1Id: string; + let file2Id: string; + let file3Id: string; + let file4Id: string; + let file5Id: string; + let file6Id: string; + let file7Id: string; + let file8Id: string; + let file9Id: string; + beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -148,6 +149,7 @@ describe('Share a file', () => { afterEach(async () => { await Utils.pressEscape(); + await page.closeOpenDialogs(); }); afterAll(async () => { @@ -156,10 +158,12 @@ describe('Share a file', () => { it('[C286327] Share dialog default values', async () => { await dataTable.selectItem(file1); - await BrowserActions.click(toolbar.shareButton); - await shareDialog.waitForDialogToOpen(); + await toolbar.shareButton.click(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file1Id]); + + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -172,8 +176,10 @@ describe('Share a file', () => { it('[C286328] Close dialog', async () => { await dataTable.selectItem(file2); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file2Id]); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); await shareDialog.clickClose(); @@ -182,25 +188,29 @@ describe('Share a file', () => { it('[C286329] Share a file', async () => { await dataTable.selectItem(file3); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file3Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file3Id); - expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(url).toContain(sharedId); }); it('[C286330] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file4Id]); + const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); await BrowserActions.click(shareDialog.urlAction); - expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -212,15 +222,15 @@ describe('Share a file', () => { it('[C286332] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file5Id]); await BrowserActions.click(shareDialog.expireToggle); - expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); 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(); @@ -264,11 +274,13 @@ 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 BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file8Id]); + const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); - await shareDialog.waitForDialogToClose(); await page.dataTable.clearSelection(); await dataTable.selectItem(file8); @@ -282,11 +294,14 @@ describe('Share a file', () => { it('[C286345] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await BrowserActions.click(contextMenu.shareAction); + await contextMenu.shareAction.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file9Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file9Id); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(url).toContain(sharedId); @@ -297,20 +312,29 @@ describe('Share a file', () => { const siteName = `site-${Utils.random()}`; const parentInSite = `parent-site-${Utils.random()}`; let parentInSiteId: 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; + let file9Id: string; beforeAll(async () => { await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC); const docLibId = await apis.user.sites.getDocLibId(siteName); parentInSiteId = (await apis.user.nodes.createFolder(parentInSite, docLibId)).entry.id; - await apis.user.nodes.createFile(file1, parentInSiteId); - await apis.user.nodes.createFile(file2, parentInSiteId); + file1Id = (await apis.user.nodes.createFile(file1, parentInSiteId)).entry.id; + file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id; file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id; - await apis.user.nodes.createFile(file4, parentInSiteId); + file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id; file5Id = (await apis.user.nodes.createFile(file5, parentInSiteId)).entry.id; file6Id = (await apis.user.nodes.createFile(file6, parentInSiteId)).entry.id; file7Id = (await apis.user.nodes.createFile(file7, parentInSiteId)).entry.id; - await apis.user.nodes.createFile(file8, parentInSiteId); + file8Id = (await apis.user.nodes.createFile(file8, parentInSiteId)).entry.id; file9Id = (await apis.user.nodes.createFile(file9, parentInSiteId)).entry.id; await userActions.shareNodes([file6Id, file7Id], expiryDate); @@ -327,7 +351,7 @@ describe('Share a file', () => { afterEach(async () => { await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); + await page.closeOpenDialogs(); }); afterAll(async () => { @@ -336,10 +360,12 @@ describe('Share a file', () => { it('[C286639] Share dialog default values', async () => { await dataTable.selectItem(file1); - await BrowserActions.click(toolbar.shareButton); - await shareDialog.waitForDialogToOpen(); + await toolbar.shareButton.click(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file1Id]); + + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -352,8 +378,10 @@ describe('Share a file', () => { it('[C286640] Close dialog', async () => { await dataTable.selectItem(file2); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file2Id]); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); await shareDialog.clickClose(); @@ -362,11 +390,14 @@ describe('Share a file', () => { it('[C286641] Share a file', async () => { await dataTable.selectItem(file3); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file3Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file3Id); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(url).toContain(sharedId); @@ -374,8 +405,11 @@ describe('Share a file', () => { it('[C286642] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file4Id]); + const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -391,8 +425,10 @@ describe('Share a file', () => { it('[C286643] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file5Id]); await BrowserActions.click(shareDialog.expireToggle); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); @@ -440,11 +476,13 @@ 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 BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file8Id]); + const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); - await shareDialog.waitForDialogToClose(); await page.dataTable.clearSelection(); await dataTable.selectItem(file8); @@ -458,11 +496,14 @@ describe('Share a file', () => { it('[C286647] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await BrowserActions.click(contextMenu.shareAction); + await contextMenu.shareAction.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file9Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file9Id); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(url).toContain(sharedId); @@ -470,6 +511,16 @@ describe('Share a file', () => { }); describe('from Recent Files', () => { + let file1Id: string; + let file2Id: string; + let file3Id: string; + let file4Id: string; + let file5Id: string; + let file6Id: string; + let file7Id: string; + let file8Id: string; + let file9Id: string; + beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -490,8 +541,8 @@ describe('Share a file', () => { }); afterEach(async () => { + await page.closeOpenDialogs(); await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); }); afterAll(async () => { @@ -499,11 +550,13 @@ describe('Share a file', () => { }); it('[C286657] Share dialog default values', async () => { - await dataTable.selectItem(file1); - await BrowserActions.click(toolbar.shareButton); - await shareDialog.waitForDialogToOpen(); + await dataTable.selectItem(file1, parent); + await toolbar.shareButton.click(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file1Id]); + + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -515,9 +568,11 @@ describe('Share a file', () => { }); it('[C286658] Close dialog', async () => { - await dataTable.selectItem(file2); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(file2, parent); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file2Id]); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); await shareDialog.clickClose(); @@ -525,21 +580,27 @@ describe('Share a file', () => { }); it('[C286659] Share a file', async () => { - await dataTable.selectItem(file3); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(file3, parent); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file3Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file3Id); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(url).toContain(sharedId); }); it('[C286660] Copy shared file URL', async () => { - await dataTable.selectItem(file4); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(file4, parent); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file4Id]); + const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -554,9 +615,11 @@ describe('Share a file', () => { }); it('[C286661] Share a file with expiration date', async () => { - await dataTable.selectItem(file5); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(file5, parent); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file5Id]); await BrowserActions.click(shareDialog.expireToggle); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); @@ -576,7 +639,7 @@ describe('Share a file', () => { }); it('[C286662] Expire date is displayed correctly', async () => { - await dataTable.selectItem(file6); + await dataTable.selectItem(file6, parent); await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); @@ -587,7 +650,7 @@ describe('Share a file', () => { }); it('[C286663] Disable the share link expiration', async () => { - await dataTable.selectItem(file7); + await dataTable.selectItem(file7, parent); await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); @@ -604,11 +667,13 @@ 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 BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file8Id]); + const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); - await shareDialog.waitForDialogToClose(); await page.dataTable.clearSelection(); await dataTable.selectItem(file8); @@ -622,11 +687,14 @@ describe('Share a file', () => { it('[C286665] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await BrowserActions.click(contextMenu.shareAction); + await contextMenu.shareAction.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file9Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file9Id); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(url).toContain(sharedId); @@ -634,6 +702,14 @@ describe('Share a file', () => { }); describe('from Shared Files', () => { + let file1Id: string; + let file2Id: string; + let file3Id: string; + let file4Id: string; + let file5Id: string; + let file6Id: string; + let file7Id: string; + beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -655,7 +731,7 @@ describe('Share a file', () => { afterEach(async () => { await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); + await page.closeOpenDialogs(); }); afterAll(async () => { @@ -667,7 +743,7 @@ describe('Share a file', () => { await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -738,7 +814,6 @@ describe('Share a file', () => { await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); - await shareDialog.waitForDialogToClose(); await page.dataTable.clearSelection(); await dataTable.selectItem(file6); @@ -756,7 +831,7 @@ describe('Share a file', () => { await shareDialog.waitForDialogToOpen(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`); + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file7}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -769,6 +844,16 @@ describe('Share a file', () => { }); describe('from Favorites', () => { + let file1Id: string; + let file2Id: string; + let file3Id: string; + let file4Id: string; + let file5Id: string; + let file6Id: string; + let file7Id: string; + let file8Id: string; + let file9Id: string; + beforeAll(async () => { file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id; file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id; @@ -793,7 +878,7 @@ describe('Share a file', () => { afterEach(async () => { await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); + await page.closeOpenDialogs(); }); afterAll(async () => { @@ -802,10 +887,12 @@ describe('Share a file', () => { it('[C286666] Share dialog default values', async () => { await dataTable.selectItem(file1); - await BrowserActions.click(toolbar.shareButton); - await shareDialog.waitForDialogToOpen(); + await toolbar.shareButton.click(); - expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file1Id]); + + expect(await shareDialog.getDialogTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); @@ -818,8 +905,10 @@ describe('Share a file', () => { it('[C286667] Close dialog', async () => { await dataTable.selectItem(file2); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file2Id]); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); await shareDialog.clickClose(); @@ -828,11 +917,14 @@ describe('Share a file', () => { it('[C286668] Share a file', async () => { await dataTable.selectItem(file3); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file3Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file3Id); expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); expect(url).toContain(sharedId); @@ -840,8 +932,11 @@ describe('Share a file', () => { it('[C286669] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file4Id]); + const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); @@ -857,8 +952,10 @@ describe('Share a file', () => { it('[C286670] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file5Id]); await BrowserActions.click(shareDialog.expireToggle); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); @@ -906,11 +1003,13 @@ 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 BrowserActions.click(toolbar.shareButton); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file8Id]); + const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); - await shareDialog.waitForDialogToClose(); await page.dataTable.clearSelection(); await dataTable.selectItem(file8); @@ -924,11 +1023,14 @@ describe('Share a file', () => { it('[C286674] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await BrowserActions.click(contextMenu.shareAction); + await contextMenu.shareAction.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([file9Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); + await shareDialog.clickClose(); + const sharedId = await apis.user.nodes.getSharedId(file9Id); expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); expect(url).toContain(sharedId); @@ -937,22 +1039,29 @@ describe('Share a file', () => { describe('from Search Results', () => { const searchRandom = Utils.random(); - file3 = `search-file3-${searchRandom}.txt`; - file5 = `search-file5-${searchRandom}.txt`; - file6 = `search-file6-${searchRandom}.txt`; - file7 = `search-file7-${searchRandom}.txt`; - file9 = `search-file9-${searchRandom}.txt`; + + const fileSearch3 = `search-file3-${searchRandom}.txt`; + const fileSearch5 = `search-file5-${searchRandom}.txt`; + const fileSearch6 = `search-file6-${searchRandom}.txt`; + const fileSearch7 = `search-file7-${searchRandom}.txt`; + const fileSearch9 = `search-file9-${searchRandom}.txt`; + + let fileSearch3Id: string; + let fileSearch5Id: string; + let fileSearch6Id: string; + let fileSearch7Id: string; + let fileSearch9Id: string; beforeAll(async () => { - file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id; - file5Id = (await apis.user.nodes.createFile(file5, parentId)).entry.id; - file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id; - file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id; - file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id; + fileSearch3Id = (await apis.user.nodes.createFile(fileSearch3, parentId)).entry.id; + fileSearch5Id = (await apis.user.nodes.createFile(fileSearch5, parentId)).entry.id; + fileSearch6Id = (await apis.user.nodes.createFile(fileSearch6, parentId)).entry.id; + fileSearch7Id = (await apis.user.nodes.createFile(fileSearch7, parentId)).entry.id; + fileSearch9Id = (await apis.user.nodes.createFile(fileSearch9, parentId)).entry.id; await apis.user.search.waitForNodes(searchRandom, { expect: 5 }); - await userActions.shareNodes([file6Id, file7Id], expiryDate); - await apis.user.shared.waitForFilesToBeShared([file6Id, file7Id]); + await userActions.shareNodes([fileSearch6Id, fileSearch7Id], expiryDate); + await apis.user.shared.waitForFilesToBeShared([fileSearch6Id, fileSearch7Id]); }); beforeEach(async () => { @@ -964,29 +1073,34 @@ describe('Share a file', () => { afterEach(async () => { await Utils.pressEscape(); - await page.clickPersonalFilesAndWait(); + await page.closeOpenDialogs(); }); afterAll(async () => { - await apis.user.nodes.deleteNodesById([file3Id, file5Id, file6Id, file7Id, file9Id]); + await apis.user.nodes.deleteNodesById([fileSearch3Id, fileSearch5Id, fileSearch6Id, fileSearch7Id, fileSearch9Id]); }); it('[C306975] Share a file', async () => { - await dataTable.selectItem(file3); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(fileSearch3); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([fileSearch3Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); - const sharedId = await apis.user.nodes.getSharedId(file3Id); - expect(await apis.user.nodes.isFileShared(file3Id)).toBe(true, `${file3} is not shared`); + await shareDialog.clickClose(); + + const sharedId = await apis.user.nodes.getSharedId(fileSearch3Id); + expect(await apis.user.nodes.isFileShared(fileSearch3Id)).toBe(true, `${fileSearch3} is not shared`); expect(url).toContain(sharedId); }); it('[C306977] Share a file with expiration date', async () => { - await dataTable.selectItem(file5); - await BrowserActions.click(toolbar.shareButton); + await dataTable.selectItem(fileSearch5); + await toolbar.shareButton.click(); + await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([fileSearch5Id]); await BrowserActions.click(shareDialog.expireToggle); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); @@ -1000,24 +1114,24 @@ describe('Share a file', () => { expect(new Date(inputDate)).toEqual(new Date(setDate)); - const expireDateProperty = await apis.user.nodes.getSharedExpiryDate(file5Id); + const expireDateProperty = await apis.user.nodes.getSharedExpiryDate(fileSearch5Id); expect(Utils.formatDate(expireDateProperty)).toEqual(Utils.formatDate(inputDate)); }); it('[C306978] Expire date is displayed correctly', async () => { - await dataTable.selectItem(file6); + await dataTable.selectItem(fileSearch6); await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); - const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); + const expireProperty = await apis.user.nodes.getSharedExpiryDate(fileSearch6Id); expect(expireProperty).toEqual(expiryDate); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(Utils.formatDate(await shareDialog.getExpireDate())).toEqual(Utils.formatDate(expiryDate)); }); it('[C306979] Disable the share link expiration', async () => { - await dataTable.selectItem(file7); + await dataTable.selectItem(fileSearch7); await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); @@ -1030,20 +1144,22 @@ describe('Share a file', () => { expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); await shareDialog.clickClose(); - expect(await apis.user.nodes.getSharedExpiryDate(file7Id)).toBe('', `${file7} link still has expiration`); + expect(await apis.user.nodes.getSharedExpiryDate(fileSearch7Id)).toBe('', `${fileSearch7} link still has expiration`); }); it('[C306981] Share a file from the context menu', async () => { - await dataTable.rightClickOnItem(file9); + await dataTable.rightClickOnItem(fileSearch9); await contextMenu.waitForMenuToOpen(); - await BrowserActions.click(contextMenu.shareAction); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); + await apis.user.shared.waitForFilesToBeShared([fileSearch9Id]); const url = await shareDialog.getLinkUrl(); - await Utils.pressEscape(); - const sharedId = await apis.user.nodes.getSharedId(file9Id); - expect(await apis.user.nodes.isFileShared(file9Id)).toBe(true, `${file9} is not shared`); + await shareDialog.clickClose(); + + const sharedId = await apis.user.nodes.getSharedId(fileSearch9Id); + expect(await apis.user.nodes.isFileShared(fileSearch9Id)).toBe(true, `${fileSearch9} is not shared`); expect(url).toContain(sharedId); }); }); diff --git a/e2e/suites/actions/share/unshare-file-search-results.test.ts b/e2e/suites/actions/share/unshare-file-search-results.test.ts index 68fc36e46..476ff9714 100755 --- a/e2e/suites/actions/share/unshare-file-search-results.test.ts +++ b/e2e/suites/actions/share/unshare-file-search-results.test.ts @@ -37,6 +37,7 @@ import { Viewer, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Unshare a file from Search Results', () => { const username = `user-${Utils.random()}`; @@ -128,14 +129,14 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -148,10 +149,11 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -173,11 +175,12 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -196,10 +199,11 @@ describe('Unshare a file from Search Results', () => { await dataTable.rightClickOnItem(file4); await contextMenu.waitForMenuToOpen(); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -220,12 +224,13 @@ describe('Unshare a file from Search Results', () => { await searchInput.searchFor(fileSite1); await dataTable.waitForBody(); await dataTable.selectItem(fileSite1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); @@ -238,12 +243,13 @@ describe('Unshare a file from Search Results', () => { await searchInput.searchFor(fileSite2); await dataTable.waitForBody(); await dataTable.selectItem(fileSite2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); diff --git a/e2e/suites/actions/share/unshare-file.test.ts b/e2e/suites/actions/share/unshare-file.test.ts index 823592490..d39073195 100755 --- a/e2e/suites/actions/share/unshare-file.test.ts +++ b/e2e/suites/actions/share/unshare-file.test.ts @@ -37,6 +37,7 @@ import { Viewer, Utils } from '@alfresco/aca-testing-shared'; +import { BrowserActions } from '@alfresco/adf-testing'; describe('Unshare a file', () => { const username = `user-${Utils.random()}`; @@ -115,14 +116,14 @@ describe('Unshare a file', () => { it('[C286339] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -130,10 +131,11 @@ describe('Unshare a file', () => { it('[C286340] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -150,11 +152,12 @@ describe('Unshare a file', () => { it('[C286341] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -167,10 +170,11 @@ describe('Unshare a file', () => { it('[C286359] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -237,14 +241,14 @@ describe('Unshare a file', () => { it('[C286679] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -252,10 +256,11 @@ describe('Unshare a file', () => { it('[C286680] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -272,11 +277,12 @@ describe('Unshare a file', () => { it('[C286681] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -289,10 +295,11 @@ describe('Unshare a file', () => { it('[C286683] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -347,14 +354,14 @@ describe('Unshare a file', () => { it('[C286689] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -362,10 +369,11 @@ describe('Unshare a file', () => { it('[C286690] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -382,11 +390,12 @@ describe('Unshare a file', () => { it('[C286691] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -399,10 +408,11 @@ describe('Unshare a file', () => { it('[C286693] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -457,14 +467,14 @@ describe('Unshare a file', () => { it('[C286684] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -472,10 +482,11 @@ describe('Unshare a file', () => { it('[C286685] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -492,11 +503,12 @@ describe('Unshare a file', () => { it('[C286686] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -509,10 +521,12 @@ describe('Unshare a file', () => { it('[C286688] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); + const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -521,7 +535,8 @@ describe('Unshare a file', () => { expect(await apis.user.nodes.isFileShared(file4Id)).toBe(false, `${file4} is shared`); await browser.get(url); - expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); + await viewer.waitForViewerToOpen(); + expect(await viewer.getFileTitle()).not.toEqual(file4); await page.load(); @@ -574,14 +589,14 @@ describe('Unshare a file', () => { it('[C286694] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); - expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); + expect(await confirmDialog.getDialogTitle()).toContain('Remove this shared link'); expect(await confirmDialog.getText()).toContain('This link will be deleted and a new link will be created next time this file is shared'); expect(await confirmDialog.isRemoveEnabled()).toBe(true, 'REMOVE button is not enabled'); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'CANCEL button is not enabled'); @@ -589,10 +604,11 @@ describe('Unshare a file', () => { it('[C286695] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -609,11 +625,12 @@ describe('Unshare a file', () => { it('[C286696] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); @@ -626,10 +643,11 @@ describe('Unshare a file', () => { it('[C286698] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.shareEditAction.click(); + await BrowserActions.click(contextMenu.shareEditAction); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); @@ -706,12 +724,13 @@ describe('Unshare a file', () => { await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.waitForHeader(); await dataTable.selectItem(file1FileLib); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); @@ -723,12 +742,13 @@ describe('Unshare a file', () => { await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.waitForHeader(); await dataTable.selectItem(file2FileLib); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); @@ -740,12 +760,13 @@ describe('Unshare a file', () => { it('[C286687] on Shared Files - file shared by other user', async () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(file1Shared); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); @@ -755,12 +776,13 @@ describe('Unshare a file', () => { it('[C286702] on Shared Files - file shared by the user', async () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(file2Shared); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); @@ -772,12 +794,13 @@ describe('Unshare a file', () => { it('[C286697] on Favorites - file shared by other user', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file1Fav); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); @@ -787,12 +810,13 @@ describe('Unshare a file', () => { it('[C286703] on Favorites - file shared by the user', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file2Fav); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.shareToggle.click(); + await BrowserActions.click(shareDialog.shareToggle); + await confirmDialog.waitForDialogToOpen(); await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); diff --git a/e2e/suites/actions/upload-download/upload-new-version.test.ts b/e2e/suites/actions/upload-download/upload-new-version.test.ts index e3c037961..15b8255c2 100755 --- a/e2e/suites/actions/upload-download/upload-new-version.test.ts +++ b/e2e/suites/actions/upload-download/upload-new-version.test.ts @@ -152,7 +152,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); + expect(await uploadNewVersionDialog.getDialogTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); @@ -328,7 +328,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); + expect(await uploadNewVersionDialog.getDialogTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); @@ -476,7 +476,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); + expect(await uploadNewVersionDialog.getDialogTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); @@ -624,7 +624,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); + expect(await uploadNewVersionDialog.getDialogTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); @@ -775,7 +775,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); + expect(await uploadNewVersionDialog.getDialogTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); diff --git a/e2e/suites/actions/upload-download/version-actions.test.ts b/e2e/suites/actions/upload-download/version-actions.test.ts index 53e56273f..135385333 100644 --- a/e2e/suites/actions/upload-download/version-actions.test.ts +++ b/e2e/suites/actions/upload-download/version-actions.test.ts @@ -71,6 +71,8 @@ describe('Version actions', () => { ); } + await apis.user.shared.waitForFilesToBeShared([fileId]); + await loginPage.loginWith(username); await dataTable.doubleClickOnRowByName(parentFolder); await dataTable.waitForHeader(); @@ -107,24 +109,23 @@ describe('Version actions', () => { }); it('[C586768] Should be possible to download a previous document version', async () => { - await viewerPage.clickDownloadButton(); + await viewerPage.toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[0])).toBe(true, 'File not found in download location'); }); }); describe('on Shared Files', () => { - beforeEach(async (done) => { + beforeEach(async () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('2.0'); - done(); }); - afterEach(async (done) => { - await viewerPage.clickCloseButton(); - done(); + afterEach(async () => { + await page.closeOpenDialogs(); + await Utils.pressEscape(); }); it('[C586776] Should be possible to view a previous document version', async () => { @@ -136,24 +137,23 @@ describe('Version actions', () => { }); it('[C586778] Should be possible to download a previous document version', async () => { - await viewerPage.clickDownloadButton(); + await viewerPage.toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[1])).toBe(true, 'File not found in download location'); }); }); describe('on Recent Files', () => { - beforeEach(async (done) => { + beforeEach(async () => { await page.clickRecentFilesAndWait(); await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('3.0'); - done(); }); - afterEach(async (done) => { - await viewerPage.clickCloseButton(); - done(); + afterEach(async () => { + await page.closeOpenDialogs(); + await Utils.pressEscape(); }); it('[C586769] Should be possible to view a previous document version', async () => { @@ -165,24 +165,23 @@ describe('Version actions', () => { }); it('[C586771] Should be possible to download a previous document version', async () => { - await viewerPage.clickDownloadButton(); + await viewerPage.toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[2])).toBe(true, 'File not found in download location'); }); }); describe('on Favorite Files', () => { - beforeEach(async (done) => { + beforeEach(async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('4.0'); - done(); }); - afterEach(async (done) => { - await viewerPage.clickCloseButton(); - done(); + afterEach(async () => { + await page.closeOpenDialogs(); + await Utils.pressEscape(); }); it('[C586772] Should be possible to view a previous document version', async () => { @@ -194,14 +193,14 @@ describe('Version actions', () => { }); it('[C586774] Should be possible to download a previous document version', async () => { - await viewerPage.clickDownloadButton(); + await viewerPage.toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[3])).toBe(true, 'File not found in download location'); }); }); describe('on Search Results', () => { - beforeEach(async (done) => { + beforeEach(async () => { await page.clickPersonalFiles(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); @@ -211,12 +210,11 @@ describe('Version actions', () => { await dataTable.selectItem(filesToUpload[4], parentFolder); await toolbar.clickMoreActionsManageVersions(); await versionManagePage.viewFileVersion('5.0'); - done(); }); - afterEach(async (done) => { - await viewerPage.clickCloseButton(); - done(); + afterEach(async () => { + await page.closeOpenDialogs(); + await Utils.pressEscape(); }); it('[C586779] Should be possible to view a previous document version', async () => { @@ -228,7 +226,7 @@ describe('Version actions', () => { }); it('[C586781] Should be possible to download a previous document version', async () => { - await viewerPage.clickDownloadButton(); + await viewerPage.toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[4])).toBe(true, 'File not found in download location'); }); diff --git a/e2e/suites/pagination/multiple-pages-libraries.test.ts b/e2e/suites/pagination/multiple-pages-libraries.test.ts index ca36f1bb1..58df3a3f3 100755 --- a/e2e/suites/pagination/multiple-pages-libraries.test.ts +++ b/e2e/suites/pagination/multiple-pages-libraries.test.ts @@ -42,26 +42,22 @@ describe('Pagination on multiple pages', () => { .fill('site') .map((name, index): string => `${name}-${index + 1}-${random}`); - let initialSitesTotalItems: number; - beforeAll(async () => { try { await adminApiActions.createUser({ username }); - initialSitesTotalItems = await userApi.sites.getSitesTotalItems(); await userApi.sites.createSitesPrivate(sites); - await userApi.sites.waitForApi({ expect: initialSitesTotalItems + 51 }); + await userApi.sites.waitForSitesToBeCreated(sites); await loginPage.loginWith(username); } catch (error) { Logger.error(`----- beforeAll failed : ${error}`); } - }); + }, 400000); afterAll(async () => { try { await userApi.sites.deleteSites(sites); - await userApi.sites.waitForApi({ expect: initialSitesTotalItems }); } catch (error) { Logger.error(`----- afterAll failed : ${error}`); } diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/suites/viewer/viewer-actions.test.ts index c58506be0..3af4314e5 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 { BrowserActions } from '@alfresco/adf-testing'; describe('Viewer actions', () => { const username = `user-${Utils.random()}`; @@ -252,6 +253,7 @@ describe('Viewer actions', () => { await page.waitForDialog(); await uploadNewVersionDialog.uploadButton.click(); + await uploadNewVersionDialog.waitForDialogToClose(); await toolbar.openMoreMenu(); expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); @@ -267,7 +269,7 @@ describe('Viewer actions', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen'); const browserLogAfter = await Utils.getBrowserLog(); - expect(browserLogAfter.length).toEqual(0, browserLogAfter.entries); + expect(browserLogAfter.length).toBe(0, browserLogAfter.entries); }); it('[C286313] Share action', async () => { @@ -863,7 +865,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxSharedFiles); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.shareEditButton.click(); + await BrowserActions.click(toolbar.shareEditButton); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); 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 71711551e..27e6b0843 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 @@ -190,6 +190,7 @@ export class DataTable extends Component { } async hasCheckMarkIcon(itemName: string, location: string = ''): Promise { + Logger.info(`--- check if item already selected : ${itemName} ${location}`); const row = this.getRowByName(itemName, location); return row.element(by.css('.mat-icon[class*="selected"]')).isPresent(); } @@ -235,6 +236,7 @@ export class DataTable extends Component { const isSelected = await this.hasCheckMarkIcon(name, location); if (!isSelected) { try { + Logger.info(`--- selecting item : ${name} ${location}`); const item = this.getRowFirstCell(name, location); await item.click(); } catch (e) { 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 28fc7f30a..43f2a788d 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 @@ -61,14 +61,18 @@ export class CreateFromTemplateDialog extends GenericDialog { } } - async getName(): Promise { + async getNameInputValue(): Promise { return BrowserActions.getInputValue(this.nameInput); } - async getDescription(): Promise { + async getDescriptionValue(): Promise { return BrowserActions.getInputValue(this.descriptionTextArea); } + async getTitleInputValue(): Promise { + return BrowserActions.getInputValue(this.titleInput); + } + async enterName(name: string): Promise { await typeText(this.nameInput, name); } 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 2a729bff7..163a24ab3 100644 --- a/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts @@ -60,7 +60,7 @@ export abstract class GenericDialog { return isPresentAndDisplayed(this.rootElem); } - async getTitle(): Promise { + async getDialogTitle(): Promise { return this.title.getText(); } 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 c117d99bf..870bc6e84 100755 --- a/projects/aca-testing-shared/src/components/dialog/share-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/share-dialog.ts @@ -48,7 +48,7 @@ export class ShareDialog extends GenericDialog { super('.adf-share-dialog'); } - async getTitle(): Promise { + async getDialogTitle(): Promise { return this.dialogTitle.getText(); } diff --git a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts index d20a8492a..e7a4b9865 100755 --- a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts +++ b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts @@ -82,6 +82,7 @@ export class Toolbar extends Component { await BrowserActions.click(moreMenu); await this.menu.waitForMenuToOpen(); + await browser.sleep(500); } async closeMoreMenu() { diff --git a/projects/aca-testing-shared/src/components/viewer/viewer.ts b/projects/aca-testing-shared/src/components/viewer/viewer.ts index e8ad3766a..ad0d66cc6 100755 --- a/projects/aca-testing-shared/src/components/viewer/viewer.ts +++ b/projects/aca-testing-shared/src/components/viewer/viewer.ts @@ -37,6 +37,7 @@ export class Viewer extends Component { fileTitle = this.byCss('.adf-viewer__file-title'); viewerExtensionContent = this.byCss('adf-preview-extension'); pdfViewerContentPages = this.allByCss('.adf-pdf-viewer__content .page'); + txtViewerContent = this.byCss('.adf-txt-viewer-content'); toolbar = new Toolbar('adf-viewer'); @@ -44,7 +45,7 @@ export class Viewer extends Component { super('adf-viewer', ancestor); } - async waitForViewerToOpen() { + async waitForViewerToOpen(): Promise { try { await waitForPresence(this.viewerContainer); await waitForPresence(this.viewerLayout); @@ -53,6 +54,15 @@ export class Viewer extends Component { } } + async waitForTxtViewerToLoad(): Promise { + try { + await this.waitForViewerToOpen(); + await waitForPresence(this.txtViewerContent); + } catch (error) { + Logger.error('\n-----> catch waitForTxtViewerToLoad <-----\n', error); + } + } + async isViewerOpened() { return browser.isElementPresent(this.viewerLayout); } @@ -94,11 +104,6 @@ export class Viewer extends Component { return count > 0; } - async clickDownloadButton(): Promise { - const downloadButton: ElementFinder = element(by.id(`app.viewer.download`)); - await BrowserActions.click(downloadButton); - } - async clickCloseButton(): Promise { const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]')); await BrowserActions.click(closeButton); diff --git a/protractor.conf.js b/protractor.conf.js index f94a929fa..8b0190282 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -25,6 +25,7 @@ const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true'; 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; +const LOG_LEVEL = process.env.LOG_LEVEL || 'ERROR'; const appConfig = { hostEcm: API_CONTENT_HOST, @@ -41,7 +42,12 @@ exports.config = { downloadFolder: downloadFolder, ADMIN_USERNAME: process.env.ADMIN_EMAIL || 'admin', ADMIN_PASSWORD: process.env.ADMIN_PASSWORD || 'admin', - e2eRootPath: e2eFolder + e2eRootPath: e2eFolder, + testConfig: { + appConfig: { + log: LOG_LEVEL + } + } }, specs: [ diff --git a/scripts/ci/job_hooks/before_e2e.sh b/scripts/ci/job_hooks/before_e2e.sh index 218824633..b67724988 100755 --- a/scripts/ci/job_hooks/before_e2e.sh +++ b/scripts/ci/job_hooks/before_e2e.sh @@ -8,7 +8,7 @@ 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 =====" +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