e2e fixes and cleanup for unwanted files

This commit is contained in:
SheenaMalhotra182
2023-03-17 15:42:00 +05:30
committed by Sheena Malhotra
parent a6efbc3a3e
commit 7ddb7e07e3
44 changed files with 385 additions and 600 deletions

View File

@@ -44,8 +44,8 @@ describe('Folders - available actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -151,6 +151,7 @@ describe('Folders - available actions : ', () => {
describe('on a folder', () => { describe('on a folder', () => {
beforeAll(async () => { beforeAll(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(random); await searchInput.searchFor(random);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -169,6 +170,8 @@ describe('Folders - available actions : ', () => {
describe('on multiple selection', () => { describe('on multiple selection', () => {
it('[C291821] multiple folders', async () => { it('[C291821] multiple folders', async () => {
await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(random); await searchInput.searchFor(random);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -182,6 +185,8 @@ describe('Folders - available actions : ', () => {
}); });
it('[C291822] both files and folders', async () => { it('[C291822] both files and folders', async () => {
await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`); await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();

View File

@@ -52,7 +52,7 @@ describe('Generic tests : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const contextMenu = dataTable.menu; const contextMenu = dataTable.menu;
beforeAll(async () => { beforeAll(async () => {
@@ -114,44 +114,8 @@ describe('Generic tests : ', () => {
}); });
describe('Actions are not displayed when no item is selected', () => { 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 () => { it('[C291815] on Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor('*'); await searchInput.searchFor('*');

View File

@@ -45,8 +45,8 @@ describe('Locked Files - available actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -265,6 +265,7 @@ describe('Locked Files - available actions : ', () => {
describe('on Search Results : ', () => { describe('on Search Results : ', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(random); await searchInput.searchFor(random);

View File

@@ -52,8 +52,8 @@ describe('Multiple Files - available actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -162,6 +162,7 @@ describe('Multiple Files - available actions : ', () => {
describe('on Search Results : ', () => { describe('on Search Results : ', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(random); await searchInput.searchFor(random);

View File

@@ -44,8 +44,8 @@ describe('Office Files - available actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -247,6 +247,7 @@ describe('Office Files - available actions : ', () => {
describe('on Search Results : ', () => { describe('on Search Results : ', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(random); await searchInput.searchFor(random);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();

View File

@@ -45,8 +45,8 @@ describe('Files - available actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -232,6 +232,7 @@ describe('Files - available actions : ', () => {
describe('on Search Results : ', () => { describe('on Search Results : ', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
}); });

View File

@@ -47,7 +47,8 @@ describe('Library actions : ', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header; const { toolbar } = page;
const { searchInput } = searchResultsPage.pageLayoutHeader;
beforeAll(async () => { beforeAll(async () => {
try { try {
@@ -246,6 +247,7 @@ describe('Library actions : ', () => {
try { try {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
} catch (error) { } catch (error) {
@@ -254,7 +256,7 @@ describe('Library actions : ', () => {
}); });
it('[C290084] Public library, user is a member, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.publicUserMemberFav.name, testData.publicUserMemberFav.name,
@@ -265,7 +267,7 @@ describe('Library actions : ', () => {
}); });
it('[C290085] Private library, user is a member, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.privateUserMemberFav.name, testData.privateUserMemberFav.name,
@@ -276,7 +278,7 @@ describe('Library actions : ', () => {
}); });
it('[C290086] Moderated library, user is a member, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedUserMemberFav.name, testData.moderatedUserMemberFav.name,
@@ -287,7 +289,7 @@ describe('Library actions : ', () => {
}); });
it('[C291812] Public library, user is a member, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.publicUserMemberNotFav.name, testData.publicUserMemberNotFav.name,
@@ -298,7 +300,7 @@ describe('Library actions : ', () => {
}); });
it('[C291813] Private library, user is a member, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.privateUserMemberNotFav.name, testData.privateUserMemberNotFav.name,
@@ -309,7 +311,7 @@ describe('Library actions : ', () => {
}); });
it('[C291814] Moderated library, user is a member, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedUserMemberNotFav.name, testData.moderatedUserMemberNotFav.name,
@@ -320,7 +322,7 @@ describe('Library actions : ', () => {
}); });
it('[C326680] Public library, user not a member, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.publicNotMemberFav.name, testData.publicNotMemberFav.name,
@@ -331,7 +333,7 @@ describe('Library actions : ', () => {
}); });
it('[C326681] Moderated library, user not a member, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedNotMemberFav.name, testData.moderatedNotMemberFav.name,
@@ -342,7 +344,7 @@ describe('Library actions : ', () => {
}); });
it('[C326682] Public library, user not a member, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.publicNotMemberNotFav.name, testData.publicNotMemberNotFav.name,
@@ -353,7 +355,7 @@ describe('Library actions : ', () => {
}); });
it('[C326683] Moderated library, user not a member, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedNotMemberNotFav.name, testData.moderatedNotMemberNotFav.name,
@@ -364,7 +366,7 @@ describe('Library actions : ', () => {
}); });
it('[C326685] Moderated library, user requested to join, favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedRequestedJoinFav.name, testData.moderatedRequestedJoinFav.name,
@@ -375,7 +377,7 @@ describe('Library actions : ', () => {
}); });
it('[C326684] Moderated library, user requested to join, not favorite', async () => { 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( await testUtil.checkToolbarActions(
testData.moderatedRequestedJoinNotFav.name, testData.moderatedRequestedJoinNotFav.name,

View File

@@ -33,7 +33,7 @@ describe('New menu', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, sidenav } = page; const { sidenav } = page;
const { menu } = sidenav; const { menu } = sidenav;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
@@ -67,11 +67,7 @@ describe('New menu', () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await sidenav.openNewMenu(); 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.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.isCreateFileFromTemplateEnabled()).toBe(true, 'Create file from template is not enabled');
expect(await menu.isCreateFolderFromTemplateEnabled()).toBe(true, 'Create folder 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 () => { it('[C280393] Actions in File Libraries - user with enough permissions', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteUser);
await sidenav.openNewMenu(); 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.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 () => { it('[C216342] Enabled actions tooltips', async () => {
@@ -113,39 +86,10 @@ describe('New menu', () => {
let tooltip: string; 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'); tooltip = await menu.getItemTooltip('Create Folder');
expect(tooltip).toContain('Create new 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'); tooltip = await menu.getItemTooltip('Create file from template');
expect(tooltip).toContain('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');
});
}); });

View File

@@ -28,9 +28,9 @@ import * as testData from './test-data-permissions';
import * as testUtil from '../test-util'; import * as testUtil from '../test-util';
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header; const { searchInput } = searchResultsPage.pageLayoutHeader;
export function collaboratorTests(siteName?: string) { export function collaboratorTests(siteName?: string) {
describe('available actions : ', () => { describe('available actions : ', () => {
@@ -74,6 +74,7 @@ export function collaboratorTests(siteName?: string) {
}); });
it('on Search Results - [C297653]', async () => { it('on Search Results - [C297653]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileSharedFav.name); await searchInput.searchFor(testData.fileSharedFav.name);
@@ -141,6 +142,7 @@ export function collaboratorTests(siteName?: string) {
}); });
it('file opened from Search Results - [C306992]', async () => { it('file opened from Search Results - [C306992]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileDocxSharedFav.name); await searchInput.searchFor(testData.fileDocxSharedFav.name);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -204,6 +206,7 @@ export function filesLockedByCurrentUser(siteName?: string) {
}); });
it('on Search Results - [C297660]', async () => { it('on Search Results - [C297660]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser); await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -245,6 +248,7 @@ export function filesLockedByCurrentUser(siteName?: string) {
}); });
it('file opened from Search Results - [C306993]', async () => { it('file opened from Search Results - [C306993]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser); await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -310,6 +314,7 @@ export function filesLockedByOtherUser(siteName?: string) {
}); });
it('on Search Results - [C297667]', async () => { it('on Search Results - [C297667]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser); await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
@@ -351,6 +356,7 @@ export function filesLockedByOtherUser(siteName?: string) {
}); });
it('file opened from Search Results - [C306994]', async () => { it('file opened from Search Results - [C306994]', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(testData.fileLockedByUser); await searchInput.searchFor(testData.fileLockedByUser);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();

View File

@@ -30,7 +30,7 @@ import * as testUtil from '../test-util';
export function searchResultsTests() { export function searchResultsTests() {
const page = new BrowsingPage(); const page = new BrowsingPage();
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput, toolbar } = page.pageLayoutHeader;
describe('available actions : ', () => { describe('available actions : ', () => {
beforeEach(async () => { beforeEach(async () => {
@@ -44,6 +44,7 @@ export function searchResultsTests() {
describe('on a file', () => { describe('on a file', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(testData.random); await searchInput.searchFor(testData.random);
@@ -138,6 +139,7 @@ export function searchResultsTests() {
describe('on a folder', () => { describe('on a folder', () => {
beforeAll(async () => { beforeAll(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders(); await searchInput.checkOnlyFolders();
await searchInput.searchFor(testData.random); await searchInput.searchFor(testData.random);
@@ -159,6 +161,7 @@ export function searchResultsTests() {
describe('of files', () => { describe('of files', () => {
beforeAll(async () => { beforeAll(async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(testData.random); await searchInput.searchFor(testData.random);
@@ -210,6 +213,7 @@ export function searchResultsTests() {
it('multiple folders - [C291836]', async () => { it('multiple folders - [C291836]', async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders(); await searchInput.checkOnlyFolders();
await searchInput.searchFor(testData.random); await searchInput.searchFor(testData.random);
@@ -224,6 +228,7 @@ export function searchResultsTests() {
it('both files and folders - [C268128]', async () => { it('both files and folders - [C268128]', async () => {
await page.clickPersonalFiles(); await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`); await searchInput.searchFor(`${testData.file.name} or ${testData.folderFav.name}`);

View File

@@ -30,8 +30,8 @@ import * as testUtil from '../test-util';
export function viewerTests(siteName?: string) { export function viewerTests(siteName?: string) {
const page = new BrowsingPage(); const page = new BrowsingPage();
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
describe('available actions : ', () => { describe('available actions : ', () => {
beforeEach(async () => { beforeEach(async () => {
@@ -228,6 +228,7 @@ export function viewerTests(siteName?: string) {
describe('file opened from Search Results', () => { describe('file opened from Search Results', () => {
beforeAll(async () => { beforeAll(async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(testData.random); await searchInput.searchFor(testData.random);

View File

@@ -87,7 +87,7 @@ describe('Create file from template', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const selectTemplateDialog = new SelectTemplateDialog(); const selectTemplateDialog = new SelectTemplateDialog();
const createFromTemplateDialog = new CreateFromTemplateDialog(); const createFromTemplateDialog = new CreateFromTemplateDialog();
const { sidenav } = page; const { toolbar } = page;
const templates: NodeContentTree = { const templates: NodeContentTree = {
folders: [ folders: [
@@ -156,7 +156,7 @@ describe('Create file from template', () => {
describe('Select Template dialog', () => { describe('Select Template dialog', () => {
beforeEach(async () => { beforeEach(async () => {
await sidenav.openCreateFileFromTemplateDialog(); await toolbar.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
}); });
@@ -236,7 +236,7 @@ describe('Create file from template', () => {
describe('Create from template dialog', () => { describe('Create from template dialog', () => {
beforeEach(async () => { beforeEach(async () => {
try { try {
await sidenav.openCreateFileFromTemplateDialog(); await toolbar.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();
@@ -309,7 +309,7 @@ describe('Create file from template', () => {
try { try {
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(parent);
await sidenav.openCreateFileFromTemplateDialog(); await toolbar.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();
@@ -377,7 +377,7 @@ describe('Create file from template', () => {
try { try {
await fileLibrariesPage.goToMyLibrariesAndWait(); await fileLibrariesPage.goToMyLibrariesAndWait();
await page.dataTable.doubleClickOnRowByName(siteName); await page.dataTable.doubleClickOnRowByName(siteName);
await sidenav.openCreateFileFromTemplateDialog(); await toolbar.openCreateFileFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(template1InRootFolder); await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();

View File

@@ -113,7 +113,7 @@ describe('Create folder from template', () => {
const page = new BrowsingPage(); const page = new BrowsingPage();
const selectTemplateDialog = new SelectTemplateDialog(); const selectTemplateDialog = new SelectTemplateDialog();
const createFromTemplateDialog = new CreateFromTemplateDialog(); const createFromTemplateDialog = new CreateFromTemplateDialog();
const { sidenav } = page; const { toolbar } = page;
beforeAll(async () => { beforeAll(async () => {
await adminApiActions.createUser({ username }); await adminApiActions.createUser({ username });
@@ -154,7 +154,7 @@ describe('Create folder from template', () => {
describe('Select Template dialog', () => { describe('Select Template dialog', () => {
beforeEach(async () => { beforeEach(async () => {
await sidenav.openCreateFolderFromTemplateDialog(); await toolbar.openCreateFolderFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
}); });
@@ -231,7 +231,7 @@ describe('Create folder from template', () => {
describe('Create from template dialog', () => { describe('Create from template dialog', () => {
beforeEach(async () => { beforeEach(async () => {
await sidenav.openCreateFolderFromTemplateDialog(); await toolbar.openCreateFolderFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.dataTable.selectItem(templateFolder1);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();
@@ -300,7 +300,7 @@ describe('Create folder from template', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(parent);
await sidenav.openCreateFolderFromTemplateDialog(); await toolbar.openCreateFolderFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.dataTable.selectItem(templateFolder1);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();
@@ -365,7 +365,7 @@ describe('Create folder from template', () => {
beforeEach(async () => { beforeEach(async () => {
await fileLibrariesPage.goToMyLibrariesAndWait(); await fileLibrariesPage.goToMyLibrariesAndWait();
await page.dataTable.doubleClickOnRowByName(siteName); await page.dataTable.doubleClickOnRowByName(siteName);
await sidenav.openCreateFolderFromTemplateDialog(); await toolbar.openCreateFolderFromTemplateDialog();
await selectTemplateDialog.waitForDialogToOpen(); await selectTemplateDialog.waitForDialogToOpen();
await selectTemplateDialog.dataTable.selectItem(templateFolder1); await selectTemplateDialog.dataTable.selectItem(templateFolder1);
await selectTemplateDialog.clickNext(); await selectTemplateDialog.clickNext();

View File

@@ -56,7 +56,7 @@ describe('Create folder', () => {
async function openCreateFolderDialog(name: string) { async function openCreateFolderDialog(name: string) {
await page.dataTable.doubleClickOnRowByName(name); await page.dataTable.doubleClickOnRowByName(name);
await page.sidenav.openCreateFolderDialog(); await page.toolbar.openCreateFolderDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
} }

View File

@@ -91,7 +91,7 @@ describe('Create library', () => {
it('[C280024] Create Library dialog UI', async () => { it('[C280024] Create Library dialog UI', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
expect(await createDialog.getDialogTitle()).toMatch('Create Library'); expect(await createDialog.getDialogTitle()).toMatch('Create Library');
@@ -109,7 +109,7 @@ describe('Create library', () => {
it('[C280025] Create a public library', async () => { it('[C280025] Create a public library', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site1Name); await createDialog.enterName(site1Name);
await BrowserActions.click(createDialog.createButton); await BrowserActions.click(createDialog.createButton);
@@ -124,7 +124,7 @@ describe('Create library', () => {
it('[C289880] Create a moderated library', async () => { it('[C289880] Create a moderated library', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site2Name); await createDialog.enterName(site2Name);
await BrowserActions.click(createDialog.visibilityModerated); await BrowserActions.click(createDialog.visibilityModerated);
@@ -140,7 +140,7 @@ describe('Create library', () => {
it('[C289881] Create a private library', async () => { it('[C289881] Create a private library', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site3Name); await createDialog.enterName(site3Name);
await BrowserActions.click(createDialog.visibilityPrivate); await BrowserActions.click(createDialog.visibilityPrivate);
@@ -156,7 +156,7 @@ describe('Create library', () => {
it('[C289882] Create a library with a given ID and description', async () => { it('[C289882] Create a library with a given ID and description', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(site4.name); await createDialog.enterName(site4.name);
await createDialog.enterLibraryId(site4.id); await createDialog.enterLibraryId(site4.id);
@@ -175,7 +175,7 @@ describe('Create library', () => {
it('[C280027] Duplicate library ID', async () => { it('[C280027] Duplicate library ID', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(duplicateSite.name); await createDialog.enterName(duplicateSite.name);
await createDialog.enterLibraryId(duplicateSite.id); 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 () => { it('[C280028] Create library using the ID of a library from the Trashcan', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(siteInTrash.name); await createDialog.enterName(siteInTrash.name);
await createDialog.enterLibraryId(siteInTrash.id); await createDialog.enterLibraryId(siteInTrash.id);
@@ -199,7 +199,7 @@ describe('Create library', () => {
it('[C280029] Cancel button', async () => { it('[C280029] Cancel button', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName('test site'); await createDialog.enterName('test site');
await createDialog.enterDescription('test description'); await createDialog.enterDescription('test description');
@@ -212,7 +212,7 @@ describe('Create library', () => {
const idWithSpecialChars = ['a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a']; const idWithSpecialChars = ['a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a'];
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName('test site'); await createDialog.enterName('test site');
@@ -226,7 +226,7 @@ describe('Create library', () => {
it('[C280030] Create 2 libraries with same name but different IDs', async () => { it('[C280030] Create 2 libraries with same name but different IDs', async () => {
await page.goToMyLibrariesAndWait(); await page.goToMyLibrariesAndWait();
await page.sidenav.openCreateLibraryDialog(); await page.toolbar.openCreateLibraryDialog();
await createDialog.waitForDialogToOpen(); await createDialog.waitForDialogToOpen();
await createDialog.enterName(duplicateSite.name); await createDialog.enterName(duplicateSite.name);
await createDialog.enterLibraryId(`${duplicateSite.id}-2`); await createDialog.enterLibraryId(`${duplicateSite.id}-2`);

View File

@@ -61,7 +61,7 @@ describe('Library actions', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const confirmDialog = new ConfirmDialog(); const confirmDialog = new ConfirmDialog();
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
@@ -112,9 +112,10 @@ describe('Library actions', () => {
}); });
it('[C306959] from Search Results', async () => { it('[C306959] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic1Admin); await searchInput.searchForLibrary(siteSearchPublic1Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic1Admin); await dataTable.selectItem(siteSearchPublic1Admin);
await BrowserActions.click(toolbar.joinButton); await BrowserActions.click(toolbar.joinButton);
@@ -145,9 +146,10 @@ describe('Library actions', () => {
}); });
it('[C306960] from Search Results', async () => { it('[C306960] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchModerated1Admin); await searchInput.searchForLibrary(siteSearchModerated1Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchModerated1Admin); await dataTable.selectItem(siteSearchModerated1Admin);
await BrowserActions.click(toolbar.joinButton); await BrowserActions.click(toolbar.joinButton);
@@ -203,9 +205,10 @@ describe('Library actions', () => {
}); });
it('[C306961] from Search Results', async () => { it('[C306961] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic2Admin); await searchInput.searchForLibrary(siteSearchPublic2Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic2Admin); await dataTable.selectItem(siteSearchPublic2Admin);
@@ -278,9 +281,10 @@ describe('Library actions', () => {
}); });
it('[C306962] from Search Results', async () => { it('[C306962] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchModerated2Admin); await searchInput.searchForLibrary(siteSearchModerated2Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchModerated2Admin); await dataTable.selectItem(siteSearchModerated2Admin);
@@ -313,9 +317,10 @@ describe('Library actions', () => {
}); });
it('[C306963] from Search Results', async () => { it('[C306963] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic3Admin); await searchInput.searchForLibrary(siteSearchPublic3Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic3Admin); await dataTable.selectItem(siteSearchPublic3Admin);
@@ -366,9 +371,10 @@ describe('Library actions', () => {
}); });
it('[C306964] from Search Results', async () => { it('[C306964] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchPublic4Admin); await searchInput.searchForLibrary(siteSearchPublic4Admin);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchPublic4Admin); await dataTable.selectItem(siteSearchPublic4Admin);
@@ -408,9 +414,10 @@ describe('Library actions', () => {
}); });
it('[C306965] from Search Results', async () => { it('[C306965] from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteSearchForDelete); await searchInput.searchForLibrary(siteSearchForDelete);
await dataTable.waitForBody(); await dataTable.waitForBody();
await dataTable.selectItem(siteSearchForDelete); await dataTable.selectItem(siteSearchForDelete);

View File

@@ -124,6 +124,7 @@ describe('Unshare a file from Search Results', () => {
}); });
it('[C306995] Unshare dialog UI', async () => { it('[C306995] Unshare dialog UI', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file1); await searchInput.searchFor(file1);
@@ -144,6 +145,7 @@ describe('Unshare a file from Search Results', () => {
}); });
it('[C306996] Unshare a file', async () => { it('[C306996] Unshare a file', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file2); await searchInput.searchFor(file2);
@@ -170,6 +172,7 @@ describe('Unshare a file from Search Results', () => {
}); });
it('[C306997] Cancel the Unshare action', async () => { it('[C306997] Cancel the Unshare action', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file3); 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 () => { it('[C306999] Unshare a file from the context menu', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file4); 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 () => { it('[C306998] Consumer - on Search Results - file shared by other user', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSite1); 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 () => { it('[C307000] Consumer - on Search Results - file shared by the user', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSite2); await searchInput.searchFor(fileSite2);

View File

@@ -54,9 +54,9 @@ describe('Upload files', () => {
beforeEach(async () => { beforeEach(async () => {
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(folder1); await dataTable.doubleClickOnRowByName(folder1);
await page.sidenav.openNewMenu(); await page.toolbar.openUploadMenu();
await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/upload-file.test.ts`); await page.toolbar.menu.uploadFilesInput.sendKeys(`${__dirname}/upload-file.test.ts`);
await page.sidenav.closeNewMenu(); await page.toolbar.closeUploadMenu();
await page.uploadFilesDialog.uploadDialog.isVisible(); await page.uploadFilesDialog.uploadDialog.isVisible();
}); });

View File

@@ -95,7 +95,7 @@ describe('Upload new version', () => {
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { dataTable, toolbar } = page; const { dataTable, toolbar } = page;
const uploadNewVersionDialog = new UploadNewVersionDialog(); const uploadNewVersionDialog = new UploadNewVersionDialog();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const adminActions = new AdminActions(); const adminActions = new AdminActions();
const userActions = new UserActions(); const userActions = new UserActions();
@@ -141,6 +141,7 @@ describe('Upload new version', () => {
}); });
it('[C307003] dialog UI defaults', async () => { it('[C307003] dialog UI defaults', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file); await searchInput.searchFor(file);
@@ -160,6 +161,7 @@ describe('Upload new version', () => {
}); });
it('[C307004] file is updated after uploading a new version - major', async () => { it('[C307004] file is updated after uploading a new version - major', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch1); await searchInput.searchFor(fileSearch1);
@@ -182,6 +184,7 @@ describe('Upload new version', () => {
}); });
it('[C307005] file is updated after uploading a new version - minor', async () => { it('[C307005] file is updated after uploading a new version - minor', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch2); await searchInput.searchFor(fileSearch2);
@@ -204,6 +207,7 @@ describe('Upload new version', () => {
}); });
it('[C307006] file is not updated when clicking Cancel', async () => { it('[C307006] file is not updated when clicking Cancel', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch3); 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 () => { it('[C307007] upload new version fails when new file name already exists', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch4); await searchInput.searchFor(fileSearch4);
@@ -247,6 +252,7 @@ describe('Upload new version', () => {
}); });
it('[C307008] file is unlocked after uploading a new version', async () => { it('[C307008] file is unlocked after uploading a new version', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch1); 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 () => { it('[C307009] file remains locked after canceling of uploading a new version', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch2); await searchInput.searchFor(fileLockedSearch2);

View File

@@ -121,7 +121,7 @@ describe('Version actions', () => {
}); });
it('[C586768] Should be possible to download a previous document version', async () => { 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'); expect(await Utils.fileExistsOnOS(filesToUpload[0])).toBe(true, 'File not found in download location');
}); });

View File

@@ -41,12 +41,13 @@ const PAGE_TITLES = {
describe('Page titles', () => { describe('Page titles', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { toolbar } = page;
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const apis = new RepoClient(username, username); const apis = new RepoClient(username, username);
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
const file = `file-${Utils.random()}.txt`; const file = `file-${Utils.random()}.txt`;
let fileId: string; let fileId: string;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
beforeAll(async () => { beforeAll(async () => {
await adminApiActions.createUser({ username }); await adminApiActions.createUser({ username });
@@ -125,6 +126,7 @@ describe('Page titles', () => {
}); });
it('[C280413] Search Results page', async () => { it('[C280413] Search Results page', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(file); await searchInput.searchFor(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH); expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);

View File

@@ -141,7 +141,7 @@ describe('Extensions - Viewer', () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.fileName); await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); 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.isMenuItemPresent(customSecondaryAction.title)).toBe(true, 'action is not present');
expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon); expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon);
expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id); expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id);
@@ -151,7 +151,7 @@ describe('Extensions - Viewer', () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.fileName); await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); 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); 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); await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); 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'); expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed');
}); });
}); });

View File

@@ -29,8 +29,8 @@ describe('Empty list views', () => {
const username = `user-${Utils.random()}`; const username = `user-${Utils.random()}`;
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, pagination } = page; const { dataTable, pagination, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
beforeAll(async () => { beforeAll(async () => {
@@ -135,6 +135,7 @@ describe('Empty list views', () => {
}); });
it('[C290123] Search results - pagination controls not displayed', async () => { it('[C290123] Search results - pagination controls not displayed', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
@@ -149,10 +150,12 @@ describe('Empty list views', () => {
}); });
it('[C290020] Empty Search results - Libraries', async () => { it('[C290020] Empty Search results - Libraries', async () => {
await page.goToMyLibraries();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop'); await searchInput.searchForLibrary('qwertyuiop');
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); 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 () => { it('[C290031] Empty Search results - Files / Folders', async () => {
await page.clickPersonalFiles();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
/* cspell:disable-next-line */ /* cspell:disable-next-line */

View File

@@ -34,8 +34,8 @@ describe('Special permissions', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
const userActions = new UserActions(); const userActions = new UserActions();
@@ -102,6 +102,7 @@ describe('Special permissions', () => {
}); });
it('[C290122] on Search Results', async () => { it('[C290122] on Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileName); await searchInput.searchFor(fileName);
@@ -164,6 +165,7 @@ describe('Special permissions', () => {
}); });
it('[C306868] on Search results', async () => { it('[C306868] on Search results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileName); await searchInput.searchFor(fileName);

View File

@@ -29,9 +29,9 @@ import { APP_ROUTES, SIDEBAR_LABELS, LoginPage, BrowsingPage, SearchResultsPage,
describe('Sidebar', () => { describe('Sidebar', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { sidenav, header } = page; const { sidenav, toolbar } = page;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header; const { searchInput } = searchResultsPage.pageLayoutHeader;
beforeAll(async () => { beforeAll(async () => {
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
@@ -39,7 +39,12 @@ describe('Sidebar', () => {
beforeEach(async () => { beforeEach(async () => {
await Utils.pressEscape(); 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 () => { it('[C217149] has "Personal Files" as default', async () => {
@@ -125,62 +130,65 @@ describe('Sidebar', () => {
}); });
it('[C269095] default state is expanded', async () => { 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 () => { it('[C269096] sidebar toggle', async () => {
await header.collapseSideNav(); await sidenav.collapseSideNav();
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
await header.expandSideNav(); await sidenav.expandSideNav();
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
}); });
it('[C269100] sidebar state is preserved on page refresh', async () => { 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(); await page.refresh();
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded'); expect(await sidenav.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
await header.collapseSideNav(); await sidenav.collapseSideNav();
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed'); expect(await sidenav.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
await page.refresh(); 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 () => { it('[C269102] sidebar state is preserved after logout / login', async () => {
await header.collapseSideNav(); await sidenav.collapseSideNav();
await page.signOut(); await page.signOut();
await loginPage.loginWithAdmin(); 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 () => { it('[C277223] sidebar is collapsed automatically when Search Results opens', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); 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 () => { it('[C277224] sidenav returns to the default state when navigating away from the Search Results page', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();
await page.clickFavorites(); 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 () => { it('[C277230] sidenav can be expanded when search results page is displayed', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
/* cspell:disable-next-line */ /* cspell:disable-next-line */
await searchInput.searchFor('qwertyuiop'); await searchInput.searchFor('qwertyuiop');
await searchResultsPage.waitForResults(); 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');
}); });
}); });

View File

@@ -47,9 +47,9 @@ describe('Single click on item name', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable, breadcrumb } = page; const { dataTable, breadcrumb, toolbar } = page;
const viewer = new Viewer(); const viewer = new Viewer();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
const userActions = new UserActions(); const userActions = new UserActions();
@@ -207,6 +207,7 @@ describe('Single click on item name', () => {
describe('on Search Results', () => { describe('on Search Results', () => {
beforeEach(async () => { beforeEach(async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
}); });

View File

@@ -28,12 +28,13 @@ import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function searchResultsTests(username: string, random: string) { export function searchResultsTests(username: string, random: string) {
const page = new BrowsingPage(); const page = new BrowsingPage();
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const { dataTable, pagination } = page; const { dataTable, pagination, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
describe('Pagination controls : ', () => { describe('Pagination controls : ', () => {
beforeAll(async () => { beforeAll(async () => {
await loginPage.loginWith(username); await loginPage.loginWith(username);
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(random); await searchInput.searchFor(random);

View File

@@ -44,8 +44,8 @@ describe('Pagination on single page', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { pagination } = page; const { pagination, toolbar } = page;
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const searchResultsPage = new SearchResultsPage(); const searchResultsPage = new SearchResultsPage();
beforeAll(async () => { beforeAll(async () => {
@@ -116,6 +116,7 @@ describe('Pagination on single page', () => {
}); });
it('[C290124] page selector not displayed on Search results', async () => { it('[C290124] page selector not displayed on Search results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(file); await searchInput.searchFor(file);
await searchResultsPage.waitForResults(); await searchResultsPage.waitForResults();

View File

@@ -75,8 +75,8 @@ describe('Search filters', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new SearchResultsPage(); const page = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const { dataTable, filters } = page; const { dataTable, filters, toolbar } = page;
const sizeFilter = filters.size; const sizeFilter = filters.size;
const fileTypeFilter = filters.fileType; const fileTypeFilter = filters.fileType;
@@ -108,7 +108,7 @@ describe('Search filters', () => {
beforeEach(async () => { beforeEach(async () => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(`search-filters-${random}`); await searchInput.searchFor(`search-filters-${random}`);
await dataTable.waitForBody(); await dataTable.waitForBody();

View File

@@ -28,7 +28,8 @@ import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
describe('Search input', () => { describe('Search input', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { searchInput } = page.header; const { toolbar } = page;
const { searchInput } = page.pageLayoutHeader;
beforeAll(async () => { beforeAll(async () => {
await loginPage.loginWithAdmin(); await loginPage.loginWithAdmin();
@@ -39,11 +40,15 @@ describe('Search input', () => {
await page.clickPersonalFiles(); 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'); expect(await searchInput.isSearchContainerDisplayed()).toBe(true, 'search controls not displayed');
}); });
it('[C289848] Search options are displayed when clicking in the search input', async () => { it('[C289848] Search options are displayed when clicking in the search input', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed'); expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, 'Search options not displayed');
expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled'); 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 () => { it('[C289849] Search options are correctly enabled / disabled', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.clickFilesOption(); await searchInput.clickFilesOption();

View File

@@ -52,8 +52,8 @@ describe('Search results - files and folders', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new SearchResultsPage(); const page = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const { dataTable, breadcrumb } = page; const { dataTable, breadcrumb, toolbar } = page;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
beforeAll(async () => { beforeAll(async () => {
@@ -73,6 +73,7 @@ describe('Search results - files and folders', () => {
beforeEach(async () => { beforeEach(async () => {
await page.refresh(); await page.refresh();
await page.clickPersonalFilesAndWait();
}); });
afterAll(async () => { 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 () => { it('[C279183] File information', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(random); await searchInput.searchFor(random);
@@ -115,6 +108,7 @@ describe('Search results - files and folders', () => {
}); });
it('[C306867] Folder information', async () => { it('[C306867] Folder information', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(random); await searchInput.searchFor(random);
@@ -134,6 +128,7 @@ describe('Search results - files and folders', () => {
}); });
it('[C290029] Search file with special characters', async () => { it('[C290029] Search file with special characters', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileRussian); await searchInput.searchFor(fileRussian);
@@ -143,6 +138,7 @@ describe('Search results - files and folders', () => {
}); });
it('[C279177] Location column redirect - file in user Home', async () => { it('[C279177] Location column redirect - file in user Home', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file); await searchInput.searchFor(file);

View File

@@ -42,7 +42,7 @@ describe('Search results general', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new SearchResultsPage(); const page = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput, toolbar } = page.pageLayoutHeader;
const dataTable = page.dataTable; const dataTable = page.dataTable;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
@@ -67,7 +67,13 @@ describe('Search results general', () => {
await page.refresh(); 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 () => { it('[C290005] Only files are returned when Files option is the only one checked', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFiles(); await searchInput.checkOnlyFiles();
await searchInput.searchFor(random); 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 () => { it('[C290006] Only folders are returned when Folders option is the only one checked', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkOnlyFolders(); await searchInput.checkOnlyFolders();
await searchInput.searchFor(random); 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 () => { it('[C290007] Files and folders are returned when both Files and Folders options are checked', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(random); await searchInput.searchFor(random);
@@ -101,9 +109,10 @@ describe('Search results general', () => {
}); });
it('[C290008] Only libraries are returned when Libraries option is checked', async () => { it('[C290008] Only libraries are returned when Libraries option is checked', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(random); await searchInput.searchForLibrary(random);
await page.waitForResults(); await page.waitForResults();
expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); 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 () => { it('[C279162] Results are updated automatically when changing the search term', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(file); await searchInput.searchFor(file);
await page.waitForResults(); await page.waitForResults();
@@ -121,15 +131,17 @@ describe('Search results general', () => {
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(folder); await searchInput.searchFor(folder);
await page.waitForResults();
expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`); expect(await dataTable.isItemPresent(file)).toBe(false, `${file} is displayed`);
expect(await dataTable.isItemPresent(folder)).toBe(true, `${folder} is not 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 () => { it('[C279178] Results are returned when accessing an URL containing a search query', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(site); await searchInput.searchForLibrary(site);
await page.waitForResults(); await page.waitForResults();
expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`); expect(await dataTable.isItemPresent(site)).toBe(true, `${site} not displayed`);

View File

@@ -70,7 +70,7 @@ describe('Search results - libraries', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new SearchResultsPage(); const page = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput, toolbar } = page.pageLayoutHeader;
const dataTable = page.dataTable; const dataTable = page.dataTable;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
@@ -137,9 +137,10 @@ describe('Search results - libraries', () => {
}); });
it('[C290012] Search library - full name match', async () => { it('[C290012] Search library - full name match', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(site1.name); await searchInput.searchForLibrary(site1.name);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`); 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 () => { it('[C290013] Search library - partial name match', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(`lib-${random}`); await searchInput.searchForLibrary(`lib-${random}`);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isItemPresent(site1.name)).toBe(true, `${site1.name} not displayed`); 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 () => { it('[C290014] Search library - description match', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(site4.description); await searchInput.searchForLibrary(site4.description);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isItemPresent(site1.name)).toBe(false, `${site1.name} displayed`); 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 () => { it('[C290015] Results page title', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(random); await searchInput.searchForLibrary(random);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...'); expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...');
}); });
it('[C290016] Results page columns', async () => { it('[C290016] Results page columns', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(site1.name); await searchInput.searchForLibrary(site1.name);
await dataTable.waitForBody(); await dataTable.waitForBody();
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
@@ -194,9 +199,10 @@ describe('Search results - libraries', () => {
}); });
it('[C290017] Library visibility is correctly displayed', async () => { it('[C290017] Library visibility is correctly displayed', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(`user-site-${random}`); await searchInput.searchForLibrary(`user-site-${random}`);
await dataTable.waitForBody(); await dataTable.waitForBody();
const expectedSitesVisibility = { const expectedSitesVisibility = {
@@ -213,9 +219,10 @@ describe('Search results - libraries', () => {
}); });
it('[C290018] User role is correctly displayed', async () => { it('[C290018] User role is correctly displayed', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(`admin-${random}-site`); await searchInput.searchForLibrary(`admin-${random}-site`);
await dataTable.waitForBody(); await dataTable.waitForBody();
const expectedSitesRoles = { const expectedSitesRoles = {
@@ -233,18 +240,20 @@ describe('Search results - libraries', () => {
}); });
it('[C290019] Private sites are not displayed when user is not a member', async () => { it('[C290019] Private sites are not displayed when user is not a member', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(`admin-${random}-site`); await searchInput.searchForLibrary(`admin-${random}-site`);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isItemPresent(adminPrivate)).toBe(false, `${adminPrivate} is displayed`); expect(await dataTable.isItemPresent(adminPrivate)).toBe(false, `${adminPrivate} is displayed`);
}); });
it('[C290028] Search libraries with special characters', async () => { it('[C290028] Search libraries with special characters', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkLibraries(); await searchInput.checkLibraries();
await searchInput.searchFor(siteRussian.name); await searchInput.searchForLibrary(siteRussian.name);
await dataTable.waitForBody(); await dataTable.waitForBody();
expect(await dataTable.isItemPresent(siteRussian.name)).toBe(true, `${siteRussian.name} not displayed`); expect(await dataTable.isItemPresent(siteRussian.name)).toBe(true, `${siteRussian.name} not displayed`);

View File

@@ -53,8 +53,8 @@ describe('Search sorting', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new SearchResultsPage(); const page = new SearchResultsPage();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const { dataTable } = page; const { dataTable, toolbar } = page;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
beforeAll(async () => { beforeAll(async () => {
@@ -75,7 +75,7 @@ describe('Search sorting', () => {
beforeEach(async () => { beforeEach(async () => {
await Utils.pressEscape(); await Utils.pressEscape();
await page.clickPersonalFilesAndWait(); await page.clickPersonalFilesAndWait();
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.searchFor(`search sort ${random}`); await searchInput.searchFor(`search sort ${random}`);
await dataTable.waitForBody(); await dataTable.waitForBody();

View File

@@ -50,9 +50,9 @@ describe('Viewer general', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const page = new BrowsingPage(); const page = new BrowsingPage();
const { dataTable } = page; const { dataTable, toolbar } = page;
const viewer = new Viewer(); const viewer = new Viewer();
const { searchInput } = page.header; const { searchInput } = page.pageLayoutHeader;
const adminApiActions = new AdminActions(); const adminApiActions = new AdminActions();
const userActions = new UserActions(); const userActions = new UserActions();
@@ -183,6 +183,7 @@ describe('Viewer general', () => {
}); });
it('[C279175] Viewer opens for a file from Search Results', async () => { it('[C279175] Viewer opens for a file from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton(); await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders(); await searchInput.checkFilesAndFolders();
await searchInput.searchFor(xlsxFile); await searchInput.searchFor(xlsxFile);

View File

@@ -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;
}
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<AppHeaderComponent>;
const actions = [
{ id: 'action-1', type: 'button' },
{ id: 'action-2', type: 'button' }
] as Array<ContentActionRef>;
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();
});
});
});

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<AppLayoutComponent>;
let component: AppLayoutComponent;
let appConfig: AppConfigService;
let userPreference: UserPreferencesService;
let store: Store<AppStore>;
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);
});
});
});

View File

@@ -25,6 +25,7 @@
export * from './login/login'; export * from './login/login';
export * from './header/header'; export * from './header/header';
export * from './pageLayoutHeader/pageLayoutHeader';
export * from './header/user-info'; export * from './header/user-info';
export * from './data-table/data-table'; export * from './data-table/data-table';
export * from './dialog/confirm-dialog'; export * from './dialog/confirm-dialog';

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<void> {
await BrowserActions.click(this.moreActions);
await this.menu.waitForMenuToOpen();
}
async closeMoreMenu(): Promise<void> {
await BrowserActions.click(this.moreActions);
await this.menu.waitForMenuToClose();
}
async isSidenavExpanded(): Promise<boolean> {
return browser.isElementPresent(by.css(`[data-automation-id='expanded']`));
}
async expandSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded();
if (!expanded) {
await BrowserActions.click(this.sidenavToggle);
await waitElement(`[data-automation-id='expanded']`);
}
}
async collapseSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded();
if (expanded) {
await BrowserActions.click(this.sidenavToggle);
await waitElement(`[data-automation-id='collapsed']`);
}
}
}

View File

@@ -63,9 +63,6 @@ export class SearchInput extends Component {
async clickSearchButton() { async clickSearchButton() {
await BrowserActions.click(this.searchButton); await BrowserActions.click(this.searchButton);
// TODO: Workaround for new Layout having 2 buttons
await BrowserActions.click(this.searchButton);
await this.waitForSearchControl(); await this.waitForSearchControl();
} }
@@ -159,6 +156,11 @@ export class SearchInput extends Component {
await this.clickLibrariesOption(); await this.clickLibrariesOption();
} }
async searchForLibrary(text: string) {
await BrowserVisibility.waitUntilElementIsClickable(this.searchInput.elementFinder);
await this.searchInput.typeText(text);
}
async searchFor(text: string) { async searchFor(text: string) {
await BrowserVisibility.waitUntilElementIsClickable(this.searchInput.elementFinder); await BrowserVisibility.waitUntilElementIsClickable(this.searchInput.elementFinder);
await this.searchInput.typeText(text); await this.searchInput.typeText(text);

View File

@@ -27,11 +27,12 @@ import { ElementFinder, by, element, browser, By } from 'protractor';
import { Logger, BrowserActions } from '@alfresco/adf-testing'; import { Logger, BrowserActions } from '@alfresco/adf-testing';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
import { waitElement } from '../../utilities';
export class Sidenav extends Component { export class Sidenav extends Component {
links = this.component.all(by.css('.item')); links = this.component.all(by.css('.item'));
activeLink = this.byCss('.action-button--active'); 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']`); personalFiles = this.byCss(`[data-automation-id='app.navbar.personalFiles']`);
fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`); fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`);
myLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.files']`, browser); 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']`); recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`);
favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`); favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`);
trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`); trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`);
sidenavToggle = this.byCss(`.sidenav-header-title-logo`);
menu: Menu = new Menu(); menu: Menu = new Menu();
@@ -47,6 +49,26 @@ export class Sidenav extends Component {
super('app-sidenav', ancestor); super('app-sidenav', ancestor);
} }
async isSidenavExpanded(): Promise<boolean> {
return browser.isElementPresent(by.css(`[data-automation-id='expanded']`));
}
async expandSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded();
if (!expanded) {
await BrowserActions.click(this.sidenavToggle);
await waitElement(`[data-automation-id='expanded']`);
}
}
async collapseSideNav(): Promise<void> {
const expanded = await this.isSidenavExpanded();
if (expanded) {
await BrowserActions.click(this.sidenavToggle);
await waitElement(`[data-automation-id='collapsed']`);
}
}
async openNewMenu(): Promise<void> { async openNewMenu(): Promise<void> {
await BrowserActions.click(this.newButton); await BrowserActions.click(this.newButton);
await this.menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();

View File

@@ -33,9 +33,11 @@ export class Toolbar extends Component {
menu = new Menu(); menu = new Menu();
buttons = this.allByCss('button'); 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"]')); shareButton = element(By.css('button[data-automation-id="share-action-button"]'));
viewButton = element(By.css(`button[title='View']`)); 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']`)); viewDetailsButton = element(By.css(`button[title='View Details']`));
printButton = element(By.css(`button[title='Print']`)); printButton = element(By.css(`button[title='Print']`));
fullScreenButton = element(By.css(`button[title='Activate full-screen mode']`)); 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']`)); leaveButton = element(By.css(`button[title='Leave Library']`));
permanentlyDeleteButton = element(By.css(`button[title='Permanently Delete']`)); permanentlyDeleteButton = element(By.css(`button[title='Permanently Delete']`));
restoreButton = element(By.css(`button[title='Restore']`)); 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) { constructor(ancestor?: string) {
super('.adf-toolbar', ancestor); super('.adf-toolbar', ancestor);
@@ -72,6 +76,19 @@ export class Toolbar extends Component {
return this.component.element(by.id(id)); return this.component.element(by.id(id));
} }
async clickSearchIconButton() {
await BrowserActions.click(this.searchIconButton);
}
async openViewerMoreMenu(): Promise<void> {
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<void> { async openMoreMenu(): Promise<void> {
const btnMoreActions = element(By.css('button[id="app.toolbar.more"]')); const btnMoreActions = element(By.css('button[id="app.toolbar.more"]'));
await btnMoreActions.isPresent(); await btnMoreActions.isPresent();
@@ -97,6 +114,46 @@ export class Toolbar extends Component {
return browser.isElementPresent(this.printButton); return browser.isElementPresent(this.printButton);
} }
async openCreateFolderDialog(): Promise<void> {
await this.openCreateMenu();
await BrowserActions.click(this.menu.createFolderAction);
}
async openCreateLibraryDialog(): Promise<void> {
await this.openCreateMenu();
await BrowserActions.click(this.menu.createLibraryAction);
}
async openCreateFileFromTemplateDialog(): Promise<void> {
await this.openCreateMenu();
await BrowserActions.click(this.menu.createFileFromTemplateAction);
}
async openCreateFolderFromTemplateDialog(): Promise<void> {
await this.openCreateMenu();
await BrowserActions.click(this.menu.createFolderFromTemplateAction);
}
async openCreateMenu(): Promise<void> {
await BrowserActions.click(this.createButton);
await this.menu.waitForMenuToOpen();
}
async closeCreateMenu(): Promise<void> {
await BrowserActions.click(element(by.css('button[id="app.toolbar.create"]')));
await this.menu.waitForMenuToClose();
}
async openUploadMenu(): Promise<void> {
await BrowserActions.click(this.uploadButton);
await this.menu.waitForMenuToOpen();
}
async closeUploadMenu(): Promise<void> {
await BrowserActions.click(element(by.css('button[id="app.toolbar.upload"]')));
await this.menu.waitForMenuToClose();
}
async clickMoreActionsFavorite(): Promise<void> { async clickMoreActionsFavorite(): Promise<void> {
await this.openMoreMenu(); await this.openMoreMenu();
await this.menu.clickMenuItem('Favorite'); await this.menu.clickMenuItem('Favorite');

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
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 { SIDEBAR_LABELS } from './../configs';
import { Page } from './page'; import { Page } from './page';
@@ -32,6 +32,7 @@ export class BrowsingPage extends Page {
sidenav = new Sidenav(this.appRoot); sidenav = new Sidenav(this.appRoot);
toolbar = new Toolbar(this.appRoot); toolbar = new Toolbar(this.appRoot);
breadcrumb = new Breadcrumb(this.appRoot); breadcrumb = new Breadcrumb(this.appRoot);
pageLayoutHeader = new PageLayoutHeader(this.appRoot);
dataTable = new DataTable(this.appRoot); dataTable = new DataTable(this.appRoot);
pagination = new Pagination(this.appRoot); pagination = new Pagination(this.appRoot);