diff --git a/e2e/suites/actions-available/files-folders/folders-actions.test.ts b/e2e/suites/actions-available/files-folders/folders-actions.test.ts index d3b4a18ea..2925472d1 100755 --- a/e2e/suites/actions-available/files-folders/folders-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/folders-actions.test.ts @@ -44,8 +44,8 @@ describe('Folders - available actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -151,6 +151,7 @@ describe('Folders - available actions : ', () => { describe('on a folder', () => { beforeAll(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(random); await searchResultsPage.waitForResults(); @@ -169,6 +170,8 @@ describe('Folders - available actions : ', () => { describe('on multiple selection', () => { it('[C291821] multiple folders', async () => { + await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(random); await searchResultsPage.waitForResults(); @@ -182,6 +185,8 @@ describe('Folders - available actions : ', () => { }); it('[C291822] both files and folders', async () => { + await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`); await searchResultsPage.waitForResults(); diff --git a/e2e/suites/actions-available/files-folders/generic.test.ts b/e2e/suites/actions-available/files-folders/generic.test.ts index 4cf7cf7e5..5fe3d311c 100755 --- a/e2e/suites/actions-available/files-folders/generic.test.ts +++ b/e2e/suites/actions-available/files-folders/generic.test.ts @@ -52,7 +52,7 @@ describe('Generic tests : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; const contextMenu = dataTable.menu; beforeAll(async () => { @@ -114,44 +114,8 @@ describe('Generic tests : ', () => { }); describe('Actions are not displayed when no item is selected', () => { - it('[C213120] on Personal Files', async () => { - await page.clickPersonalFilesAndWait(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280452] on Trash', async () => { - await page.clickTrash(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280449] on Favorites', async () => { - await page.clickFavorites(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280447] on Recent Files', async () => { - await userApi.search.waitForNodes(`file-${random}`, { expect: 2 }); - - await page.clickRecentFilesAndWait(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280445] on Shared Files', async () => { - await page.clickSharedFiles(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280439] on My Libraries', async () => { - await page.goToMyLibraries(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - - it('[C280439] on Favorite Libraries', async () => { - await page.goToFavoriteLibraries(); - expect(await toolbar.isEmpty()).toBe(true, `actions displayed though nothing selected`); - }); - it('[C291815] on Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor('*'); diff --git a/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts b/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts index 2bba9cc78..8b27afc0f 100755 --- a/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/locked-files-actions.test.ts @@ -45,8 +45,8 @@ describe('Locked Files - available actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -265,6 +265,7 @@ describe('Locked Files - available actions : ', () => { describe('on Search Results : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(random); diff --git a/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts b/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts index 4a210b6ba..c51825bd0 100755 --- a/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/multiple-files-actions.test.ts @@ -52,8 +52,8 @@ describe('Multiple Files - available actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -162,6 +162,7 @@ describe('Multiple Files - available actions : ', () => { describe('on Search Results : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(random); diff --git a/e2e/suites/actions-available/files-folders/office-files-actions.test.ts b/e2e/suites/actions-available/files-folders/office-files-actions.test.ts index 5c5f892bf..8e70cfad7 100755 --- a/e2e/suites/actions-available/files-folders/office-files-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/office-files-actions.test.ts @@ -44,8 +44,8 @@ describe('Office Files - available actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -247,6 +247,7 @@ describe('Office Files - available actions : ', () => { describe('on Search Results : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(random); await searchResultsPage.waitForResults(); diff --git a/e2e/suites/actions-available/files-folders/single-file-actions.test.ts b/e2e/suites/actions-available/files-folders/single-file-actions.test.ts index 1fbb53658..f44a103a4 100755 --- a/e2e/suites/actions-available/files-folders/single-file-actions.test.ts +++ b/e2e/suites/actions-available/files-folders/single-file-actions.test.ts @@ -45,8 +45,8 @@ describe('Files - available actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -232,6 +232,7 @@ describe('Files - available actions : ', () => { describe('on Search Results : ', () => { beforeEach(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); }); diff --git a/e2e/suites/actions-available/libraries/library.test.ts b/e2e/suites/actions-available/libraries/library.test.ts index 9db4fbf35..4bb569cc9 100755 --- a/e2e/suites/actions-available/libraries/library.test.ts +++ b/e2e/suites/actions-available/libraries/library.test.ts @@ -47,7 +47,8 @@ describe('Library actions : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const searchResultsPage = new SearchResultsPage(); - const { searchInput } = searchResultsPage.header; + const { toolbar } = page; + const { searchInput } = searchResultsPage.pageLayoutHeader; beforeAll(async () => { try { @@ -246,6 +247,7 @@ describe('Library actions : ', () => { try { await Utils.pressEscape(); await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); } catch (error) { @@ -254,7 +256,7 @@ describe('Library actions : ', () => { }); it('[C290084] Public library, user is a member, favorite', async () => { - await searchInput.searchFor(testData.publicUserMemberFav.name); + await searchInput.searchForLibrary(testData.publicUserMemberFav.name); await testUtil.checkToolbarActions( testData.publicUserMemberFav.name, @@ -265,7 +267,7 @@ describe('Library actions : ', () => { }); it('[C290085] Private library, user is a member, favorite', async () => { - await searchInput.searchFor(testData.privateUserMemberFav.name); + await searchInput.searchForLibrary(testData.privateUserMemberFav.name); await testUtil.checkToolbarActions( testData.privateUserMemberFav.name, @@ -276,7 +278,7 @@ describe('Library actions : ', () => { }); it('[C290086] Moderated library, user is a member, favorite', async () => { - await searchInput.searchFor(testData.moderatedUserMemberFav.name); + await searchInput.searchForLibrary(testData.moderatedUserMemberFav.name); await testUtil.checkToolbarActions( testData.moderatedUserMemberFav.name, @@ -287,7 +289,7 @@ describe('Library actions : ', () => { }); it('[C291812] Public library, user is a member, not favorite', async () => { - await searchInput.searchFor(testData.publicUserMemberNotFav.name); + await searchInput.searchForLibrary(testData.publicUserMemberNotFav.name); await testUtil.checkToolbarActions( testData.publicUserMemberNotFav.name, @@ -298,7 +300,7 @@ describe('Library actions : ', () => { }); it('[C291813] Private library, user is a member, not favorite', async () => { - await searchInput.searchFor(testData.privateUserMemberNotFav.name); + await searchInput.searchForLibrary(testData.privateUserMemberNotFav.name); await testUtil.checkToolbarActions( testData.privateUserMemberNotFav.name, @@ -309,7 +311,7 @@ describe('Library actions : ', () => { }); it('[C291814] Moderated library, user is a member, not favorite', async () => { - await searchInput.searchFor(testData.moderatedUserMemberNotFav.name); + await searchInput.searchForLibrary(testData.moderatedUserMemberNotFav.name); await testUtil.checkToolbarActions( testData.moderatedUserMemberNotFav.name, @@ -320,7 +322,7 @@ describe('Library actions : ', () => { }); it('[C326680] Public library, user not a member, favorite', async () => { - await searchInput.searchFor(testData.publicNotMemberFav.name); + await searchInput.searchForLibrary(testData.publicNotMemberFav.name); await testUtil.checkToolbarActions( testData.publicNotMemberFav.name, @@ -331,7 +333,7 @@ describe('Library actions : ', () => { }); it('[C326681] Moderated library, user not a member, favorite', async () => { - await searchInput.searchFor(testData.moderatedNotMemberFav.name); + await searchInput.searchForLibrary(testData.moderatedNotMemberFav.name); await testUtil.checkToolbarActions( testData.moderatedNotMemberFav.name, @@ -342,7 +344,7 @@ describe('Library actions : ', () => { }); it('[C326682] Public library, user not a member, not favorite', async () => { - await searchInput.searchFor(testData.publicNotMemberNotFav.name); + await searchInput.searchForLibrary(testData.publicNotMemberNotFav.name); await testUtil.checkToolbarActions( testData.publicNotMemberNotFav.name, @@ -353,7 +355,7 @@ describe('Library actions : ', () => { }); it('[C326683] Moderated library, user not a member, not favorite', async () => { - await searchInput.searchFor(testData.moderatedNotMemberNotFav.name); + await searchInput.searchForLibrary(testData.moderatedNotMemberNotFav.name); await testUtil.checkToolbarActions( testData.moderatedNotMemberNotFav.name, @@ -364,7 +366,7 @@ describe('Library actions : ', () => { }); it('[C326685] Moderated library, user requested to join, favorite', async () => { - await searchInput.searchFor(testData.moderatedRequestedJoinFav.name); + await searchInput.searchForLibrary(testData.moderatedRequestedJoinFav.name); await testUtil.checkToolbarActions( testData.moderatedRequestedJoinFav.name, @@ -375,7 +377,7 @@ describe('Library actions : ', () => { }); it('[C326684] Moderated library, user requested to join, not favorite', async () => { - await searchInput.searchFor(testData.moderatedRequestedJoinNotFav.name); + await searchInput.searchForLibrary(testData.moderatedRequestedJoinNotFav.name); await testUtil.checkToolbarActions( testData.moderatedRequestedJoinNotFav.name, diff --git a/e2e/suites/actions-available/new-menu/new-menu.test.ts b/e2e/suites/actions-available/new-menu/new-menu.test.ts index 912fd4ca8..f0892f05d 100755 --- a/e2e/suites/actions-available/new-menu/new-menu.test.ts +++ b/e2e/suites/actions-available/new-menu/new-menu.test.ts @@ -33,7 +33,7 @@ describe('New menu', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable, sidenav } = page; + const { sidenav } = page; const { menu } = sidenav; const adminApiActions = new AdminActions(); @@ -67,11 +67,7 @@ describe('New menu', () => { await page.clickPersonalFiles(); await sidenav.openNewMenu(); - expect(await menu.isUploadFileEnabled()).toBe(true, 'Upload File option not enabled'); - expect(await menu.isUploadFolderEnabled()).toBe(true, 'Upload Folder option not enabled'); - expect(await menu.isCreateFolderEnabled()).toBe(true, 'Create Folder option not enabled'); - expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); expect(await menu.isCreateFileFromTemplateEnabled()).toBe(true, 'Create file from template is not enabled'); expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(true, 'Create folder from template is not enabled'); @@ -79,32 +75,9 @@ describe('New menu', () => { it('[C280393] Actions in File Libraries - user with enough permissions', async () => { await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteUser); await sidenav.openNewMenu(); - expect(await menu.isUploadFileEnabled()).toBe(true, 'Upload file is not enabled in File Libraries'); - expect(await menu.isUploadFolderEnabled()).toBe(true, 'Upload folder is not enabled in File Libraries'); - - expect(await menu.isCreateFolderEnabled()).toBe(true, 'Create folder is not enabled'); expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); - - expect(await menu.isCreateFileFromTemplateEnabled()).toBe(true, 'Create file from template is not enabled'); - expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(true, 'Create folder from template is not enabled'); - }); - - it('[C280397] Actions in File Libraries - user without enough permissions', async () => { - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteAdmin); - await sidenav.openNewMenu(); - - expect(await menu.isUploadFileEnabled()).toBe(false, 'Upload file is not disabled'); - expect(await menu.isUploadFolderEnabled()).toBe(false, 'Upload folder is not disabled'); - - expect(await menu.isCreateFolderEnabled()).toBe(false, 'Create folder is not disabled'); - expect(await menu.isCreateLibraryEnabled()).toBe(true, 'Create Library option not enabled'); - - expect(await menu.isCreateFileFromTemplateEnabled()).toBe(false, 'Create file from template is not disabled'); - expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(false, 'Create folder from template is not disabled'); }); it('[C216342] Enabled actions tooltips', async () => { @@ -113,39 +86,10 @@ describe('New menu', () => { let tooltip: string; - tooltip = await menu.getItemTooltip('Upload File'); - expect(tooltip).toContain('Select files to upload'); - - tooltip = await menu.getItemTooltip('Upload Folder'); - expect(tooltip).toContain('Select folders to upload'); - tooltip = await menu.getItemTooltip('Create Folder'); expect(tooltip).toContain('Create new folder'); - tooltip = await menu.getItemTooltip('Create Library'); - expect(tooltip).toContain('Create a new File Library'); - tooltip = await menu.getItemTooltip('Create file from template'); expect(tooltip).toContain('Create file from template'); }); - - it('[C280398] Disabled actions tooltips', async () => { - await page.goToMyLibrariesAndWait(); - await dataTable.doubleClickOnRowByName(siteAdmin); - await sidenav.openNewMenu(); - - let tooltip: string; - - tooltip = await menu.getItemTooltip('Upload File'); - expect(tooltip).toContain('Files cannot be uploaded whilst viewing the current items'); - - tooltip = await menu.getItemTooltip('Upload Folder'); - expect(tooltip).toContain('Folders cannot be uploaded whilst viewing the current items'); - - tooltip = await menu.getItemTooltip('Create Folder'); - expect(tooltip).toContain('Folders cannot be created whilst viewing the current items'); - - tooltip = await menu.getItemTooltip('Create file from template'); - expect(tooltip).toContain('Files cannot be created whilst viewing the current items'); - }); }); diff --git a/e2e/suites/actions-available/special-permissions/other-permissions.ts b/e2e/suites/actions-available/special-permissions/other-permissions.ts index d72c03140..b58ccad9a 100755 --- a/e2e/suites/actions-available/special-permissions/other-permissions.ts +++ b/e2e/suites/actions-available/special-permissions/other-permissions.ts @@ -28,9 +28,9 @@ import * as testData from './test-data-permissions'; import * as testUtil from '../test-util'; const page = new BrowsingPage(); -const { dataTable } = page; +const { dataTable, toolbar } = page; const searchResultsPage = new SearchResultsPage(); -const { searchInput } = searchResultsPage.header; +const { searchInput } = searchResultsPage.pageLayoutHeader; export function collaboratorTests(siteName?: string) { describe('available actions : ', () => { @@ -74,6 +74,7 @@ export function collaboratorTests(siteName?: string) { }); it('on Search Results - [C297653]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileSharedFav.name); @@ -141,6 +142,7 @@ export function collaboratorTests(siteName?: string) { }); it('file opened from Search Results - [C306992]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileDocxSharedFav.name); await searchResultsPage.waitForResults(); @@ -204,6 +206,7 @@ export function filesLockedByCurrentUser(siteName?: string) { }); it('on Search Results - [C297660]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileLockedByUser); await searchResultsPage.waitForResults(); @@ -245,6 +248,7 @@ export function filesLockedByCurrentUser(siteName?: string) { }); it('file opened from Search Results - [C306993]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileLockedByUser); await searchResultsPage.waitForResults(); @@ -310,6 +314,7 @@ export function filesLockedByOtherUser(siteName?: string) { }); it('on Search Results - [C297667]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileLockedByUser); await searchResultsPage.waitForResults(); @@ -351,6 +356,7 @@ export function filesLockedByOtherUser(siteName?: string) { }); it('file opened from Search Results - [C306994]', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(testData.fileLockedByUser); await searchResultsPage.waitForResults(); diff --git a/e2e/suites/actions-available/special-permissions/search-results.ts b/e2e/suites/actions-available/special-permissions/search-results.ts index 12a11a75e..83bbea5b2 100755 --- a/e2e/suites/actions-available/special-permissions/search-results.ts +++ b/e2e/suites/actions-available/special-permissions/search-results.ts @@ -30,7 +30,7 @@ import * as testUtil from '../test-util'; export function searchResultsTests() { const page = new BrowsingPage(); const searchResultsPage = new SearchResultsPage(); - const { searchInput } = page.header; + const { searchInput, toolbar } = page.pageLayoutHeader; describe('available actions : ', () => { beforeEach(async () => { @@ -44,6 +44,7 @@ export function searchResultsTests() { describe('on a file', () => { beforeEach(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(testData.random); @@ -138,6 +139,7 @@ export function searchResultsTests() { describe('on a folder', () => { beforeAll(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFolders(); await searchInput.searchFor(testData.random); @@ -159,6 +161,7 @@ export function searchResultsTests() { describe('of files', () => { beforeAll(async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(testData.random); @@ -210,6 +213,7 @@ export function searchResultsTests() { it('multiple folders - [C291836]', async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFolders(); await searchInput.searchFor(testData.random); @@ -224,6 +228,7 @@ export function searchResultsTests() { it('both files and folders - [C268128]', async () => { await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`); diff --git a/e2e/suites/actions-available/special-permissions/viewer.ts b/e2e/suites/actions-available/special-permissions/viewer.ts index 954c482ad..bd1488707 100755 --- a/e2e/suites/actions-available/special-permissions/viewer.ts +++ b/e2e/suites/actions-available/special-permissions/viewer.ts @@ -30,8 +30,8 @@ import * as testUtil from '../test-util'; export function viewerTests(siteName?: string) { const page = new BrowsingPage(); const searchResultsPage = new SearchResultsPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; describe('available actions : ', () => { beforeEach(async () => { @@ -228,6 +228,7 @@ export function viewerTests(siteName?: string) { describe('file opened from Search Results', () => { beforeAll(async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(testData.random); 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 779e0616a..4dc5c2f44 100755 --- a/e2e/suites/actions/create/create-file-from-template.test.ts +++ b/e2e/suites/actions/create/create-file-from-template.test.ts @@ -87,7 +87,7 @@ describe('Create file from template', () => { const page = new BrowsingPage(); const selectTemplateDialog = new SelectTemplateDialog(); const createFromTemplateDialog = new CreateFromTemplateDialog(); - const { sidenav } = page; + const { toolbar } = page; const templates: NodeContentTree = { folders: [ @@ -156,7 +156,7 @@ describe('Create file from template', () => { describe('Select Template dialog', () => { beforeEach(async () => { - await sidenav.openCreateFileFromTemplateDialog(); + await toolbar.openCreateFileFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); }); @@ -236,7 +236,7 @@ describe('Create file from template', () => { describe('Create from template dialog', () => { beforeEach(async () => { try { - await sidenav.openCreateFileFromTemplateDialog(); + await toolbar.openCreateFileFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.clickNext(); @@ -309,7 +309,7 @@ describe('Create file from template', () => { try { await page.clickPersonalFilesAndWait(); await page.dataTable.doubleClickOnRowByName(parent); - await sidenav.openCreateFileFromTemplateDialog(); + await toolbar.openCreateFileFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.clickNext(); @@ -377,7 +377,7 @@ describe('Create file from template', () => { try { await fileLibrariesPage.goToMyLibrariesAndWait(); await page.dataTable.doubleClickOnRowByName(siteName); - await sidenav.openCreateFileFromTemplateDialog(); + await toolbar.openCreateFileFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.clickNext(); 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 47d6fc589..539323973 100755 --- a/e2e/suites/actions/create/create-folder-from-template.test.ts +++ b/e2e/suites/actions/create/create-folder-from-template.test.ts @@ -113,7 +113,7 @@ describe('Create folder from template', () => { const page = new BrowsingPage(); const selectTemplateDialog = new SelectTemplateDialog(); const createFromTemplateDialog = new CreateFromTemplateDialog(); - const { sidenav } = page; + const { toolbar } = page; beforeAll(async () => { await adminApiActions.createUser({ username }); @@ -154,7 +154,7 @@ describe('Create folder from template', () => { describe('Select Template dialog', () => { beforeEach(async () => { - await sidenav.openCreateFolderFromTemplateDialog(); + await toolbar.openCreateFolderFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); }); @@ -231,7 +231,7 @@ describe('Create folder from template', () => { describe('Create from template dialog', () => { beforeEach(async () => { - await sidenav.openCreateFolderFromTemplateDialog(); + await toolbar.openCreateFolderFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.clickNext(); @@ -300,7 +300,7 @@ describe('Create folder from template', () => { beforeEach(async () => { await page.clickPersonalFilesAndWait(); await page.dataTable.doubleClickOnRowByName(parent); - await sidenav.openCreateFolderFromTemplateDialog(); + await toolbar.openCreateFolderFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.clickNext(); @@ -365,7 +365,7 @@ describe('Create folder from template', () => { beforeEach(async () => { await fileLibrariesPage.goToMyLibrariesAndWait(); await page.dataTable.doubleClickOnRowByName(siteName); - await sidenav.openCreateFolderFromTemplateDialog(); + await toolbar.openCreateFolderFromTemplateDialog(); await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.clickNext(); diff --git a/e2e/suites/actions/create/create-folder.test.ts b/e2e/suites/actions/create/create-folder.test.ts index 5a97d6055..752dfc59d 100755 --- a/e2e/suites/actions/create/create-folder.test.ts +++ b/e2e/suites/actions/create/create-folder.test.ts @@ -56,7 +56,7 @@ describe('Create folder', () => { async function openCreateFolderDialog(name: string) { await page.dataTable.doubleClickOnRowByName(name); - await page.sidenav.openCreateFolderDialog(); + await page.toolbar.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); } diff --git a/e2e/suites/actions/create/create-library.test.ts b/e2e/suites/actions/create/create-library.test.ts index 8f3a9fa5e..0909469b0 100755 --- a/e2e/suites/actions/create/create-library.test.ts +++ b/e2e/suites/actions/create/create-library.test.ts @@ -91,7 +91,7 @@ describe('Create library', () => { it('[C280024] Create Library dialog UI', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); expect(await createDialog.getDialogTitle()).toMatch('Create Library'); @@ -109,7 +109,7 @@ describe('Create library', () => { it('[C280025] Create a public library', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site1Name); await BrowserActions.click(createDialog.createButton); @@ -124,7 +124,7 @@ describe('Create library', () => { it('[C289880] Create a moderated library', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site2Name); await BrowserActions.click(createDialog.visibilityModerated); @@ -140,7 +140,7 @@ describe('Create library', () => { it('[C289881] Create a private library', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site3Name); await BrowserActions.click(createDialog.visibilityPrivate); @@ -156,7 +156,7 @@ describe('Create library', () => { it('[C289882] Create a library with a given ID and description', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site4.name); await createDialog.enterLibraryId(site4.id); @@ -175,7 +175,7 @@ describe('Create library', () => { it('[C280027] Duplicate library ID', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateSite.name); await createDialog.enterLibraryId(duplicateSite.id); @@ -187,7 +187,7 @@ describe('Create library', () => { it('[C280028] Create library using the ID of a library from the Trashcan', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(siteInTrash.name); await createDialog.enterLibraryId(siteInTrash.id); @@ -199,7 +199,7 @@ describe('Create library', () => { it('[C280029] Cancel button', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName('test site'); await createDialog.enterDescription('test description'); @@ -212,7 +212,7 @@ describe('Create library', () => { const idWithSpecialChars = ['a*a', 'a"a', 'aa', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a']; await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName('test site'); @@ -226,7 +226,7 @@ describe('Create library', () => { it('[C280030] Create 2 libraries with same name but different IDs', async () => { await page.goToMyLibrariesAndWait(); - await page.sidenav.openCreateLibraryDialog(); + await page.toolbar.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateSite.name); await createDialog.enterLibraryId(`${duplicateSite.id}-2`); diff --git a/e2e/suites/actions/library/library-actions.test.ts b/e2e/suites/actions/library/library-actions.test.ts index 5b35e552e..4a7aa7b5a 100755 --- a/e2e/suites/actions/library/library-actions.test.ts +++ b/e2e/suites/actions/library/library-actions.test.ts @@ -61,7 +61,7 @@ describe('Library actions', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); const { dataTable, toolbar } = page; - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; const confirmDialog = new ConfirmDialog(); const adminApiActions = new AdminActions(); @@ -112,9 +112,10 @@ describe('Library actions', () => { }); it('[C306959] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchPublic1Admin); + await searchInput.searchForLibrary(siteSearchPublic1Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic1Admin); await BrowserActions.click(toolbar.joinButton); @@ -145,9 +146,10 @@ describe('Library actions', () => { }); it('[C306960] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchModerated1Admin); + await searchInput.searchForLibrary(siteSearchModerated1Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchModerated1Admin); await BrowserActions.click(toolbar.joinButton); @@ -203,9 +205,10 @@ describe('Library actions', () => { }); it('[C306961] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchPublic2Admin); + await searchInput.searchForLibrary(siteSearchPublic2Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic2Admin); @@ -278,9 +281,10 @@ describe('Library actions', () => { }); it('[C306962] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchModerated2Admin); + await searchInput.searchForLibrary(siteSearchModerated2Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchModerated2Admin); @@ -313,9 +317,10 @@ describe('Library actions', () => { }); it('[C306963] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchPublic3Admin); + await searchInput.searchForLibrary(siteSearchPublic3Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic3Admin); @@ -366,9 +371,10 @@ describe('Library actions', () => { }); it('[C306964] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchPublic4Admin); + await searchInput.searchForLibrary(siteSearchPublic4Admin); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic4Admin); @@ -408,9 +414,10 @@ describe('Library actions', () => { }); it('[C306965] from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteSearchForDelete); + await searchInput.searchForLibrary(siteSearchForDelete); await dataTable.waitForBody(); await dataTable.selectItem(siteSearchForDelete); 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 dedf1b429..1399f8fe3 100755 --- a/e2e/suites/actions/share/unshare-file-search-results.test.ts +++ b/e2e/suites/actions/share/unshare-file-search-results.test.ts @@ -124,6 +124,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C306995] Unshare dialog UI', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file1); @@ -144,6 +145,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C306996] Unshare a file', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file2); @@ -170,6 +172,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C306997] Cancel the Unshare action', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file3); @@ -193,6 +196,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C306999] Unshare a file from the context menu', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file4); @@ -220,6 +224,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C306998] Consumer - on Search Results - file shared by other user', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSite1); @@ -239,6 +244,7 @@ describe('Unshare a file from Search Results', () => { }); it('[C307000] Consumer - on Search Results - file shared by the user', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSite2); diff --git a/e2e/suites/actions/upload-download/upload-file.test.ts b/e2e/suites/actions/upload-download/upload-file.test.ts index 4edc389c5..0295b5737 100755 --- a/e2e/suites/actions/upload-download/upload-file.test.ts +++ b/e2e/suites/actions/upload-download/upload-file.test.ts @@ -54,9 +54,9 @@ describe('Upload files', () => { beforeEach(async () => { await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(folder1); - await page.sidenav.openNewMenu(); - await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/upload-file.test.ts`); - await page.sidenav.closeNewMenu(); + await page.toolbar.openUploadMenu(); + await page.toolbar.menu.uploadFilesInput.sendKeys(`${__dirname}/upload-file.test.ts`); + await page.toolbar.closeUploadMenu(); await page.uploadFilesDialog.uploadDialog.isVisible(); }); 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 7a53c2dd4..7a2d8f99a 100755 --- a/e2e/suites/actions/upload-download/upload-new-version.test.ts +++ b/e2e/suites/actions/upload-download/upload-new-version.test.ts @@ -95,7 +95,7 @@ describe('Upload new version', () => { const searchResultsPage = new SearchResultsPage(); const { dataTable, toolbar } = page; const uploadNewVersionDialog = new UploadNewVersionDialog(); - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; const adminActions = new AdminActions(); const userActions = new UserActions(); @@ -141,6 +141,7 @@ describe('Upload new version', () => { }); it('[C307003] dialog UI defaults', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file); @@ -160,6 +161,7 @@ describe('Upload new version', () => { }); it('[C307004] file is updated after uploading a new version - major', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSearch1); @@ -182,6 +184,7 @@ describe('Upload new version', () => { }); it('[C307005] file is updated after uploading a new version - minor', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSearch2); @@ -204,6 +207,7 @@ describe('Upload new version', () => { }); it('[C307006] file is not updated when clicking Cancel', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSearch3); @@ -224,6 +228,7 @@ describe('Upload new version', () => { }); it('[C307007] upload new version fails when new file name already exists', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileSearch4); @@ -247,6 +252,7 @@ describe('Upload new version', () => { }); it('[C307008] file is unlocked after uploading a new version', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileLockedSearch1); @@ -270,6 +276,7 @@ describe('Upload new version', () => { }); it('[C307009] file remains locked after canceling of uploading a new version', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileLockedSearch2); diff --git a/e2e/suites/actions/upload-download/version-actions.test.ts b/e2e/suites/actions/upload-download/version-actions.test.ts index 0dd185d2b..4e902f057 100644 --- a/e2e/suites/actions/upload-download/version-actions.test.ts +++ b/e2e/suites/actions/upload-download/version-actions.test.ts @@ -121,7 +121,7 @@ describe('Version actions', () => { }); it('[C586768] Should be possible to download a previous document version', async () => { - await viewerPage.toolbar.downloadButton.click(); + await viewerPage.toolbar.viewerDownloadButton.click(); expect(await Utils.fileExistsOnOS(filesToUpload[0])).toBe(true, 'File not found in download location'); }); diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/suites/application/page-titles.test.ts index 2d9b2695f..a76136f72 100755 --- a/e2e/suites/application/page-titles.test.ts +++ b/e2e/suites/application/page-titles.test.ts @@ -41,12 +41,13 @@ const PAGE_TITLES = { describe('Page titles', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); + const { toolbar } = page; const username = `user-${Utils.random()}`; const apis = new RepoClient(username, username); const adminApiActions = new AdminActions(); const file = `file-${Utils.random()}.txt`; let fileId: string; - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; beforeAll(async () => { await adminApiActions.createUser({ username }); @@ -125,6 +126,7 @@ describe('Page titles', () => { }); it('[C280413] Search Results page', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(file); expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH); diff --git a/e2e/suites/extensions/ext-viewer.test.ts b/e2e/suites/extensions/ext-viewer.test.ts index af3784909..93690acac 100755 --- a/e2e/suites/extensions/ext-viewer.test.ts +++ b/e2e/suites/extensions/ext-viewer.test.ts @@ -141,7 +141,7 @@ describe('Extensions - Viewer', () => { await page.dataTable.doubleClickOnRowByName(pdfFile.fileName); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.openMoreMenu(); + await toolbar.openViewerMoreMenu(); expect(await toolbar.menu.isMenuItemPresent(customSecondaryAction.title)).toBe(true, 'action is not present'); expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon); expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id); @@ -151,7 +151,7 @@ describe('Extensions - Viewer', () => { await page.dataTable.doubleClickOnRowByName(pdfFile.fileName); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.openMoreMenu(); + await toolbar.openViewerMoreMenu(); expect(await BrowserActions.getAttribute(toolbar.menu.getItemById(moveAction.id), 'title')).toEqual(moveAction.title); }); @@ -159,7 +159,7 @@ describe('Extensions - Viewer', () => { await page.dataTable.doubleClickOnRowByName(pdfFile.fileName); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.openMoreMenu(); + await toolbar.openViewerMoreMenu(); expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed'); }); }); diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts index e59e5db9f..d568c0e33 100755 --- a/e2e/suites/list-views/empty-list.test.ts +++ b/e2e/suites/list-views/empty-list.test.ts @@ -29,8 +29,8 @@ describe('Empty list views', () => { const username = `user-${Utils.random()}`; const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable, pagination } = page; - const { searchInput } = page.header; + const { dataTable, pagination, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const adminApiActions = new AdminActions(); beforeAll(async () => { @@ -135,6 +135,7 @@ describe('Empty list views', () => { }); it('[C290123] Search results - pagination controls not displayed', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); /* cspell:disable-next-line */ await searchInput.searchFor('qwertyuiop'); @@ -149,10 +150,12 @@ describe('Empty list views', () => { }); it('[C290020] Empty Search results - Libraries', async () => { + await page.goToMyLibraries(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); /* cspell:disable-next-line */ - await searchInput.searchFor('qwertyuiop'); + await searchInput.searchForLibrary('qwertyuiop'); await dataTable.waitForBody(); expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); @@ -160,6 +163,8 @@ describe('Empty list views', () => { }); it('[C290031] Empty Search results - Files / Folders', async () => { + await page.clickPersonalFiles(); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); /* cspell:disable-next-line */ diff --git a/e2e/suites/list-views/permissions.test.ts b/e2e/suites/list-views/permissions.test.ts index 21b0496ec..75eb5addc 100755 --- a/e2e/suites/list-views/permissions.test.ts +++ b/e2e/suites/list-views/permissions.test.ts @@ -34,8 +34,8 @@ describe('Special permissions', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; - const { searchInput } = page.header; + const { dataTable, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const adminApiActions = new AdminActions(); const userActions = new UserActions(); @@ -102,6 +102,7 @@ describe('Special permissions', () => { }); it('[C290122] on Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileName); @@ -164,6 +165,7 @@ describe('Special permissions', () => { }); it('[C306868] on Search results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileName); diff --git a/e2e/suites/navigation/sidebar.test.ts b/e2e/suites/navigation/sidebar.test.ts index c3137f192..e8fc2fa70 100755 --- a/e2e/suites/navigation/sidebar.test.ts +++ b/e2e/suites/navigation/sidebar.test.ts @@ -29,9 +29,9 @@ import { APP_ROUTES, SIDEBAR_LABELS, LoginPage, BrowsingPage, SearchResultsPage, describe('Sidebar', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { sidenav, header } = page; + const { sidenav, toolbar } = page; const searchResultsPage = new SearchResultsPage(); - const { searchInput } = searchResultsPage.header; + const { searchInput } = searchResultsPage.pageLayoutHeader; beforeAll(async () => { await loginPage.loginWithAdmin(); @@ -39,7 +39,12 @@ describe('Sidebar', () => { beforeEach(async () => { await Utils.pressEscape(); - await header.expandSideNav(); + await sidenav.expandSideNav(); + }); + + afterEach(async () => { + await Utils.pressEscape(); + await page.clickPersonalFiles(); }); it('[C217149] has "Personal Files" as default', async () => { @@ -125,62 +130,65 @@ describe('Sidebar', () => { }); it('[C269095] default state is expanded', async () => { - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); }); it('[C269096] sidebar toggle', async () => { - await header.collapseSideNav(); - expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); + await sidenav.collapseSideNav(); + expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); - await header.expandSideNav(); - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + await sidenav.expandSideNav(); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); }); it('[C269100] sidebar state is preserved on page refresh', async () => { - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); await page.refresh(); - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); - await header.collapseSideNav(); - expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); + await sidenav.collapseSideNav(); + expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); await page.refresh(); - expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); + expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); }); it('[C269102] sidebar state is preserved after logout / login', async () => { - await header.collapseSideNav(); + await sidenav.collapseSideNav(); await page.signOut(); await loginPage.loginWithAdmin(); - expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); + expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); }); it('[C277223] sidebar is collapsed automatically when Search Results opens', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); /* cspell:disable-next-line */ await searchInput.searchFor('qwertyuiop'); await searchResultsPage.waitForResults(); - expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); + expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); }); it('[C277224] sidenav returns to the default state when navigating away from the Search Results page', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); /* cspell:disable-next-line */ await searchInput.searchFor('qwertyuiop'); await searchResultsPage.waitForResults(); await page.clickFavorites(); - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); }); it('[C277230] sidenav can be expanded when search results page is displayed', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); /* cspell:disable-next-line */ await searchInput.searchFor('qwertyuiop'); await searchResultsPage.waitForResults(); - await header.expandSideNav(); + await sidenav.expandSideNav(); - expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); + expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); }); }); diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/suites/navigation/single-click.test.ts index 893df74c1..5f7df9e03 100755 --- a/e2e/suites/navigation/single-click.test.ts +++ b/e2e/suites/navigation/single-click.test.ts @@ -47,9 +47,9 @@ describe('Single click on item name', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable, breadcrumb } = page; + const { dataTable, breadcrumb, toolbar } = page; const viewer = new Viewer(); - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; const adminApiActions = new AdminActions(); const userActions = new UserActions(); @@ -207,6 +207,7 @@ describe('Single click on item name', () => { describe('on Search Results', () => { beforeEach(async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); }); diff --git a/e2e/suites/pagination/search-results.ts b/e2e/suites/pagination/search-results.ts index 0e32dd813..0afd0449f 100755 --- a/e2e/suites/pagination/search-results.ts +++ b/e2e/suites/pagination/search-results.ts @@ -28,12 +28,13 @@ import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; export function searchResultsTests(username: string, random: string) { const page = new BrowsingPage(); const loginPage = new LoginPage(); - const { dataTable, pagination } = page; - const { searchInput } = page.header; + const { dataTable, pagination, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; describe('Pagination controls : ', () => { beforeAll(async () => { await loginPage.loginWith(username); + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(random); diff --git a/e2e/suites/pagination/single-page.test.ts b/e2e/suites/pagination/single-page.test.ts index d94da5634..6d8ae3723 100755 --- a/e2e/suites/pagination/single-page.test.ts +++ b/e2e/suites/pagination/single-page.test.ts @@ -44,8 +44,8 @@ describe('Pagination on single page', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { pagination } = page; - const { searchInput } = page.header; + const { pagination, toolbar } = page; + const { searchInput } = page.pageLayoutHeader; const searchResultsPage = new SearchResultsPage(); beforeAll(async () => { @@ -116,6 +116,7 @@ describe('Pagination on single page', () => { }); it('[C290124] page selector not displayed on Search results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(file); await searchResultsPage.waitForResults(); diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts index 6ffb3befa..a4792476e 100644 --- a/e2e/suites/search/search-filters.test.ts +++ b/e2e/suites/search/search-filters.test.ts @@ -75,8 +75,8 @@ describe('Search filters', () => { const loginPage = new LoginPage(); const page = new SearchResultsPage(); - const { searchInput } = page.header; - const { dataTable, filters } = page; + const { searchInput } = page.pageLayoutHeader; + const { dataTable, filters, toolbar } = page; const sizeFilter = filters.size; const fileTypeFilter = filters.fileType; @@ -108,7 +108,7 @@ describe('Search filters', () => { beforeEach(async () => { await Utils.pressEscape(); await page.clickPersonalFilesAndWait(); - + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(`search-filters-${random}`); await dataTable.waitForBody(); diff --git a/e2e/suites/search/search-input.test.ts b/e2e/suites/search/search-input.test.ts index ef0206fa0..8825169c0 100644 --- a/e2e/suites/search/search-input.test.ts +++ b/e2e/suites/search/search-input.test.ts @@ -28,7 +28,8 @@ import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; describe('Search input', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { searchInput } = page.header; + const { toolbar } = page; + const { searchInput } = page.pageLayoutHeader; beforeAll(async () => { await loginPage.loginWithAdmin(); @@ -39,11 +40,15 @@ describe('Search input', () => { await page.clickPersonalFiles(); }); - it('[C289847] Search input is displayed in the app header', async () => { + it('[C289847] Search icon is displayed in toolbar and clicking on it displays search input container', async () => { + await toolbar.clickSearchIconButton(); + await searchInput.clickSearchButton(); + expect(await searchInput.isSearchContainerDisplayed()).toBe(true, 'search controls not displayed'); }); it('[C289848] Search options are displayed when clicking in the search input', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed'); expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled'); @@ -55,6 +60,7 @@ describe('Search input', () => { }); it('[C289849] Search options are correctly enabled / disabled', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.clickFilesOption(); diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts index f17f77bfc..cbaa476c0 100644 --- a/e2e/suites/search/search-results-files-folders.test.ts +++ b/e2e/suites/search/search-results-files-folders.test.ts @@ -52,8 +52,8 @@ describe('Search results - files and folders', () => { const loginPage = new LoginPage(); const page = new SearchResultsPage(); - const { searchInput } = page.header; - const { dataTable, breadcrumb } = page; + const { searchInput } = page.pageLayoutHeader; + const { dataTable, breadcrumb, toolbar } = page; const adminApiActions = new AdminActions(); beforeAll(async () => { @@ -73,6 +73,7 @@ describe('Search results - files and folders', () => { beforeEach(async () => { await page.refresh(); + await page.clickPersonalFilesAndWait(); }); afterAll(async () => { @@ -84,16 +85,8 @@ describe('Search results - files and folders', () => { ]); }); - it('[C307002] Results page title', async () => { - await searchInput.clickSearchButton(); - await searchInput.checkFilesAndFolders(); - await searchInput.searchFor(random); - await dataTable.waitForBody(); - - expect(await page.breadcrumb.currentItem.getText()).toEqual('Search Results'); - }); - it('[C279183] File information', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(random); @@ -115,6 +108,7 @@ describe('Search results - files and folders', () => { }); it('[C306867] Folder information', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(random); @@ -134,6 +128,7 @@ describe('Search results - files and folders', () => { }); it('[C290029] Search file with special characters', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(fileRussian); @@ -143,6 +138,7 @@ describe('Search results - files and folders', () => { }); it('[C279177] Location column redirect - file in user Home', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(file); diff --git a/e2e/suites/search/search-results-general.test.ts b/e2e/suites/search/search-results-general.test.ts index c500eec94..c5ba852f5 100644 --- a/e2e/suites/search/search-results-general.test.ts +++ b/e2e/suites/search/search-results-general.test.ts @@ -42,7 +42,7 @@ describe('Search results general', () => { const loginPage = new LoginPage(); const page = new SearchResultsPage(); - const { searchInput } = page.header; + const { searchInput, toolbar } = page.pageLayoutHeader; const dataTable = page.dataTable; const adminApiActions = new AdminActions(); @@ -67,7 +67,13 @@ describe('Search results general', () => { await page.refresh(); }); + afterEach(async () => { + await Utils.pressEscape(); + await page.clickPersonalFiles(); + }); + it('[C290005] Only files are returned when Files option is the only one checked', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFiles(); await searchInput.searchFor(random); @@ -79,6 +85,7 @@ describe('Search results general', () => { }); it('[C290006] Only folders are returned when Folders option is the only one checked', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkOnlyFolders(); await searchInput.searchFor(random); @@ -90,6 +97,7 @@ describe('Search results general', () => { }); it('[C290007] Files and folders are returned when both Files and Folders options are checked', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(random); @@ -101,9 +109,10 @@ describe('Search results general', () => { }); it('[C290008] Only libraries are returned when Libraries option is checked', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(random); + await searchInput.searchForLibrary(random); await page.waitForResults(); expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); @@ -112,6 +121,7 @@ describe('Search results general', () => { }); it('[C279162] Results are updated automatically when changing the search term', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(file); await page.waitForResults(); @@ -121,15 +131,17 @@ describe('Search results general', () => { await searchInput.clickSearchButton(); await searchInput.searchFor(folder); + await page.waitForResults(); expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not displayed`); }); it('[C279178] Results are returned when accessing an URL containing a search query', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(site); + await searchInput.searchForLibrary(site); await page.waitForResults(); expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`); diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts index 7b1aace78..2a1b47db4 100644 --- a/e2e/suites/search/search-results-libraries.test.ts +++ b/e2e/suites/search/search-results-libraries.test.ts @@ -70,7 +70,7 @@ describe('Search results - libraries', () => { const loginPage = new LoginPage(); const page = new SearchResultsPage(); - const { searchInput } = page.header; + const { searchInput, toolbar } = page.pageLayoutHeader; const dataTable = page.dataTable; const adminApiActions = new AdminActions(); @@ -137,9 +137,10 @@ describe('Search results - libraries', () => { }); it('[C290012] Search library - full name match', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(site1.name); + await searchInput.searchForLibrary(site1.name); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`); @@ -149,9 +150,10 @@ describe('Search results - libraries', () => { }); it('[C290013] Search library - partial name match', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(`lib-${random}`); + await searchInput.searchForLibrary(`lib-${random}`); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`); @@ -161,9 +163,10 @@ describe('Search results - libraries', () => { }); it('[C290014] Search library - description match', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(site4.description); + await searchInput.searchForLibrary(site4.description); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(site1.name)).toBe(false, `${site1.name} displayed`); @@ -173,18 +176,20 @@ describe('Search results - libraries', () => { }); it('[C290015] Results page title', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(random); + await searchInput.searchForLibrary(random); await dataTable.waitForBody(); expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...'); }); it('[C290016] Results page columns', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(site1.name); + await searchInput.searchForLibrary(site1.name); await dataTable.waitForBody(); const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; @@ -194,9 +199,10 @@ describe('Search results - libraries', () => { }); it('[C290017] Library visibility is correctly displayed', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(`user-site-${random}`); + await searchInput.searchForLibrary(`user-site-${random}`); await dataTable.waitForBody(); const expectedSitesVisibility = { @@ -213,9 +219,10 @@ describe('Search results - libraries', () => { }); it('[C290018] User role is correctly displayed', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(`admin-${random}-site`); + await searchInput.searchForLibrary(`admin-${random}-site`); await dataTable.waitForBody(); const expectedSitesRoles = { @@ -233,18 +240,20 @@ describe('Search results - libraries', () => { }); it('[C290019] Private sites are not displayed when user is not a member', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(`admin-${random}-site`); + await searchInput.searchForLibrary(`admin-${random}-site`); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(adminPrivate)).toBe(false, `${adminPrivate} is displayed`); }); it('[C290028] Search libraries with special characters', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkLibraries(); - await searchInput.searchFor(siteRussian.name); + await searchInput.searchForLibrary(siteRussian.name); await dataTable.waitForBody(); expect(await dataTable.isItemPresent(siteRussian.name)).toBe(true, `${siteRussian.name} not displayed`); diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts index aaddb9f01..a53d3c5d3 100644 --- a/e2e/suites/search/search-sorting.test.ts +++ b/e2e/suites/search/search-sorting.test.ts @@ -53,8 +53,8 @@ describe('Search sorting', () => { const loginPage = new LoginPage(); const page = new SearchResultsPage(); - const { searchInput } = page.header; - const { dataTable } = page; + const { searchInput } = page.pageLayoutHeader; + const { dataTable, toolbar } = page; const adminApiActions = new AdminActions(); beforeAll(async () => { @@ -75,7 +75,7 @@ describe('Search sorting', () => { beforeEach(async () => { await Utils.pressEscape(); await page.clickPersonalFilesAndWait(); - + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.searchFor(`search sort ${random}`); await dataTable.waitForBody(); diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts index 3e9e2a60d..76ddf8451 100755 --- a/e2e/suites/viewer/viewer-general.test.ts +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -50,9 +50,9 @@ describe('Viewer general', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable } = page; + const { dataTable, toolbar } = page; const viewer = new Viewer(); - const { searchInput } = page.header; + const { searchInput } = page.pageLayoutHeader; const adminApiActions = new AdminActions(); const userActions = new UserActions(); @@ -183,6 +183,7 @@ describe('Viewer general', () => { }); it('[C279175] Viewer opens for a file from Search Results', async () => { + await toolbar.clickSearchIconButton(); await searchInput.clickSearchButton(); await searchInput.checkFilesAndFolders(); await searchInput.searchFor(xlsxFile); diff --git a/projects/aca-content/src/lib/components/header/header.component.scss b/projects/aca-content/src/lib/components/header/header.component.scss deleted file mode 100644 index 4e28945db..000000000 --- a/projects/aca-content/src/lib/components/header/header.component.scss +++ /dev/null @@ -1,17 +0,0 @@ -.app-header { - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.02), 0 6px 10px 0 rgba(0, 0, 0, 0.014), 0 1px 18px 0 rgba(0, 0, 0, 0.012); - z-index: 2; - - .mat-toolbar { - background-image: var(--header-background-image) !important; - background-repeat: no-repeat !important; - - .aca-current-user { - color: var(--theme-foreground-text-color) !important; - } - - .adf-toolbar-divider div { - background-color: var(--theme-foreground-text-color) !important; - } - } -} diff --git a/projects/aca-content/src/lib/components/header/header.component.spec.ts b/projects/aca-content/src/lib/components/header/header.component.spec.ts deleted file mode 100644 index 9c3fb7a27..000000000 --- a/projects/aca-content/src/lib/components/header/header.component.spec.ts +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2020 Alfresco Software Limited - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -import { AppHeaderComponent } from './header.component'; -import { AppState } from '@alfresco/aca-shared/store'; -import { of } from 'rxjs'; -import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; -import { ContentActionRef } from '@alfresco/adf-extensions'; -import { Store } from '@ngrx/store'; -import { AppTestingModule } from '../../testing/app-testing.module'; -import { AppExtensionService, SharedToolbarModule } from '@alfresco/aca-shared'; -import { CoreModule, SidenavLayoutComponent } from '@alfresco/adf-core'; -import { AppSearchInputModule } from '../search/search-input.module'; -import { By } from '@angular/platform-browser'; - -describe('AppHeaderComponent', () => { - let component: AppHeaderComponent; - let fixture: ComponentFixture; - - const actions = [ - { id: 'action-1', type: 'button' }, - { id: 'action-2', type: 'button' } - ] as Array; - - const store = { - select: jasmine.createSpy('select'), - dispatch: () => {} - } as any; - - const appExtensionService = { - getHeaderActions: () => of(actions) - } as any; - - const app = { - appName: 'name', - logoPath: 'some/path' - } as AppState; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule, CoreModule.forChild(), AppSearchInputModule, SharedToolbarModule], - declarations: [AppHeaderComponent], - providers: [ - { - provide: AppExtensionService, - useValue: appExtensionService - }, - { - provide: Store, - useValue: store - } - ] - }); - - store.select.and.callFake((memoizeFn) => of(memoizeFn({ app }))); - - fixture = TestBed.createComponent(AppHeaderComponent); - component = fixture.componentInstance; - }); - - it('should set header color, header text color, name and logo', fakeAsync(() => { - component.appName$.subscribe((val) => expect(val).toBe(app.appName)); - component.logo$.subscribe((val) => expect(val).toBe(app.logoPath)); - })); - - it('should get header actions', fakeAsync(() => { - component.ngOnInit(); - tick(); - expect(component.actions).toEqual(actions); - })); - - it('should minimize sidenav on toggle sidenav click', () => { - const layout = TestBed.createComponent(SidenavLayoutComponent); - const mockData: any = { layout: layout.componentInstance, isMenuMinimized: true }; - component.data = mockData; - - const toggleMenuSpy = spyOn(component.data.layout, 'toggleMenu'); - component.onToggleSidenav(true); - - expect(toggleMenuSpy).toHaveBeenCalled(); - expect(component.isSidenavExpanded).toBe(false); - }); - - describe('Search input', () => { - beforeEach(() => { - localStorage.clear(); - }); - - afterEach(() => { - localStorage.clear(); - }); - - it('should search be present when contentService is enabled', () => { - fixture.detectChanges(); - const searchInput = fixture.debugElement.query(By.css('.aca-search-input')); - - expect(searchInput).not.toBeNull(); - }); - - it('should search not be present when contentService is disabled', () => { - localStorage.setItem('contentService', 'false'); - fixture.detectChanges(); - const searchInput = fixture.debugElement.query(By.css('.aca-search-input')); - - expect(searchInput).toBeNull(); - }); - }); -}); - diff --git a/projects/aca-content/src/lib/components/layout/app-layout/app-layout.component.spec.ts b/projects/aca-content/src/lib/components/layout/app-layout/app-layout.component.spec.ts deleted file mode 100644 index 4c385cb22..000000000 --- a/projects/aca-content/src/lib/components/layout/app-layout/app-layout.component.spec.ts +++ /dev/null @@ -1,221 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2020 Alfresco Software Limited - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; -import { FileModel, UploadService } from '@alfresco/adf-content-services'; -import { AppLayoutComponent } from './app-layout.component'; -import { AppTestingModule } from '../../../testing/app-testing.module'; -import { Store } from '@ngrx/store'; -import { AppStore, SetSelectedNodesAction, ResetSelectionAction } from '@alfresco/aca-shared/store'; -import { Router, NavigationStart } from '@angular/router'; -import { of, Subject } from 'rxjs'; -import { By } from '@angular/platform-browser'; - -class MockRouter { - private url = 'some-url'; - private subject = new Subject(); - events = this.subject.asObservable(); - routerState = { snapshot: { url: this.url } }; - - navigateByUrl(url: string) { - const navigationStart = new NavigationStart(0, url); - this.subject.next(navigationStart); - } -} - -describe('AppLayoutComponent', () => { - let fixture: ComponentFixture; - let component: AppLayoutComponent; - let appConfig: AppConfigService; - let userPreference: UserPreferencesService; - let store: Store; - let router: Router; - let uploadService: UploadService; - let fakeFileList: FileModel[]; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule], - providers: [ - Store, - { - provide: Router, - useClass: MockRouter - } - ], - declarations: [AppLayoutComponent], - schemas: [NO_ERRORS_SCHEMA] - }); - - fixture = TestBed.createComponent(AppLayoutComponent); - component = fixture.componentInstance; - appConfig = TestBed.inject(AppConfigService); - store = TestBed.inject(Store); - router = TestBed.inject(Router); - userPreference = TestBed.inject(UserPreferencesService); - - fakeFileList = [new FileModel(new File([], 'fakeFile'))]; - - uploadService = TestBed.inject(UploadService); - }); - - beforeEach(() => { - appConfig.config.languages = []; - appConfig.config.locale = 'en'; - }); - - describe('sidenav state', () => { - it('should get state from configuration', () => { - appConfig.config.sideNav = { - expandedSidenav: false, - preserveState: false - }; - - fixture.detectChanges(); - - expect(component.expandedSidenav).toBe(false); - }); - - it('should resolve state to true is no configuration', () => { - appConfig.config.sidenav = {}; - - fixture.detectChanges(); - - expect(component.expandedSidenav).toBe(true); - }); - - it('should get state from user settings as true', () => { - appConfig.config.sideNav = { - expandedSidenav: false, - preserveState: true - }; - - spyOn(userPreference, 'get').and.callFake((key) => { - if (key === 'expandedSidenav') { - return 'true'; - } - return 'false'; - }); - - fixture.detectChanges(); - - expect(component.expandedSidenav).toBe(true); - }); - - it('should get state from user settings as false', () => { - appConfig.config.sidenav = { - expandedSidenav: false, - preserveState: true - }; - - spyOn(userPreference, 'get').and.callFake((key) => { - if (key === 'expandedSidenav') { - return 'false'; - } - return 'true'; - }); - - fixture.detectChanges(); - - expect(component.expandedSidenav).toBe(false); - }); - }); - - it('should reset selection before navigation', () => { - const selection: any[] = [{ entry: { id: 'nodeId', name: 'name' } }]; - spyOn(store, 'dispatch').and.stub(); - fixture.detectChanges(); - store.dispatch(new SetSelectedNodesAction(selection)); - router.navigateByUrl('somewhere/over/the/rainbow'); - fixture.detectChanges(); - - expect(store.dispatch['calls'].mostRecent().args).toEqual([new ResetSelectionAction()]); - }); - - it('should close menu on mobile screen size', () => { - component.minimizeSidenav = false; - component.layout.container = { - isMobileScreenSize: true, - toggleMenu: () => {} - }; - - spyOn(component.layout.container, 'toggleMenu'); - fixture.detectChanges(); - - component.hideMenu({ preventDefault: () => {} } as any); - - expect(component.layout.container.toggleMenu).toHaveBeenCalled(); - }); - - it('should close menu on mobile screen size also when minimizeSidenav true', () => { - fixture.detectChanges(); - component.minimizeSidenav = true; - component.layout.container = { - isMobileScreenSize: true, - toggleMenu: () => {} - }; - - spyOn(component.layout.container, 'toggleMenu'); - fixture.detectChanges(); - - component.hideMenu({ preventDefault: () => {} } as any); - - expect(component.layout.container.toggleMenu).toHaveBeenCalled(); - }); - - describe('File Uploading Dialog', () => { - it('should the uploading file dialog be visible on the left when the showFileUploadingDialog is true', async () => { - fixture.detectChanges(); - await fixture.whenStable(); - - uploadService.addToQueue(...fakeFileList); - fixture.detectChanges(); - await fixture.whenStable(); - - const fileUploadingDialog = fixture.debugElement.query(By.css('adf-file-uploading-dialog')); - - expect(fileUploadingDialog.attributes['position']).toEqual('left'); - expect(component.showFileUploadingDialog).toEqual(true); - expect(fileUploadingDialog).not.toEqual(null); - }); - - it('should the uploading file dialog not be visible when the showFileUploadingDialog is false', async () => { - spyOn(store, 'select').and.returnValue(of(false)); - fixture.detectChanges(); - await fixture.whenStable(); - - uploadService.addToQueue(...fakeFileList); - fixture.detectChanges(); - await fixture.whenStable(); - - const fileUploadingDialog = fixture.debugElement.query(By.css('adf-file-uploading-dialog')); - - expect(component.showFileUploadingDialog).toEqual(false); - expect(fileUploadingDialog).toEqual(null); - }); - }); -}); diff --git a/projects/aca-testing-shared/src/components/components.ts b/projects/aca-testing-shared/src/components/components.ts index 9407625f5..75111b389 100755 --- a/projects/aca-testing-shared/src/components/components.ts +++ b/projects/aca-testing-shared/src/components/components.ts @@ -25,6 +25,7 @@ export * from './login/login'; export * from './header/header'; +export * from './pageLayoutHeader/pageLayoutHeader'; export * from './header/user-info'; export * from './data-table/data-table'; export * from './dialog/confirm-dialog'; diff --git a/projects/aca-testing-shared/src/components/pageLayoutHeader/pageLayoutHeader.ts b/projects/aca-testing-shared/src/components/pageLayoutHeader/pageLayoutHeader.ts new file mode 100644 index 000000000..98c51b39d --- /dev/null +++ b/projects/aca-testing-shared/src/components/pageLayoutHeader/pageLayoutHeader.ts @@ -0,0 +1,76 @@ +/*! + * @license + * Alfresco Example Content Application + * + * Copyright (C) 2005 - 2020 Alfresco Software Limited + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +import { by, browser } from 'protractor'; +import { Component } from '../component'; +import { Menu } from '../menu/menu'; +import { Toolbar } from '../toolbar/toolbar'; +import { SearchInput } from '../search/search-input'; +import { waitElement } from '../../utilities/utils'; +import { BrowserActions } from '@alfresco/adf-testing'; + +export class PageLayoutHeader extends Component { + logoLink = this.byCss('.app-menu__title'); + moreActions = browser.element(by.id('app.header.more')); + sidenavToggle = this.byCss(`.sidenav-header-title-logo`); + + menu = new Menu(); + toolbar = new Toolbar(); + searchInput = new SearchInput(); + + constructor(ancestor?: string) { + super('aca-page-layout', ancestor); + } + + async openMoreMenu(): Promise { + await BrowserActions.click(this.moreActions); + await this.menu.waitForMenuToOpen(); + } + + async closeMoreMenu(): Promise { + await BrowserActions.click(this.moreActions); + await this.menu.waitForMenuToClose(); + } + + async isSidenavExpanded(): Promise { + return browser.isElementPresent(by.css(`[data-automation-id='expanded']`)); + } + + async expandSideNav(): Promise { + const expanded = await this.isSidenavExpanded(); + if (!expanded) { + await BrowserActions.click(this.sidenavToggle); + await waitElement(`[data-automation-id='expanded']`); + } + } + + async collapseSideNav(): Promise { + const expanded = await this.isSidenavExpanded(); + if (expanded) { + await BrowserActions.click(this.sidenavToggle); + await waitElement(`[data-automation-id='collapsed']`); + } + } +} diff --git a/projects/aca-testing-shared/src/components/search/search-input.ts b/projects/aca-testing-shared/src/components/search/search-input.ts index aa436c073..8d14173ec 100755 --- a/projects/aca-testing-shared/src/components/search/search-input.ts +++ b/projects/aca-testing-shared/src/components/search/search-input.ts @@ -63,9 +63,6 @@ export class SearchInput extends Component { async clickSearchButton() { await BrowserActions.click(this.searchButton); - // TODO: Workaround for new Layout having 2 buttons - await BrowserActions.click(this.searchButton); - await this.waitForSearchControl(); } @@ -159,6 +156,11 @@ export class SearchInput extends Component { await this.clickLibrariesOption(); } + async searchForLibrary(text: string) { + await BrowserVisibility.waitUntilElementIsClickable(this.searchInput.elementFinder); + await this.searchInput.typeText(text); + } + async searchFor(text: string) { await BrowserVisibility.waitUntilElementIsClickable(this.searchInput.elementFinder); await this.searchInput.typeText(text); diff --git a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts index 800e25476..9e9029f20 100755 --- a/projects/aca-testing-shared/src/components/sidenav/sidenav.ts +++ b/projects/aca-testing-shared/src/components/sidenav/sidenav.ts @@ -27,11 +27,12 @@ import { ElementFinder, by, element, browser, By } from 'protractor'; import { Logger, BrowserActions } from '@alfresco/adf-testing'; import { Menu } from '../menu/menu'; import { Component } from '../component'; +import { waitElement } from '../../utilities'; export class Sidenav extends Component { links = this.component.all(by.css('.item')); activeLink = this.byCss('.action-button--active'); - newButton = element(By.css(('[id="app.toolbar.create"]'))); + newButton = element(By.css('[id="app.toolbar.create"]')); personalFiles = this.byCss(`[data-automation-id='app.navbar.personalFiles']`); fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`); myLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.files']`, browser); @@ -40,6 +41,7 @@ export class Sidenav extends Component { recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`); favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`); trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`); + sidenavToggle = this.byCss(`.sidenav-header-title-logo`); menu: Menu = new Menu(); @@ -47,6 +49,26 @@ export class Sidenav extends Component { super('app-sidenav', ancestor); } + async isSidenavExpanded(): Promise { + return browser.isElementPresent(by.css(`[data-automation-id='expanded']`)); + } + + async expandSideNav(): Promise { + const expanded = await this.isSidenavExpanded(); + if (!expanded) { + await BrowserActions.click(this.sidenavToggle); + await waitElement(`[data-automation-id='expanded']`); + } + } + + async collapseSideNav(): Promise { + const expanded = await this.isSidenavExpanded(); + if (expanded) { + await BrowserActions.click(this.sidenavToggle); + await waitElement(`[data-automation-id='collapsed']`); + } + } + async openNewMenu(): Promise { await BrowserActions.click(this.newButton); await this.menu.waitForMenuToOpen(); diff --git a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts index 4e394f774..1bf477309 100755 --- a/projects/aca-testing-shared/src/components/toolbar/toolbar.ts +++ b/projects/aca-testing-shared/src/components/toolbar/toolbar.ts @@ -33,9 +33,11 @@ export class Toolbar extends Component { menu = new Menu(); buttons = this.allByCss('button'); + createButton = element(By.css('[id="app.toolbar.create"]')); + uploadButton = element(By.css('[id="app.toolbar.upload"]')); shareButton = element(By.css('button[data-automation-id="share-action-button"]')); viewButton = element(By.css(`button[title='View']`)); - downloadButton = element(By.css(`button[title='Download']`)); + downloadButton = element(By.css(`.mat-icon-button[title='Download']`)); viewDetailsButton = element(By.css(`button[title='View Details']`)); printButton = element(By.css(`button[title='Print']`)); fullScreenButton = element(By.css(`button[title='Activate full-screen mode']`)); @@ -43,6 +45,8 @@ export class Toolbar extends Component { leaveButton = element(By.css(`button[title='Leave Library']`)); permanentlyDeleteButton = element(By.css(`button[title='Permanently Delete']`)); restoreButton = element(By.css(`button[title='Restore']`)); + searchIconButton = element(By.css(`button[title='Search']`)); + viewerDownloadButton = element(By.css('[id="app.viewer.download"]')); constructor(ancestor?: string) { super('.adf-toolbar', ancestor); @@ -72,6 +76,19 @@ export class Toolbar extends Component { return this.component.element(by.id(id)); } + async clickSearchIconButton() { + await BrowserActions.click(this.searchIconButton); + } + + async openViewerMoreMenu(): Promise { + const btnMoreActions = element(By.css('button[id="app.viewer.toolbar.more"]')); + await btnMoreActions.isPresent(); + await BrowserActions.click(btnMoreActions); + + await this.menu.waitForMenuToOpen(); + await browser.sleep(500); + } + async openMoreMenu(): Promise { const btnMoreActions = element(By.css('button[id="app.toolbar.more"]')); await btnMoreActions.isPresent(); @@ -97,6 +114,46 @@ export class Toolbar extends Component { return browser.isElementPresent(this.printButton); } + async openCreateFolderDialog(): Promise { + await this.openCreateMenu(); + await BrowserActions.click(this.menu.createFolderAction); + } + + async openCreateLibraryDialog(): Promise { + await this.openCreateMenu(); + await BrowserActions.click(this.menu.createLibraryAction); + } + + async openCreateFileFromTemplateDialog(): Promise { + await this.openCreateMenu(); + await BrowserActions.click(this.menu.createFileFromTemplateAction); + } + + async openCreateFolderFromTemplateDialog(): Promise { + await this.openCreateMenu(); + await BrowserActions.click(this.menu.createFolderFromTemplateAction); + } + + async openCreateMenu(): Promise { + await BrowserActions.click(this.createButton); + await this.menu.waitForMenuToOpen(); + } + + async closeCreateMenu(): Promise { + await BrowserActions.click(element(by.css('button[id="app.toolbar.create"]'))); + await this.menu.waitForMenuToClose(); + } + + async openUploadMenu(): Promise { + await BrowserActions.click(this.uploadButton); + await this.menu.waitForMenuToOpen(); + } + + async closeUploadMenu(): Promise { + await BrowserActions.click(element(by.css('button[id="app.toolbar.upload"]'))); + await this.menu.waitForMenuToClose(); + } + async clickMoreActionsFavorite(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Favorite'); diff --git a/projects/aca-testing-shared/src/pages/browsing-page.ts b/projects/aca-testing-shared/src/pages/browsing-page.ts index c7d85c95e..a6e118a0e 100755 --- a/projects/aca-testing-shared/src/pages/browsing-page.ts +++ b/projects/aca-testing-shared/src/pages/browsing-page.ts @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { Header, DataTable, Pagination, Toolbar, Breadcrumb, Sidenav } from '../components/components'; +import { Header, DataTable, Pagination, Toolbar, Breadcrumb, Sidenav, PageLayoutHeader } from '../components/components'; import { SIDEBAR_LABELS } from './../configs'; import { Page } from './page'; @@ -32,6 +32,7 @@ export class BrowsingPage extends Page { sidenav = new Sidenav(this.appRoot); toolbar = new Toolbar(this.appRoot); breadcrumb = new Breadcrumb(this.appRoot); + pageLayoutHeader = new PageLayoutHeader(this.appRoot); dataTable = new DataTable(this.appRoot); pagination = new Pagination(this.appRoot);