mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-06-02 17:34:51 +00:00
[ACA-1674] Automated tests for "Mark as Favorite" in FileLibraries list view (#583)
* Favorite-FileLibraries * Favorite-FileLibraries fix * Favorite - FileLibraries - fix the comments * Favorite - FileLibraries - fix variable * [ADF-1674] fix failing tests
This commit is contained in:
parent
4f56095774
commit
823e80d8ed
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { SIDEBAR_LABELS } from '../../configs';
|
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
@ -37,8 +37,14 @@ describe('Mark items as favorites', () => {
|
|||||||
const file3Fav = `file-${Utils.random()}.txt`;
|
const file3Fav = `file-${Utils.random()}.txt`;
|
||||||
const file4Fav = `file-${Utils.random()}.txt`;
|
const file4Fav = `file-${Utils.random()}.txt`;
|
||||||
const folder1 = `folder-${Utils.random()}`;
|
const folder1 = `folder-${Utils.random()}`;
|
||||||
|
const siteName = `site-public-${Utils.random()}`;
|
||||||
|
const fileSiteNotFav1 = `file-site${Utils.random()}.txt`;
|
||||||
|
const fileSiteNotFav2 = `file-site${Utils.random()}.txt`;
|
||||||
|
const folderSite = `folder-${Utils.random()}`;
|
||||||
|
const fileSiteFav1 = `file-${Utils.random()}.txt`;
|
||||||
|
const fileSiteFav2 = `file-${Utils.random()}.txt`;
|
||||||
|
|
||||||
let file1Id, file2Id, file3Id, file4Id, folder1Id;
|
let file1Id, file2Id, file3Id, file4Id, folder1Id, fileSiteNotFav1Id, fileSiteNotFav2Id, folderSiteId, fileSiteFav1Id, fileSiteFav2Id;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
@ -70,7 +76,8 @@ describe('Mark items as favorites', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id ]),
|
apis.user.nodes.deleteNodesById([ file1Id, file2Id, file3Id, file4Id, folder1Id]),
|
||||||
|
apis.user.sites.deleteSite(siteName),
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
])
|
||||||
.then(done);
|
.then(done);
|
||||||
@ -423,4 +430,112 @@ describe('Mark items as favorites', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe ('on File Libraries', () => {
|
||||||
|
const fileLibrariesPage = new BrowsingPage();
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
|
||||||
|
const docLibId = (await apis.user.sites.getDocLibId(siteName));
|
||||||
|
folderSiteId = (await apis.user.nodes.createFolder(folderSite, docLibId)).entry.id;
|
||||||
|
fileSiteNotFav1Id = (await apis.user.nodes.createFile(fileSiteNotFav1, folderSiteId)).entry.id;
|
||||||
|
fileSiteFav1Id = (await apis.user.nodes.createFile(fileSiteFav1, folderSiteId)).entry.id;
|
||||||
|
fileSiteNotFav2Id = (await apis.user.nodes.createFile(fileSiteNotFav2, folderSiteId)).entry.id;
|
||||||
|
fileSiteFav2Id = (await apis.user.nodes.createFile(fileSiteFav2, folderSiteId)).entry.id;
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async (done) => {
|
||||||
|
await fileLibrariesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||||
|
await fileLibrariesPage.dataTable.waitForHeader();
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(siteName);
|
||||||
|
await fileLibrariesPage.dataTable.waitForHeader();
|
||||||
|
await toolbar.actions.closeMoreMenu();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async (done) => {
|
||||||
|
await browser.refresh();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Favorite a folder - [C280391]', async () => {
|
||||||
|
await dataTable.selectItem(folderSite);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 3 });
|
||||||
|
const isFavorite = await apis.user.favorites.isFavorite(folderSiteId);
|
||||||
|
expect(isFavorite).toBe(true, `${folderSite} not marked as favorite`);
|
||||||
|
await apis.user.favorites.removeFavoriteById(folderSiteId);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Favorite a file - [C280342]', async () => {
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
|
||||||
|
await dataTable.selectItem(fileSiteNotFav1);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 3 });
|
||||||
|
const isFavorite = await apis.user.favorites.isFavorite(fileSiteNotFav1Id);
|
||||||
|
expect(isFavorite).toBe(true, `${fileSiteNotFav1} not marked as favorite`);
|
||||||
|
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unfavorite an item - [C280343]', async () => {
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
|
||||||
|
await dataTable.selectItem(fileSiteFav1);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 3 });
|
||||||
|
const isFavorite = await apis.user.favorites.isFavorite(fileSiteFav1Id);
|
||||||
|
expect(isFavorite).toBe(false, `${fileSiteFav1} is marked as favorite`);
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Favorite multiple items - all unfavorite - [C280345]', async () => {
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
|
||||||
|
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteNotFav2 ]);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 4 });
|
||||||
|
const listItems1 = await Promise.all([
|
||||||
|
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
|
||||||
|
apis.user.favorites.isFavorite(fileSiteNotFav2Id)
|
||||||
|
]);
|
||||||
|
expect(listItems1[0]).toBe(true, 'item not marked as favorite');
|
||||||
|
expect(listItems1[1]).toBe(true, 'item not marked as favorite');
|
||||||
|
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
|
||||||
|
await apis.user.favorites.removeFavoriteById(fileSiteNotFav2Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unfavorite multiple items - [C280346]', async () => {
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
|
||||||
|
await dataTable.selectMultipleItems([ fileSiteFav1, fileSiteFav2 ]);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
const listItems2 = await Promise.all([
|
||||||
|
apis.user.favorites.isFavorite(fileSiteFav1Id),
|
||||||
|
apis.user.favorites.isFavorite(fileSiteFav2Id)
|
||||||
|
]);
|
||||||
|
expect(listItems2[0]).toBe(false, 'item marked as favorite');
|
||||||
|
expect(listItems2[1]).toBe(false, 'item marked as favorite');
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileSiteFav1Id);
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileSiteFav2Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Favorite multiple items - some favorite and some unfavorite - [C280347]', async () => {
|
||||||
|
await fileLibrariesPage.dataTable.doubleClickOnRowByName(folderSite);
|
||||||
|
await dataTable.selectMultipleItems([ fileSiteNotFav1, fileSiteFav1 ]);
|
||||||
|
await toolbar.actions.openMoreMenu();
|
||||||
|
await toolbar.actions.menu.clickMenuItem('Favorite');
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 3 });
|
||||||
|
const listItems3 = await Promise.all([
|
||||||
|
apis.user.favorites.isFavorite(fileSiteNotFav1Id),
|
||||||
|
apis.user.favorites.isFavorite(fileSiteFav1)
|
||||||
|
]);
|
||||||
|
expect(listItems3[0]).toBe(true, 'item not marked as favorite');
|
||||||
|
expect(listItems3[1]).toBe(true, 'item not marked as favorite');
|
||||||
|
await apis.user.favorites.removeFavoriteById(fileSiteNotFav1Id);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user