ACA Run the test against the remote env (#1669)

* Run the test against the remote env

* Use remote user

* exclude e2e and raise issue

* Exlude more

* small change to trigger travis

* add api method to get totalItems of various endpoints

* lint fix

* remove tests from excluded to see what fails

* - fix some issues with the screenshot plugin
- add methods to get total items for some endpoints
- fix some waitForApi calls to consider initial total items number
- sortByModified descending in order to find the item needed by the test when having items on multiple pages

* Try to fix screenshots

* a few more fixes

* Upload screenshots

* a few more fixes

* Delete e2e-output-${retry} at the end

* delete unused variable

* some changes

* lint

* try one more fix

* Try to fix retry

* a few more fixes

* Try to fix retry

* some more fixes

* Fix "on Recent Files" suite

* Move "on Search Results" at the beginning of the class in order to avoid waitForApi:catch

* Empty commit

* Empty commit

* Empty commit

* Run e2e with lite-server

* Exclude protractor report folder

* Remove useless config

* change browser size

* no message

* one more try

* Empty commit

* try to maximize

* fix upload Recent files tests

* revert maximizing the browser

* don't "Run e2e with lite-server"

* fix mark-favorite tests

* few more fixes

* fix viewer and share tests

* test the lite server with retry

* Verify suites with lite server

* some final fixes

* Try to use httpserver

* Print the file and use http server

* Use http-server to fix protractor retry

* more fixes

* forgot a space :|

* remove extra job not needed anymore
rename test data into more specific

* play with the screenshots

* try new run

* trigger one more run

* a few more little fixes

* Fix comments

* Remove comment

* Fix lint error

Co-authored-by: Adina Parpalita <Adina.Parpalita@ness.com>
Co-authored-by: Cristina Jalba <cristina.jalba@ness.com>
Co-authored-by: iuliaib <iulia.burca@ness.com>
This commit is contained in:
Maurizio Vitale
2020-09-18 12:01:55 +01:00
committed by GitHub
parent 88e94a4ec9
commit 9b0c31073a
53 changed files with 1270 additions and 787 deletions

View File

@@ -11,7 +11,7 @@ function buildNumber() {
return process.env.TRAVIS_BUILD_NUMBER;
}
async function uploadScreenshot(retryCount, suffixFileName) {
async function uploadScreenshot(retryCount) {
console.log(`Start uploading report ${retryCount}`);
let alfrescoJsApi = new AlfrescoApi({
@@ -23,31 +23,58 @@ async function uploadScreenshot(retryCount, suffixFileName) {
let folderNode;
const screenshotSavePath = `Builds/ACA/${buildNumber()}/${process.env.TRAVIS_JOB_NAME}`;
try {
folderNode = await alfrescoJsApi.nodes.addNode('-my-', {
'name': `retry-${retryCount}`,
'relativePath': `Builds/ACA/${buildNumber()}/`,
'relativePath': screenshotSavePath,
'nodeType': 'cm:folder'
}, {}, {
'overwrite': true
});
} catch (error) {
folderNode = await alfrescoJsApi.nodes.getNode('-my-', {
'relativePath': `Builds/ACA/${buildNumber()}/retry-${retryCount}`,
'relativePath': `${screenshotSavePath}/retry-${retryCount}`,
'nodeType': 'cm:folder'
}, {}, {
'overwrite': true
});
}
fs.renameSync(path.resolve(__dirname, '../../e2e-output/'), path.resolve(__dirname, `../../e2e-output-${retryCount}/`))
const screenShotsPath = path.resolve(__dirname, '../../../e2e-output/screenshots/');
let files = fs.readdirSync(screenShotsPath);
for (const fileName of files) {
let pathFile = path.join(screenShotsPath, fileName);
let file = fs.createReadStream(pathFile);
let safeFileName = fileName.replace(new RegExp('"', 'g'), '');
try {
await alfrescoJsApi.upload.uploadFile(
file,
'',
folderNode.entry.id,
null,
{
name: safeFileName,
nodeType: 'cm:content',
autoRename: true,
}
);
} catch (error) {
console.log(error);
}
}
fs.renameSync(path.resolve(__dirname, '../../../e2e-output/'), path.resolve(__dirname, `../../e2e-output-${retryCount}/`))
const child_process = require("child_process");
child_process.execSync(` tar -czvf ../e2e-result-${suffixFileName}-${retryCount}.tar .`, {
child_process.execSync(` tar -czvf ../e2e-result-${process.env.TRAVIS_JOB_NUMBER}-${retryCount}.tar .`, {
cwd: path.resolve(__dirname, `../../e2e-output-${retryCount}/`)
});
let pathFile = path.join(__dirname, `../../e2e-result-${suffixFileName}-${retryCount}.tar`);
let pathFile = path.join(__dirname, `../../e2e-result-${process.env.TRAVIS_JOB_NUMBER}-${retryCount}.tar`);
let file = fs.createReadStream(pathFile);
await alfrescoJsApi.upload.uploadFile(
file,
@@ -55,11 +82,12 @@ async function uploadScreenshot(retryCount, suffixFileName) {
folderNode.entry.id,
null,
{
'name': `e2e-result-${suffixFileName}-${retryCount}.tar`,
'name': `e2e-result-${process.env.TRAVIS_JOB_NUMBER}-${retryCount}.tar`,
'nodeType': 'cm:content',
'autoRename': true
}
);
fs.rmdirSync(path.resolve(__dirname, `../../e2e-output-${retryCount}/`), { recursive: true });
}
module.exports = {

View File

@@ -13,5 +13,7 @@
"C586778" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601",
"C586779" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601",
"C586780" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601",
"C586781" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601"
"C586781" : "Include once ACA starts using ACS 7+, https://issues.alfresco.com/jira/browse/ACA-3601",
"C280132" : "Shared files list is not empty on the live environment",
"C280094" : "Shared files list is not empty on the live environment"
}

View File

@@ -68,6 +68,8 @@ describe('Files / folders actions : ', () => {
parentId = (await userApi.nodes.createFolder(parent)).entry.id;
const initialSearchTotalItems = await userApi.search.getTotalItems(username);
await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocx.name);
fileDocxFavId = (await userApi.upload.uploadFileWithRename(FILES.docxFile, parentId, testData.fileDocxFav.name)).entry.id;
await userApi.nodes.createFile(testData.file.name, parentId);
@@ -85,8 +87,10 @@ describe('Files / folders actions : ', () => {
folderFavId = (await userApi.nodes.createFolder(testData.folderFav.name, parentId)).entry.id;
folderFav2Id = (await userApi.nodes.createFolder(testData.folderFav2.name, parentId)).entry.id;
await userApi.favorites.addFavoritesByIds('folder', [folderFavId, folderFav2Id]);
await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 12 });
const initialFavoritesTotalItems = await userApi.favorites.getFavoritesTotalItems();
await userApi.favorites.addFavoritesByIds('folder', [folderFavId, folderFav2Id]);
await userApi.favorites.addFavoritesByIds('file', [
fileDocxFavId,
fileFavId,
@@ -95,7 +99,9 @@ describe('Files / folders actions : ', () => {
fileFavLockedId,
fileSharedFavLockedId
]);
await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 8 });
const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems();
await userApi.shared.shareFilesByIds([
fileDocxSharedId,
fileDocxSharedFavId,
@@ -104,29 +110,13 @@ describe('Files / folders actions : ', () => {
fileSharedLockedId,
fileSharedFavLockedId
]);
await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 6 });
await userApi.nodes.lockFile(fileLockedId);
await userApi.nodes.lockFile(fileFavLockedId);
await userApi.nodes.lockFile(fileSharedLockedId);
await userApi.nodes.lockFile(fileSharedFavLockedId);
fileInTrashId = (await userApi.nodes.createFile(testData.fileInTrash.name)).entry.id;
file2InTrashId = (await userApi.nodes.createFile(testData.file2InTrash.name)).entry.id;
folderInTrashId = (await userApi.nodes.createFolder(testData.folderInTrash.name)).entry.id;
folder2InTrashId = (await userApi.nodes.createFolder(testData.folder2InTrash.name)).entry.id;
await userApi.nodes.deleteNodeById(fileInTrashId, false);
await userApi.nodes.deleteNodeById(file2InTrashId, false);
await userApi.nodes.deleteNodeById(folderInTrashId, false);
await userApi.nodes.deleteNodeById(folder2InTrashId, false);
await Promise.all([
userApi.favorites.waitForApi({ expect: 8 }),
userApi.shared.waitForApi({ expect: 6 }),
userApi.search.waitForApi(username, { expect: 12 }),
userApi.trashcan.waitForApi({ expect: 4 })
]);
await loginPage.loginWith(username);
});
@@ -164,6 +154,19 @@ describe('Files / folders actions : ', () => {
});
describe('on Trash : ', () => {
beforeAll(async () => {
fileInTrashId = (await userApi.nodes.createFile(testData.fileInTrash.name)).entry.id;
file2InTrashId = (await userApi.nodes.createFile(testData.file2InTrash.name)).entry.id;
folderInTrashId = (await userApi.nodes.createFolder(testData.folderInTrash.name)).entry.id;
folder2InTrashId = (await userApi.nodes.createFolder(testData.folder2InTrash.name)).entry.id;
const initialDeletedTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
await userApi.nodes.deleteNodeById(fileInTrashId, false);
await userApi.nodes.deleteNodeById(file2InTrashId, false);
await userApi.nodes.deleteNodeById(folderInTrashId, false);
await userApi.nodes.deleteNodeById(folder2InTrashId, false);
await userApi.trashcan.waitForApi({ expect: initialDeletedTotalItems + 4 });
});
trashTests();
});
});

View File

@@ -42,45 +42,45 @@ describe('Library actions : ', () => {
beforeAll(async () => {
await adminApiActions.createUser({ username });
const initialAdminSitesTotalItems = await adminApiActions.sites.getSitesTotalItems();
const initialUserSitesTotalItems = await userApi.sites.getSitesTotalItems();
const initialDeletedTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
const initialQuerySitesTotalItems = await userApi.queries.findSitesTotalItems('actionsSite-');
await userApi.sites.createSite(testData.publicUserMemberFav.name);
await userApi.sites.createSitePrivate(testData.privateUserMemberFav.name);
await userApi.sites.createSiteModerated(testData.moderatedUserMemberFav.name);
const publicUserMemberNotFavId = (await userApi.sites.createSite(testData.publicUserMemberNotFav.name)).entry.guid;
const privateUserMemberNotFavId = (await userApi.sites.createSitePrivate(testData.privateUserMemberNotFav.name)).entry.guid;
const moderatedUserMemberNotFavId = (await userApi.sites.createSiteModerated(testData.moderatedUserMemberNotFav.name)).entry.guid;
await adminApiActions.sites.createSite(testData.publicNotMemberFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberFav.name);
await adminApiActions.sites.createSite(testData.publicNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedNotMemberNotFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinFav.name);
await adminApiActions.sites.createSiteModerated(testData.moderatedRequestedJoinNotFav.name);
await userApi.sites.createSite(testData.siteInTrash.name);
await userApi.sites.createSite(testData.site2InTrash.name);
await Promise.all([userApi.sites.waitForApi({ expect: 8 }), adminApiActions.sites.waitForApi({ expect: 6 + 1 })]);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinNotFav.name);
await userApi.favorites.removeFavoritesByIds([publicUserMemberNotFavId, privateUserMemberNotFavId, moderatedUserMemberNotFavId]);
await userApi.favorites.addFavoritesByIds('site', [
testData.publicNotMemberFav.name,
testData.moderatedNotMemberFav.name,
testData.moderatedRequestedJoinFav.name
]);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinFav.name);
await userApi.sites.requestToJoin(testData.moderatedRequestedJoinNotFav.name);
await userApi.sites.waitForApi({ expect: initialUserSitesTotalItems + 6 });
await adminApiActions.sites.waitForApi({ expect: initialAdminSitesTotalItems + 6 });
await userApi.queries.waitForSites('actionsSite-', { expect: initialQuerySitesTotalItems + 12 });
await userApi.queries.waitForSites('site-', { expect: 14 + 1 });
await userApi.sites.createSite(testData.siteInTrash.name);
await userApi.sites.createSite(testData.site2InTrash.name);
await userApi.sites.deleteSite(testData.siteInTrash.name, false);
await userApi.sites.deleteSite(testData.site2InTrash.name, false);
await userApi.trashcan.waitForApi({ expect: 2 });
await userApi.trashcan.waitForApi({ expect: initialDeletedTotalItems + 2 });
await loginPage.loginWith(username);
});
@@ -243,7 +243,7 @@ describe('Library actions : ', () => {
await page.clickPersonalFiles();
await searchInput.clickSearchButton();
await searchInput.checkLibraries();
await searchInput.searchFor('site-');
await searchInput.searchFor('actionsSite-');
});
beforeEach(async () => {

View File

@@ -47,7 +47,7 @@ const reqJoinNotFavContextMenu = ['Cancel Join Request', 'Delete', 'Favorite'];
const reqJoinFavContextMenu = ['Cancel Join Request', 'Delete', 'Remove Favorite'];
export const publicUserMemberFav = {
name: `site-public-member-fav-${Utils.random()}`,
name: `actionsSite-public-member-fav-${Utils.random()}`,
description: 'public site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -57,7 +57,7 @@ export const publicUserMemberFav = {
};
export const privateUserMemberFav = {
name: `site-private-member-fav-${Utils.random()}`,
name: `actionsSite-private-member-fav-${Utils.random()}`,
description: 'private site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -67,7 +67,7 @@ export const privateUserMemberFav = {
};
export const moderatedUserMemberFav = {
name: `site-moderated-member-fav-${Utils.random()}`,
name: `actionsSite-moderated-member-fav-${Utils.random()}`,
description: 'moderated site, user member, user favorite',
contextMenu: memberFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -77,7 +77,7 @@ export const moderatedUserMemberFav = {
};
export const publicUserMemberNotFav = {
name: `site-public-member-not-fav-${Utils.random()}`,
name: `actionsSite-public-member-not-fav-${Utils.random()}`,
description: 'public site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -87,7 +87,7 @@ export const publicUserMemberNotFav = {
};
export const privateUserMemberNotFav = {
name: `site-private-member-not-fav-${Utils.random()}`,
name: `actionsSite-private-member-not-fav-${Utils.random()}`,
description: 'private site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -97,7 +97,7 @@ export const privateUserMemberNotFav = {
};
export const moderatedUserMemberNotFav = {
name: `site-moderated-member-not-fav-${Utils.random()}`,
name: `actionsSite-moderated-member-not-fav-${Utils.random()}`,
description: 'moderated site, user member, not favorite',
contextMenu: memberNotFavContextMenu,
toolbarPrimary: memberToolbarPrimary,
@@ -107,7 +107,7 @@ export const moderatedUserMemberNotFav = {
};
export const publicNotMemberFav = {
name: `site-public-not-member-fav-${Utils.random()}`,
name: `actionsSite-public-not-member-fav-${Utils.random()}`,
description: 'public site, user not member, user favorite',
contextMenu: notMemberFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
@@ -117,7 +117,7 @@ export const publicNotMemberFav = {
};
export const moderatedNotMemberFav = {
name: `site-moderated-not-member-fav-${Utils.random()}`,
name: `actionsSite-moderated-not-member-fav-${Utils.random()}`,
description: 'moderated site, user not member, user favorite',
contextMenu: notMemberFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
@@ -127,7 +127,7 @@ export const moderatedNotMemberFav = {
};
export const publicNotMemberNotFav = {
name: `site-public-not-member-not-fav-${Utils.random()}`,
name: `actionsSite-public-not-member-not-fav-${Utils.random()}`,
description: 'public site, user not member, not favorite',
contextMenu: notMemberNotFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
@@ -137,7 +137,7 @@ export const publicNotMemberNotFav = {
};
export const moderatedNotMemberNotFav = {
name: `site-moderated-not-member-not-fav-${Utils.random()}`,
name: `actionsSite-moderated-not-member-not-fav-${Utils.random()}`,
description: 'moderated site, user not member, not favorite',
contextMenu: notMemberNotFavContextMenu,
toolbarPrimary: notMemberToolbarPrimary,
@@ -147,7 +147,7 @@ export const moderatedNotMemberNotFav = {
};
export const moderatedRequestedJoinFav = {
name: `site-moderated-req-join-fav-${Utils.random()}`,
name: `actionsSite-moderated-req-join-fav-${Utils.random()}`,
description: 'moderated site, user requested join, user favorite',
contextMenu: reqJoinFavContextMenu,
toolbarPrimary: reqJoinToolbarMore,
@@ -157,7 +157,7 @@ export const moderatedRequestedJoinFav = {
};
export const moderatedRequestedJoinNotFav = {
name: `site-moderated-req-join-not-fav-${Utils.random()}`,
name: `actionsSite-moderated-req-join-not-fav-${Utils.random()}`,
description: 'moderated site, user requested join, not favorite',
contextMenu: reqJoinNotFavContextMenu,
toolbarPrimary: reqJoinToolbarMore,

View File

@@ -72,6 +72,11 @@ describe('Special permissions : ', () => {
await adminApiActions.createUser({ username: userCollaborator });
await adminApiActions.createUser({ username: userDemoted });
const consumerFavoritesTotalItems = await userConsumerApi.favorites.getFavoritesTotalItems();
const consumerSharedTotalItems = await userConsumerApi.shared.getSharedLinksTotalItems();
const managerSearchTotalItems = await userManagerApi.search.getTotalItems(userManager);
const collaboratorFavoritesTotalItems = await userCollaboratorApi.favorites.getFavoritesTotalItems();
await userManagerApi.sites.createSitePrivate(sitePrivate);
const docLibId = await userManagerApi.sites.getDocLibId(sitePrivate);
await userManagerApi.sites.addSiteConsumer(sitePrivate, userConsumer);
@@ -135,10 +140,10 @@ describe('Special permissions : ', () => {
await userManagerApi.favorites.addFavoriteById('file', fileLockedByUserId);
await Promise.all([
userConsumerApi.favorites.waitForApi({ expect: 9 }),
userConsumerApi.shared.waitForApi({ expect: 8 }),
userManagerApi.search.waitForApi(userManager, { expect: 14 }),
userCollaboratorApi.favorites.waitForApi({ expect: 2 })
userConsumerApi.favorites.waitForApi({ expect: consumerFavoritesTotalItems + 9 }),
userConsumerApi.shared.waitForApi({ expect: consumerSharedTotalItems + 8 }),
userManagerApi.search.waitForApi(userManager, { expect: managerSearchTotalItems + 14 }),
userCollaboratorApi.favorites.waitForApi({ expect: collaboratorFavoritesTotalItems + 2 })
]);
});

View File

@@ -41,42 +41,42 @@ describe('Copy content', () => {
const destinationSearch = `destinationSearch-${Utils.random()}`;
let destinationIdSearch: string;
const file1 = `file1-${Utils.random()}.txt`;
const file1 = `copy-file1-${Utils.random()}.txt`;
let file1Id: string;
const folder1 = `folder1-${Utils.random()}`;
const folder1 = `copy-folder1-${Utils.random()}`;
let folder1Id: string;
const fileInFolder = `fileInFolder-${Utils.random()}.txt`;
const fileInFolder = `copy-fileInFolder-${Utils.random()}.txt`;
let fileInFolderId: string;
const folder2 = `folder2-${Utils.random()}`;
const folder2 = `copy-folder2-${Utils.random()}`;
let folder2Id: string;
const fileInFolder2 = fileInFolder;
const folderExisting = `folder-existing-${Utils.random()}`;
const folderExisting = `copy-folder-existing-${Utils.random()}`;
let folderExistingId: string;
const file1InFolderExisting = `file1InFolderExisting-${Utils.random()}.txt`;
const file2InFolderExisting = `file2InFolderExisting-${Utils.random()}.txt`;
const file1InFolderExisting = `copy-file1InFolderExisting-${Utils.random()}.txt`;
const file2InFolderExisting = `copy-file2InFolderExisting-${Utils.random()}.txt`;
const file2 = `file2-${Utils.random()}.txt`;
const file2 = `copy-file2-${Utils.random()}.txt`;
let file2Id: string;
const file3 = `file3-${Utils.random()}.txt`;
const file3 = `copy-file3-${Utils.random()}.txt`;
let file3Id: string;
const file4 = `file4-${Utils.random()}.txt`;
const file4 = `copy-file4-${Utils.random()}.txt`;
let file4Id: string;
const fileLocked1 = `file-locked1-${Utils.random()}.txt`;
const fileLocked1 = `copy-file-locked1-${Utils.random()}.txt`;
let fileLocked1Id: string;
const folderWithLockedFiles = `folder-locked1-${Utils.random()}`;
const folderWithLockedFiles = `copy-folder-locked1-${Utils.random()}`;
let folderWithLockedFilesId: string;
const fileLockedInFolder = `file-locked-${Utils.random()}`;
const fileLockedInFolder = `copy-file-locked-${Utils.random()}`;
let fileLockedInFolderId: string;
const existingFile = `existing-${Utils.random()}.txt`;
const existingFile = `copy-existing-${Utils.random()}.txt`;
let existingFileToCopyId: string;
const existingFolder = `existing-${Utils.random()}`;
const existingFolder = `copy-existing-${Utils.random()}`;
let existingFolderToCopyId: string;
let existingIdPF: string;
@@ -86,15 +86,15 @@ describe('Copy content', () => {
let folderExistingFavId: string;
let folderExistingSearchId: string;
const file2InFolder = `file2InFolder-${Utils.random()}.txt`;
const file3InFolder = `file3InFolder-${Utils.random()}.txt`;
const file2InFolder = `copy-file2InFolder-${Utils.random()}.txt`;
const file3InFolder = `copy-file3InFolder-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const folderSitePF = `folderSitePersonal-${Utils.random()}`;
const folderSiteRF = `folderSiteRecent-${Utils.random()}`;
const folderSiteSF = `folderSiteShared-${Utils.random()}`;
const folderSiteFav = `folderSiteFav-${Utils.random()}`;
const folderSiteSearch = `folderSiteSearch-${Utils.random()}`;
const siteName = `copy-site-${Utils.random()}`;
const folderSitePF = `copy-folderSitePersonal-${Utils.random()}`;
const folderSiteRF = `copy-folderSiteRecent-${Utils.random()}`;
const folderSiteSF = `copy-folderSiteShared-${Utils.random()}`;
const folderSiteFav = `copy-folderSiteFav-${Utils.random()}`;
const folderSiteSearch = `copy-folderSiteSearch-${Utils.random()}`;
let locationId: string;
let destinationId: string;
@@ -113,6 +113,9 @@ describe('Copy content', () => {
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
sourceId = (await apis.user.nodes.createFolder(source)).entry.id;
destinationIdPF = (await apis.user.nodes.createFolder(destinationPF)).entry.id;
destinationIdRF = (await apis.user.nodes.createFolder(destinationRF)).entry.id;
@@ -202,8 +205,8 @@ describe('Copy content', () => {
await apis.user.nodes.createFolder(folderSiteFav, docLibId);
await apis.user.nodes.createFolder(folderSiteSearch, docLibId);
await apis.user.shared.waitForApi({ expect: 7 });
await apis.user.favorites.waitForApi({ expect: 13 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 });
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
await loginPage.loginWith(username);
done();
@@ -404,7 +407,7 @@ describe('Copy content', () => {
it('[C306944] Copy multiple items', async () =>
copyMultipleItems([file2, file3], source, destinationSearch, async () => {
await searchInput.searchFor('file');
await searchInput.searchFor('copy-file');
await dataTable.waitForBody();
}));
@@ -422,7 +425,7 @@ describe('Copy content', () => {
it('[C306942] Copy items into a library', async () =>
copyItemsIntoLibrary([file1, file2], source, folderSiteSearch, async () => {
await searchInput.searchFor('file');
await searchInput.searchFor('copy-file');
await dataTable.waitForBody();
}));

View File

@@ -418,6 +418,8 @@ describe('Move content', () => {
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, sourceIdSF)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
file2Id = (await apis.user.nodes.createFile(file2, sourceIdSF)).entry.id;
@@ -432,15 +434,14 @@ describe('Move content', () => {
file4Id = (await apis.user.nodes.createFile(file4, sourceIdSF)).entry.id;
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 5 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 });
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await Utils.pressEscape();
await page.clickSharedFilesAndWait();
done();
});
it('[C280243] Move a file', async () => {

View File

@@ -37,14 +37,99 @@ describe('Delete and undo delete', () => {
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
beforeAll(async (done) => {
beforeAll(async () => {
await apis.admin.people.createUser({ username });
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.trashcan.emptyTrash();
done();
});
describe('on Recent Files', () => {
const parent = `parentRF-${Utils.random()}`;
let parentId: string;
const recentFile1 = `recentFile1-${Utils.random()}.txt`;
const recentFile2 = `recentFile2-${Utils.random()}.txt`;
const recentFile3 = `recentFile3-${Utils.random()}.txt`;
const recentFile4 = `recentFile4-${Utils.random()}.txt`;
const recentFile5 = `recentFile5-${Utils.random()}.txt`;
const recentFile6 = `recentFile6-${Utils.random()}.txt`;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
const initialRecentTotalItems = await apis.user.search.getTotalItems(username);
await apis.user.nodes.createFile(recentFile1, parentId);
await apis.user.nodes.createFile(recentFile2, parentId);
await apis.user.nodes.createFile(recentFile3, parentId);
await apis.user.nodes.createFile(recentFile4, parentId);
await apis.user.nodes.createFile(recentFile5, parentId);
await apis.user.nodes.createFile(recentFile6, parentId);
await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 6 });
await loginPage.loginWith(username);
done();
});
beforeEach(async () => {
await page.clickRecentFilesAndWait();
});
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
});
it('[C280528] delete a file and check notification', async () => {
await dataTable.selectItem(recentFile1);
await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage();
expect(message).toContain(`${recentFile1} deleted`);
expect(message).toContain(`Undo`);
expect(await dataTable.isItemPresent(recentFile1)).toBe(false, 'Item was not removed from list');
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile1)).toBe(true, 'Item is not in trash');
});
it('[C280529] delete multiple files and check notification', async () => {
await dataTable.selectMultipleItems([recentFile2, recentFile3]);
await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`);
expect(message).toContain(`Undo`);
expect(await dataTable.isItemPresent(recentFile2)).toBe(false, `${recentFile2} was not removed from list`);
expect(await dataTable.isItemPresent(recentFile3)).toBe(false, `${recentFile3} was not removed from list`);
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile2)).toBe(true, `${recentFile2} is not in trash`);
expect(await dataTable.isItemPresent(recentFile3)).toBe(true, `${recentFile3} is not in trash`);
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('[C280536] undo delete of file', async () => {
await dataTable.selectItem(recentFile4);
await toolbar.clickMoreActionsDelete();
await page.clickSnackBarAction();
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile4)).toBe(false, 'Item is in Trash');
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('[C280537] undo delete of multiple files', async () => {
await dataTable.selectMultipleItems([recentFile5, recentFile6]);
await toolbar.clickMoreActionsDelete();
await page.clickSnackBarAction();
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile5)).toBe(false, `${recentFile5} is in Trash`);
expect(await dataTable.isItemPresent(recentFile6)).toBe(false, `${recentFile6} is in Trash`);
});
});
describe('on Personal Files', () => {
@@ -118,20 +203,18 @@ describe('Delete and undo delete', () => {
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(parent);
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.unlockFile(fileLocked1Id);
await apis.user.nodes.unlockFile(fileLocked2Id);
await apis.user.nodes.unlockFile(fileLocked3Id);
await apis.user.nodes.unlockFile(fileLocked4Id);
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
done();
});
it('[C217125] delete a file and check notification', async () => {
@@ -264,8 +347,10 @@ describe('Delete and undo delete', () => {
sharedFile4Id = (await apis.user.nodes.createFile(sharedFile4, parentId)).entry.id;
sharedFile5Id = (await apis.user.nodes.createFile(sharedFile5, parentId)).entry.id;
sharedFile6Id = (await apis.user.nodes.createFile(sharedFile6, parentId)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([sharedFile1Id, sharedFile2Id, sharedFile3Id, sharedFile4Id, sharedFile5Id, sharedFile6Id]);
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 });
await loginPage.loginWith(username);
done();
@@ -370,6 +455,8 @@ describe('Delete and undo delete', () => {
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
favFile1Id = (await apis.user.nodes.createFile(favFile1, parentId)).entry.id;
favFile2Id = (await apis.user.nodes.createFile(favFile2, parentId)).entry.id;
favFile3Id = (await apis.user.nodes.createFile(favFile3, parentId)).entry.id;
@@ -399,7 +486,7 @@ describe('Delete and undo delete', () => {
await apis.user.favorites.addFavoritesByIds('file', [favFile1Id, favFile2Id, favFile3Id, favFile4Id, favFile5Id, favFile6Id, favFile7Id]);
await apis.user.favorites.addFavoritesByIds('folder', [favFolder1Id, favFolder2Id, favFolder3Id, favFolder4Id, favFolder5Id, favFolder6Id]);
await apis.user.favorites.waitForApi({ expect: 13 });
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 13 });
await loginPage.loginWith(username);
done();
@@ -524,93 +611,4 @@ describe('Delete and undo delete', () => {
expect(await page.pagination.getRange()).toContain(`1-${items} of ${items}`);
});
});
describe('on Recent Files', () => {
const parent = `parentRF-${Utils.random()}`;
let parentId: string;
const recentFile1 = `recentFile1-${Utils.random()}.txt`;
const recentFile2 = `recentFile2-${Utils.random()}.txt`;
const recentFile3 = `recentFile3-${Utils.random()}.txt`;
const recentFile4 = `recentFile4-${Utils.random()}.txt`;
const recentFile5 = `recentFile5-${Utils.random()}.txt`;
const recentFile6 = `recentFile6-${Utils.random()}.txt`;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.nodes.createFile(recentFile1, parentId);
await apis.user.nodes.createFile(recentFile2, parentId);
await apis.user.nodes.createFile(recentFile3, parentId);
await apis.user.nodes.createFile(recentFile4, parentId);
await apis.user.nodes.createFile(recentFile5, parentId);
await apis.user.nodes.createFile(recentFile6, parentId);
await apis.user.search.waitForApi(username, { expect: 6 });
await loginPage.loginWith(username);
await page.clickRecentFiles();
done();
});
beforeEach(async (done) => {
await page.clickRecentFilesAndWait();
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
await apis.user.trashcan.emptyTrash();
done();
});
it('[C280528] delete a file and check notification', async () => {
await dataTable.selectItem(recentFile1);
await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage();
expect(message).toContain(`${recentFile1} deleted`);
expect(message).toContain(`Undo`);
expect(await dataTable.isItemPresent(recentFile1)).toBe(false, 'Item was not removed from list');
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile1)).toBe(true, 'Item is not in trash');
});
it('[C280529] delete multiple files and check notification', async () => {
await dataTable.selectMultipleItems([recentFile2, recentFile3]);
await toolbar.clickMoreActionsDelete();
const message = await page.getSnackBarMessage();
expect(message).toContain(`Deleted 2 items`);
expect(message).toContain(`Undo`);
expect(await dataTable.isItemPresent(recentFile2)).toBe(false, `${recentFile2} was not removed from list`);
expect(await dataTable.isItemPresent(recentFile3)).toBe(false, `${recentFile3} was not removed from list`);
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile2)).toBe(true, `${recentFile2} is not in trash`);
expect(await dataTable.isItemPresent(recentFile3)).toBe(true, `${recentFile3} is not in trash`);
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('[C280536] undo delete of file', async () => {
await dataTable.selectItem(recentFile4);
await toolbar.clickMoreActionsDelete();
await page.clickSnackBarAction();
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile4)).toBe(false, 'Item is in Trash');
});
// due to the fact that the search api is slow to update,
// we cannot test that the restored file is displayed in the Recent Files list
// without adding a very big browser.sleep followed by a page.refresh
// so for the moment we're testing that the restored file is not displayed in the Trash
it('[C280537] undo delete of multiple files', async () => {
await dataTable.selectMultipleItems([recentFile5, recentFile6]);
await toolbar.clickMoreActionsDelete();
await page.clickSnackBarAction();
await page.clickTrash();
expect(await dataTable.isItemPresent(recentFile5)).toBe(false, `${recentFile5} is in Trash`);
expect(await dataTable.isItemPresent(recentFile6)).toBe(false, `${recentFile6} is in Trash`);
});
});
});

View File

@@ -73,9 +73,15 @@ describe('Download', () => {
const searchResultsPage = new SearchResultsPage();
const { searchInput } = searchResultsPage.header;
let initialSharedTotalItems: number;
let initialFavoritesTotalItems: number;
let initialRecentTotalItems: number;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
initialRecentTotalItems = await apis.user.search.getTotalItems(username);
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
await apis.user.nodes.createFile(filePersonal, parentId);
@@ -95,10 +101,17 @@ describe('Download', () => {
folderSearchId = (await apis.user.nodes.createFolder(folderSearch, parentId)).entry.id;
await apis.user.nodes.createFile(fileInFolderSearch, folderSearchId);
await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 10 });
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(fileShared1Id);
await apis.user.shared.shareFileById(fileShared2Id);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 2 });
initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
await apis.user.favorites.addFavoriteById('file', fileFavoritesId);
await apis.user.favorites.addFavoriteById('folder', folderFavoritesId);
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 2 });
await loginPage.loginWith(username);
done();
@@ -160,11 +173,6 @@ describe('Download', () => {
});
describe('on Favorites', () => {
beforeAll(async (done) => {
await apis.user.favorites.waitForApi({ expect: 2 });
done();
});
beforeEach(async (done) => {
await page.clickFavoritesAndWait();
done();
@@ -208,11 +216,6 @@ describe('Download', () => {
});
describe('on Shared Files', () => {
beforeAll(async (done) => {
await apis.user.shared.waitForApi({ expect: 2 });
done();
});
beforeEach(async (done) => {
await page.clickSharedFilesAndWait();
done();
@@ -239,11 +242,6 @@ describe('Download', () => {
});
describe('on Recent Files', () => {
beforeAll(async (done) => {
await apis.user.search.waitForApi(username, { expect: 10 });
done();
});
beforeEach(async (done) => {
await page.clickRecentFilesAndWait();
done();

View File

@@ -83,6 +83,7 @@ describe('Edit folder', () => {
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
await apis.admin.nodes.createFolder(folderName, docLibId);
@@ -103,6 +104,7 @@ describe('Edit folder', () => {
folderFavoriteToEditId = (await apis.user.nodes.createFolder(folderFavoriteToEdit)).entry.id;
folderFavoriteDuplicateId = (await apis.user.nodes.createFolder(folderFavoriteDuplicate)).entry.id;
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('folder-search');
await apis.user.nodes.createFolder(folderSearch);
folderSearchToEditId = (await apis.user.nodes.createFolder(folderSearchToEdit)).entry.id;
await apis.user.nodes.createFolder(folderSearchDuplicate);
@@ -111,6 +113,8 @@ describe('Edit folder', () => {
await apis.user.favorites.addFavoriteById('folder', folderFavoriteToEditId);
await apis.user.favorites.addFavoriteById('folder', folderFavoriteDuplicateId);
await apis.user.search.waitForNodes('folder-search', { expect: initialSearchByTermTotalItems + 3 });
await loginPage.loginWith(username);
done();
});
@@ -314,11 +318,6 @@ describe('Edit folder', () => {
});
describe('on Search Results', () => {
beforeAll(async (done) => {
await apis.user.search.waitForNodes('folder-search', { expect: 3 });
done();
});
it('[C306947] properties are modified when pressing OK', async () => {
await page.clickPersonalFiles();
await searchInput.clickSearchButton();

View File

@@ -129,8 +129,9 @@ describe('Edit offline', () => {
await apis.user.nodes.lockFile(fileLockedId);
await apis.user.nodes.lockFile(fileLocked2Id);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file1Id, fileLockedId, fileLocked2Id]);
await apis.user.shared.waitForApi({ expect: 3 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 });
await loginPage.loginWith(username);
});
@@ -283,6 +284,7 @@ describe('Edit offline', () => {
beforeAll(async () => {
parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id;
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('file-search');
fileSearch1Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearch1)).entry.id;
fileSearchLockedId = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked)).entry.id;
fileSearchLocked2Id = (await apis.user.upload.uploadFileWithRename(FILES.docxFile, parentSearchId, fileSearchLocked2)).entry.id;
@@ -290,7 +292,7 @@ describe('Edit offline', () => {
await apis.user.nodes.lockFile(fileSearchLockedId);
await apis.user.nodes.lockFile(fileSearchLocked2Id);
await apis.user.search.waitForNodes('file-search', { expect: 3 });
await apis.user.search.waitForNodes('file-search', { expect: initialSearchByTermTotalItems + 3 });
await loginPage.loginWith(username);
});

View File

@@ -94,27 +94,29 @@ describe('Library actions', () => {
done();
});
afterAll(async (done) => {
await apis.admin.sites.deleteSite(sitePublic1Admin);
await apis.admin.sites.deleteSite(siteSearchPublic1Admin);
await apis.admin.sites.deleteSite(sitePublic2Admin);
await apis.admin.sites.deleteSite(sitePublic3Admin);
await apis.admin.sites.deleteSite(sitePublic4Admin);
await apis.admin.sites.deleteSite(sitePublic5Admin);
await apis.admin.sites.deleteSite(sitePublic6Admin);
await apis.admin.sites.deleteSite(sitePublic7Admin);
await apis.admin.sites.deleteSite(sitePublic8Admin);
await apis.admin.sites.deleteSite(siteSearchPublic2Admin);
await apis.admin.sites.deleteSite(siteSearchPublic3Admin);
await apis.admin.sites.deleteSite(siteSearchPublic4Admin);
await apis.admin.sites.deleteSite(siteModerated1Admin);
await apis.admin.sites.deleteSite(siteModerated2Admin);
await apis.admin.sites.deleteSite(siteSearchModerated1Admin);
await apis.admin.sites.deleteSite(siteSearchModerated2Admin);
afterAll(async () => {
await apis.admin.sites.deleteSites([
sitePublic1Admin,
siteSearchPublic1Admin,
sitePublic2Admin,
sitePublic3Admin,
sitePublic4Admin,
sitePublic5Admin,
sitePublic6Admin,
sitePublic7Admin,
sitePublic8Admin
]);
await apis.admin.sites.deleteSites([
siteSearchPublic2Admin,
siteSearchPublic3Admin,
siteSearchPublic4Admin,
siteModerated1Admin,
siteModerated2Admin,
siteSearchModerated1Admin,
siteSearchModerated2Admin
]);
await apis.user.sites.deleteSite(sitePublicUser);
await apis.admin.trashcan.emptyTrash();
done();
await apis.user.trashcan.emptyTrash();
});
describe('Join a public library', () => {

View File

@@ -100,25 +100,14 @@ describe('Mark items as favorites', () => {
fileFav4Id = (await apis.user.nodes.createFile(fileFav4, parentId)).entry.id;
folderId = (await apis.user.nodes.createFolder(folder, parentId)).entry.id;
fileSearchNotFav1Id = (await apis.user.nodes.createFile(fileSearchNotFav1, parentId)).entry.id;
fileSearchNotFav2Id = (await apis.user.nodes.createFile(fileSearchNotFav2, parentId)).entry.id;
fileSearchNotFav3Id = (await apis.user.nodes.createFile(fileSearchNotFav3, parentId)).entry.id;
fileSearchNotFav4Id = (await apis.user.nodes.createFile(fileSearchNotFav4, parentId)).entry.id;
fileSearchFav1Id = (await apis.user.nodes.createFile(fileSearchFav1, parentId)).entry.id;
fileSearchFav2Id = (await apis.user.nodes.createFile(fileSearchFav2, parentId)).entry.id;
fileSearchFav3Id = (await apis.user.nodes.createFile(fileSearchFav3, parentId)).entry.id;
fileSearchFav4Id = (await apis.user.nodes.createFile(fileSearchFav4, parentId)).entry.id;
folderSearchId = (await apis.user.nodes.createFolder(folderSearch, parentId)).entry.id;
const currentFavoritesFiles = (await apis.user.favorites.getFavorites()).list.pagination.totalItems;
const currentFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
await apis.user.favorites.addFavoritesByIds('file', [fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.favorites.addFavoritesByIds('file', [fileSearchFav1Id, fileSearchFav2Id, fileSearchFav3Id, fileSearchFav4Id]);
await apis.user.favorites.waitForApi({ expect: currentFavoritesFiles + 9 });
await apis.user.favorites.waitForApi({ expect: currentFavoritesTotalItems + 5 });
const currentSharedFiles = (await apis.user.shared.getSharedLinks()).list.pagination.totalItems;
const currentSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.shared.shareFilesByIds([fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id]);
await apis.user.shared.waitForApi({ expect: currentSharedFiles + 8 });
await apis.user.shared.waitForApi({ expect: currentSharedTotalItems + 8 });
await loginPage.loginWith(username);
done();
@@ -140,7 +129,6 @@ describe('Mark items as favorites', () => {
await apis.user.favorites.addFavoritesByIds('file', [fileFavUIId, fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.favorites.addFavoriteById('folder', folderId);
await apis.user.favorites.removeFavoritesByIds([fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id]);
await apis.user.favorites.waitForApi({ expect: 10 });
} catch (error) {}
done();
});
@@ -224,10 +212,8 @@ describe('Mark items as favorites', () => {
describe('on Recent Files', () => {
afterAll(async (done) => {
try {
const currentFavoritesFiles = (await apis.user.favorites.getFavorites()).list.pagination.totalItems;
await apis.user.favorites.addFavoritesByIds('file', [fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.favorites.removeFavoritesByIds([fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id]);
await apis.user.favorites.waitForApi({ expect: currentFavoritesFiles - 1 });
} catch (error) {}
done();
});
@@ -282,7 +268,6 @@ describe('Mark items as favorites', () => {
try {
await apis.user.favorites.addFavoritesByIds('file', [fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.favorites.removeFavoritesByIds([fileNotFav1Id, fileNotFav2Id, fileNotFav3Id, fileNotFav4Id]);
await apis.user.favorites.waitForApi({ expect: 10 });
} catch (error) {}
done();
});
@@ -336,16 +321,14 @@ describe('Mark items as favorites', () => {
afterAll(async (done) => {
try {
await apis.user.favorites.addFavoritesByIds('file', [fileFav1Id, fileFav2Id, fileFav3Id, fileFav4Id]);
await apis.user.favorites.waitForApi({ expect: 10 });
} catch (error) {}
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await Utils.pressEscape();
await page.refresh();
await page.clickFavoritesAndWait();
done();
});
it('[C280368] unfavorite an item', async () => {
@@ -377,7 +360,20 @@ describe('Mark items as favorites', () => {
describe('on Search Results', () => {
beforeAll(async (done) => {
await apis.user.search.waitForNodes('search-f', { expect: 9 });
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f');
fileSearchNotFav1Id = (await apis.user.nodes.createFile(fileSearchNotFav1, parentId)).entry.id;
fileSearchNotFav2Id = (await apis.user.nodes.createFile(fileSearchNotFav2, parentId)).entry.id;
fileSearchNotFav3Id = (await apis.user.nodes.createFile(fileSearchNotFav3, parentId)).entry.id;
fileSearchNotFav4Id = (await apis.user.nodes.createFile(fileSearchNotFav4, parentId)).entry.id;
fileSearchFav1Id = (await apis.user.nodes.createFile(fileSearchFav1, parentId)).entry.id;
fileSearchFav2Id = (await apis.user.nodes.createFile(fileSearchFav2, parentId)).entry.id;
fileSearchFav3Id = (await apis.user.nodes.createFile(fileSearchFav3, parentId)).entry.id;
fileSearchFav4Id = (await apis.user.nodes.createFile(fileSearchFav4, parentId)).entry.id;
folderSearchId = (await apis.user.nodes.createFolder(folderSearch, parentId)).entry.id;
await apis.user.search.waitForNodes('search-f', { expect: initialSearchByTermTotalItems + 9 });
await apis.user.favorites.addFavoritesByIds('file', [fileSearchFav1Id, fileSearchFav2Id, fileSearchFav3Id, fileSearchFav4Id]);
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('search-f');
@@ -385,10 +381,9 @@ describe('Mark items as favorites', () => {
done();
});
afterAll(async (done) => {
afterAll(async () => {
await page.header.expandSideNav();
await page.clickPersonalFiles();
done();
});
it('[C306966] favorite a file', async () => {

View File

@@ -73,19 +73,20 @@ describe('Share a file', () => {
describe('when logged out', () => {
let file6SharedLink: string;
let initialTotalItems: number;
beforeAll(async (done) => {
beforeAll(async () => {
file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
const sharedId = (await apis.user.shared.shareFileById(file6Id)).entry.id;
file6SharedLink = `${shareLinkPreUrl}${sharedId}`;
await apis.user.shared.waitForApi({ expect: 1 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 1 });
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file6Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286326] A non-logged user can download the shared file from the viewer', async () => {
@@ -106,13 +107,14 @@ describe('Share a file', () => {
const contextMenu = dataTable.menu;
const { searchInput } = page.header;
beforeAll(async (done) => {
beforeAll(async () => {
await loginPage.loginWith(username);
done();
});
describe('from Personal Files', () => {
beforeAll(async (done) => {
let initialTotalItems: number;
beforeAll(async () => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
@@ -122,25 +124,24 @@ describe('Share a file', () => {
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.shared.waitForApi({ expect: 2 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
@@ -150,8 +151,7 @@ describe('Share a file', () => {
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.nodes.deleteNodeById(file8Id);
await apis.user.nodes.deleteNodeById(file9Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286327] Share dialog default values', async () => {
@@ -293,8 +293,9 @@ describe('Share a file', () => {
const siteName = `site-${Utils.random()}`;
const parentInSite = `parent-site-${Utils.random()}`;
let parentInSiteId: string;
let initialTotalItems: number;
beforeAll(async (done) => {
beforeAll(async () => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
const docLibId = await apis.user.sites.getDocLibId(siteName);
parentInSiteId = (await apis.user.nodes.createFolder(parentInSite, docLibId)).entry.id;
@@ -308,31 +309,29 @@ describe('Share a file', () => {
file7Id = (await apis.user.nodes.createFile(file7, parentInSiteId)).entry.id;
await apis.user.nodes.createFile(file8, parentInSiteId);
file9Id = (await apis.user.nodes.createFile(file9, parentInSiteId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.shared.waitForApi({ expect: 2 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
await dataTable.doubleClickOnRowByName(parentInSite);
await dataTable.waitForHeader();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.admin.sites.deleteSite(siteName);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286639] Share dialog default values', async () => {
@@ -471,7 +470,9 @@ describe('Share a file', () => {
});
describe('from Recent Files', () => {
beforeAll(async (done) => {
let initialTotalItems: number;
beforeAll(async () => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
@@ -481,24 +482,23 @@ describe('Share a file', () => {
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.shared.waitForApi({ expect: 2 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickRecentFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
@@ -508,8 +508,7 @@ describe('Share a file', () => {
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.nodes.deleteNodeById(file8Id);
await apis.user.nodes.deleteNodeById(file9Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286657] Share dialog default values', async () => {
@@ -648,7 +647,9 @@ describe('Share a file', () => {
});
describe('from Shared Files', () => {
beforeAll(async (done) => {
let initialTotalItems: number;
beforeAll(async () => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
@@ -657,6 +658,7 @@ describe('Share a file', () => {
file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
@@ -664,22 +666,19 @@ describe('Share a file', () => {
await apis.user.shared.shareFileById(file5Id, expiryDate);
await apis.user.shared.shareFileById(file6Id);
await apis.user.shared.shareFileById(file7Id);
await apis.user.shared.waitForApi({ expect: 7 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 7 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
@@ -687,8 +686,7 @@ describe('Share a file', () => {
await apis.user.nodes.deleteNodeById(file5Id);
await apis.user.nodes.deleteNodeById(file6Id);
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286648] Share dialog default values', async () => {
@@ -797,7 +795,9 @@ describe('Share a file', () => {
});
describe('from Favorites', () => {
beforeAll(async (done) => {
let initialTotalItems: number;
beforeAll(async () => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
@@ -808,6 +808,7 @@ describe('Share a file', () => {
file8Id = (await apis.user.nodes.createFile(file8, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('file', file2Id);
await apis.user.favorites.addFavoriteById('file', file3Id);
@@ -821,22 +822,19 @@ describe('Share a file', () => {
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.favorites.waitForApi({ expect: 9 });
await apis.user.shared.waitForApi({ expect: 2 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickFavoritesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
@@ -846,8 +844,7 @@ describe('Share a file', () => {
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.nodes.deleteNodeById(file8Id);
await apis.user.nodes.deleteNodeById(file9Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C286666] Share dialog default values', async () => {
@@ -992,41 +989,42 @@ describe('Share a file', () => {
file7 = `search-file7-${Utils.random()}.txt`;
file9 = `search-file9-${Utils.random()}.txt`;
beforeAll(async (done) => {
let initialTotalItems: number;
beforeAll(async () => {
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f');
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file5Id = (await apis.user.nodes.createFile(file5, parentId)).entry.id;
file6Id = (await apis.user.nodes.createFile(file6, parentId)).entry.id;
file7Id = (await apis.user.nodes.createFile(file7, parentId)).entry.id;
file9Id = (await apis.user.nodes.createFile(file9, parentId)).entry.id;
await apis.user.search.waitForNodes('search-f', { expect: initialSearchByTermTotalItems + 5 });
initialTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file6Id, expiryDate);
await apis.user.shared.shareFileById(file7Id, expiryDate);
await apis.user.shared.waitForApi({ expect: 2 });
await apis.user.search.waitForNodes('search-f', { expect: 5 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems + 2 });
});
beforeEach(async (done) => {
beforeEach(async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor('search-f');
await dataTable.waitForBody();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file5Id);
await apis.user.nodes.deleteNodeById(file6Id);
await apis.user.nodes.deleteNodeById(file7Id);
await apis.user.nodes.deleteNodeById(file9Id);
await apis.user.shared.waitForApi({ expect: 0 });
done();
await apis.user.shared.waitForApi({ expect: initialTotalItems });
});
it('[C306975] Share a file', async () => {

View File

@@ -76,11 +76,13 @@ describe('Unshare a file from Search Results', () => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
const initialSearchByTermTotalItems = await apis.user.search.getSearchByTermTotalItems('search-file');
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
@@ -97,8 +99,8 @@ describe('Unshare a file from Search Results', () => {
await apis.admin.shared.shareFileById(fileSite1Id);
await apis.user.shared.shareFileById(fileSite2Id);
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.search.waitForNodes('search-file', { expect: 6 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 });
await apis.user.search.waitForNodes('search-file', { expect: initialSearchByTermTotalItems + 6 });
await loginPage.loginWith(username);
done();

View File

@@ -76,17 +76,19 @@ describe('Unshare a file', () => {
let file3Id: string;
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -108,7 +110,7 @@ describe('Unshare a file', () => {
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems });
done();
});
@@ -198,6 +200,7 @@ describe('Unshare a file', () => {
const siteName = `site-${Utils.random()}`;
const parentInSite = `parent-site-${Utils.random()}`;
let parentInSiteId: string;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
@@ -208,11 +211,12 @@ describe('Unshare a file', () => {
file2Id = (await apis.user.nodes.createFile(file2, parentInSiteId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentInSiteId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentInSiteId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -233,7 +237,7 @@ describe('Unshare a file', () => {
afterAll(async (done) => {
await apis.admin.sites.deleteSite(siteName);
await apis.user.shared.waitForApi({ expect: 0 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems });
done();
});
@@ -319,17 +323,20 @@ describe('Unshare a file', () => {
let file3Id: string;
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -349,7 +356,7 @@ describe('Unshare a file', () => {
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems });
done();
});
@@ -435,17 +442,20 @@ describe('Unshare a file', () => {
let file3Id: string;
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
await apis.user.shared.shareFileById(file4Id);
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -465,7 +475,7 @@ describe('Unshare a file', () => {
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems });
done();
});
@@ -551,12 +561,15 @@ describe('Unshare a file', () => {
let file3Id: string;
const file4 = `file4-${Utils.random()}.txt`;
let file4Id: string;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
file1Id = (await apis.user.nodes.createFile(file1, parentId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentId)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3, parentId)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4, parentId)).entry.id;
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.shareFileById(file2Id);
await apis.user.shared.shareFileById(file3Id);
@@ -568,7 +581,7 @@ describe('Unshare a file', () => {
await apis.user.favorites.addFavoriteById('file', file4Id);
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 4 });
done();
});
@@ -588,7 +601,7 @@ describe('Unshare a file', () => {
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.nodes.deleteNodeById(file3Id);
await apis.user.nodes.deleteNodeById(file4Id);
await apis.user.shared.waitForApi({ expect: 0 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems });
done();
});
@@ -694,6 +707,7 @@ describe('Unshare a file', () => {
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.admin.shared.shareFileById(file1FileLibId);
await apis.user.shared.shareFileById(file2FileLibId);
await apis.admin.shared.shareFileById(file1SharedId);
@@ -705,7 +719,7 @@ describe('Unshare a file', () => {
await apis.user.favorites.addFavoriteById('file', file2FavId);
await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.shared.waitForApi({ expect: 6 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 6 });
done();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage, FILES, RepoClient, Utils, UploadNewVersionDialog } from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, SearchResultsPage, FILES, RepoClient, Utils, UploadNewVersionDialog } from '@alfresco/aca-testing-shared';
describe('Upload new version', () => {
const username = `user-${Utils.random()}`;
@@ -82,11 +82,12 @@ describe('Upload new version', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const searchResultsPage = new SearchResultsPage();
const { dataTable, toolbar } = page;
const uploadNewVersionDialog = new UploadNewVersionDialog();
const { searchInput } = page.header;
beforeAll(async (done) => {
beforeAll(async () => {
await apis.admin.people.createUser({ username });
parentPFId = (await apis.user.nodes.createFolder(parentPF)).entry.id;
@@ -94,17 +95,192 @@ describe('Upload new version', () => {
parentRFId = (await apis.user.nodes.createFolder(parentRF)).entry.id;
parentFavId = (await apis.user.nodes.createFolder(parentFav)).entry.id;
parentSearchId = (await apis.user.nodes.createFolder(parentSearch)).entry.id;
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.nodes.deleteNodeById(parentPFId);
await apis.user.nodes.deleteNodeById(parentSFId);
await apis.user.nodes.deleteNodeById(parentRFId);
await apis.user.nodes.deleteNodeById(parentFavId);
await apis.user.nodes.deleteNodeById(parentSearchId);
done();
});
describe('on Search Results', () => {
beforeAll(async (done) => {
const initialSearchTotalItems = await apis.user.search.getSearchByTermTotalItems('search-f');
fileId = (await apis.user.upload.uploadFile(file, parentSearchId)).entry.id;
fileSearch1Id = (await apis.user.nodes.createFile(fileSearch1, parentSearchId)).entry.id;
fileSearch2Id = (await apis.user.nodes.createFile(fileSearch2, parentSearchId)).entry.id;
fileSearch3Id = (await apis.user.nodes.createFile(fileSearch3, parentSearchId)).entry.id;
fileSearch4Id = (await apis.user.nodes.createFile(fileSearch4, parentSearchId)).entry.id;
fileLockedSearch1Id = (await apis.user.nodes.createFile(fileLockedSearch1, parentSearchId)).entry.id;
fileLockedSearch2Id = (await apis.user.nodes.createFile(fileLockedSearch2, parentSearchId)).entry.id;
await apis.user.nodes.lockFile(fileLockedSearch1Id);
await apis.user.nodes.lockFile(fileLockedSearch2Id);
await apis.user.search.waitForNodes('search-f', { expect: initialSearchTotalItems + 6 });
await loginPage.loginWith(username);
done();
});
afterEach(async () => {
await Utils.pressEscape();
await page.header.expandSideNav();
await page.clickPersonalFilesAndWait();
});
it('[C307003] dialog UI defaults', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file);
await searchResultsPage.waitForResults();
await dataTable.selectItem(file, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
});
it('[C307004] file is updated after uploading a new version - major', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload1, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch1Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch1Id)).toEqual('2.0', 'File has incorrect version label');
});
it('[C307005] file is updated after uploading a new version - minor', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload2, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch2Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch2Id)).toEqual('1.1', 'File has incorrect version label');
});
it('[C307006] file is not updated when clicking Cancel', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch3);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch3, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileSearch3, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch3Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch3Id)).toEqual('1.0', 'File has incorrect version label');
});
it('[C307007] upload new version fails when new file name already exists', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch4);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch4, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(file);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage);
expect(await dataTable.isItemPresent(fileSearch4, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch4Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch4Id)).toEqual('1.0', 'File has incorrect version label');
});
it('[C307008] file is unlocked after uploading a new version', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload4, parentSearch)).toBe(true, 'File name was not changed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch1Id)).toBe(false, `${fileLockedSearch1} is still locked`);
expect(await apis.user.nodes.getFileVersionType(fileLockedSearch1Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileLockedSearch1Id)).toEqual('1.1', 'File has incorrect version label');
});
it('[C307009] file remains locked after canceling of uploading a new version', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileToUpload5, parentSearch)).toBe(false, 'File was updated');
expect(await dataTable.isItemPresent(fileLockedSearch2, parentSearch)).toBe(true, 'File not displayed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch2Id)).toBe(true, `${fileLockedSearch2} was unlocked`);
});
});
describe('on Personal Files', () => {
@@ -270,21 +446,20 @@ describe('Upload new version', () => {
await apis.user.nodes.lockFile(fileLocked1Id);
await apis.user.nodes.lockFile(fileLocked2Id);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([fileId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id, fileLocked2Id]);
await apis.user.shared.waitForApi({ expect: 7 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 });
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickSharedFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.refresh();
done();
});
it('[C297551] dialog UI defaults', async () => {
@@ -408,6 +583,7 @@ describe('Upload new version', () => {
describe('on Recent Files', () => {
beforeAll(async (done) => {
const initialRecentTotalItems = await apis.user.search.getTotalItems(username);
fileId = (await apis.user.upload.uploadFile(file, parentRFId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentRFId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentRFId)).entry.id;
@@ -420,20 +596,18 @@ describe('Upload new version', () => {
await apis.user.nodes.lockFile(fileLocked1Id);
await apis.user.nodes.lockFile(fileLocked2Id);
await apis.user.search.waitForApi(username, { expect: 21 });
await apis.user.search.waitForApi(username, { expect: initialRecentTotalItems + 7 });
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickRecentFilesAndWait();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await page.refresh();
done();
});
it('[C297558] dialog UI defaults', async () => {
@@ -557,6 +731,7 @@ describe('Upload new version', () => {
describe('on Favorite Files', () => {
beforeAll(async (done) => {
const initialFavoritesTotalItems = await apis.user.favorites.getFavoritesTotalItems();
fileId = (await apis.user.upload.uploadFile(file, parentFavId)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1, parentFavId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2, parentFavId)).entry.id;
@@ -570,7 +745,7 @@ describe('Upload new version', () => {
await apis.user.nodes.lockFile(fileLocked2Id);
await apis.user.favorites.addFavoritesByIds('file', [fileId, file1Id, file2Id, file3Id, file4Id, fileLocked1Id, fileLocked2Id]);
await apis.user.favorites.waitForApi({ expect: 7 });
await apis.user.favorites.waitForApi({ expect: initialFavoritesTotalItems + 7 });
await loginPage.loginWith(username);
done();
@@ -704,181 +879,4 @@ describe('Upload new version', () => {
expect(await apis.user.nodes.isFileLockedWrite(fileLocked2Id)).toBe(true, `${fileLocked2} was unlocked`);
});
});
describe('on Search Results', () => {
beforeAll(async (done) => {
fileId = (await apis.user.upload.uploadFile(file, parentSearchId)).entry.id;
fileSearch1Id = (await apis.user.nodes.createFile(fileSearch1, parentSearchId)).entry.id;
fileSearch2Id = (await apis.user.nodes.createFile(fileSearch2, parentSearchId)).entry.id;
fileSearch3Id = (await apis.user.nodes.createFile(fileSearch3, parentSearchId)).entry.id;
fileSearch4Id = (await apis.user.nodes.createFile(fileSearch4, parentSearchId)).entry.id;
fileLockedSearch1Id = (await apis.user.nodes.createFile(fileLockedSearch1, parentSearchId)).entry.id;
fileLockedSearch2Id = (await apis.user.nodes.createFile(fileLockedSearch2, parentSearchId)).entry.id;
await apis.user.nodes.lockFile(fileLockedSearch1Id);
await apis.user.nodes.lockFile(fileLockedSearch2Id);
await apis.user.search.waitForNodes('search-f', { expect: 6 });
await loginPage.loginWith(username);
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
await page.header.expandSideNav();
await page.clickPersonalFilesAndWait();
done();
});
it('[C307003] dialog UI defaults', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(file);
await dataTable.waitForBody();
await dataTable.selectItem(file, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version');
expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed');
expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed');
expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed');
expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled');
expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled');
});
it('[C307004] file is updated after uploading a new version - major', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload1);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload1, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch1Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch1Id)).toEqual('2.0', 'File has incorrect version label');
});
it('[C307005] file is updated after uploading a new version - minor', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload2);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new minor version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload2, parentSearch)).toBe(true, 'File not updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch2Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch2Id)).toEqual('1.1', 'File has incorrect version label');
});
it('[C307006] file is not updated when clicking Cancel', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch3);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch3, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload3);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileSearch3, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch3Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch3Id)).toEqual('1.0', 'File has incorrect version label');
});
it('[C307007] upload new version fails when new file name already exists', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileSearch4);
await dataTable.waitForBody();
await dataTable.selectItem(fileSearch4, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(file);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.uploadButton.click();
const message = await page.getSnackBarMessage();
expect(message).toContain(nameConflictMessage);
expect(await dataTable.isItemPresent(fileSearch4, parentSearch)).toBe(true, 'File was updated');
expect(await apis.user.nodes.getFileVersionType(fileSearch4Id)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSearch4Id)).toEqual('1.0', 'File has incorrect version label');
});
it('[C307008] file is unlocked after uploading a new version', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch1);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch1, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload4);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.uploadButton.click();
await uploadNewVersionDialog.waitForDialogToClose();
// TODO: enable when ACA-2329 is fixed
// expect(await dataTable.isItemPresent(fileToUpload4, parentSearch)).toBe(true, 'File name was not changed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch1Id)).toBe(false, `${fileLockedSearch1} is still locked`);
expect(await apis.user.nodes.getFileVersionType(fileLockedSearch1Id)).toEqual('MINOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileLockedSearch1Id)).toEqual('1.1', 'File has incorrect version label');
});
it('[C307009] file remains locked after canceling of uploading a new version', async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(fileLockedSearch2);
await dataTable.waitForBody();
await dataTable.selectItem(fileLockedSearch2, parentSearch);
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(fileToUpload5);
await page.waitForDialog();
await uploadNewVersionDialog.minorOption.click();
await uploadNewVersionDialog.enterDescription('new version description');
await uploadNewVersionDialog.clickCancel();
expect(await dataTable.isItemPresent(fileToUpload5, parentSearch)).toBe(false, 'File was updated');
expect(await dataTable.isItemPresent(fileLockedSearch2, parentSearch)).toBe(true, 'File not displayed');
expect(await apis.user.nodes.isFileLockedWrite(fileLockedSearch2Id)).toBe(true, `${fileLockedSearch2} was unlocked`);
});
});
});

View File

@@ -82,7 +82,10 @@ describe('Comments', () => {
comment1File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'first comment')).entry;
comment2File2Entry = (await apis.user.comments.addComment(fileWith2CommentsId, 'second comment')).entry;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 });
await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.nodes.createFolder(folder1, parentId);
@@ -260,11 +263,6 @@ describe('Comments', () => {
});
describe('from Shared Files', () => {
beforeAll(async (done) => {
await apis.user.shared.waitForApi({ expect: 3 });
done();
});
beforeEach(async (done) => {
await page.clickSharedFilesAndWait();
done();
@@ -356,7 +354,6 @@ describe('Comments', () => {
commentFile1Entry = (await apis.user.comments.addComment(fileWith1CommentId, 'this is my comment')).entry;
await apis.user.favorites.waitForApi({ expect: 4 });
await apis.user.shared.waitForApi({ expect: 3 });
await apis.user.search.waitForApi(username, { expect: 7 });
done();

View File

@@ -39,6 +39,8 @@ describe('Special permissions', () => {
const { dataTable } = page;
const { searchInput } = page.header;
let initialSharedTotalItems: number;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
done();
@@ -55,24 +57,25 @@ describe('Special permissions', () => {
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.admin.shared.shareFileById(fileId);
await apis.user.nodes.editNodeContent(fileId, 'edited by user');
await apis.user.search.waitForApi(username, { expect: 1 });
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
await loginPage.loginWith(username);
done();
});
afterEach(async (done) => {
afterEach(async () => {
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.admin.sites.deleteSite(sitePrivate);
done();
});
it('[C213173] on Recent Files', async () => {
@@ -93,10 +96,10 @@ describe('Special permissions', () => {
it('[C213116] on Shared Files', async () => {
await page.clickSharedFilesAndWait();
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getRowsCount()).toBe(initialSharedTotalItems + 1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await page.refresh();
expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed');
expect(await dataTable.getRowsCount()).toBe(initialSharedTotalItems, 'Incorrect number of items');
});
it('[C290122] on Search Results', async () => {
@@ -129,8 +132,11 @@ describe('Special permissions', () => {
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
await apis.user.favorites.addFavoriteById('file', fileId);
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(fileId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
await apis.user.search.waitForApi(username, { expect: 1 });
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await loginPage.loginWith(username);
@@ -156,7 +162,7 @@ describe('Special permissions', () => {
it(`[C213668] on Shared Files`, async () => {
await page.clickSharedFilesAndWait();
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getRowsCount()).toBe(initialSharedTotalItems + 1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
});

View File

@@ -43,6 +43,8 @@ describe('Shared Files', () => {
const file4User = `file4-${Utils.random()}.txt`;
let file4Id: string;
let initialSharedTotalItems: number;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, password)
@@ -58,19 +60,23 @@ describe('Shared Files', () => {
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE);
const docLibId = await apis.admin.sites.getDocLibId(siteName);
const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
await apis.admin.shared.shareFileById(nodeId);
folderId = (await apis.user.nodes.createFolder(folderUser)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1User, folderId)).entry.id;
file2Id = (await apis.user.nodes.createFile(file2User)).entry.id;
file3Id = (await apis.user.nodes.createFile(file3User)).entry.id;
file4Id = (await apis.user.nodes.createFile(file4User)).entry.id;
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await apis.admin.shared.waitForApi({ expect: 5 });
initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await apis.admin.shared.shareFileById(nodeId);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 5 });
await apis.user.nodes.deleteNodeById(file2Id);
await apis.user.shared.unshareFile(file3User);
await apis.admin.shared.waitForApi({ expect: 3 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 3 });
await loginPage.loginWith(username);
done();
@@ -81,11 +87,10 @@ describe('Shared Files', () => {
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.admin.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folderId);
await apis.user.nodes.deleteNodeById(file4Id);
done();
});
it('[C213113] has the correct columns', async () => {

View File

@@ -65,10 +65,13 @@ describe('File / folder tooltips', () => {
file7Id = (await apis.user.nodes.createFile(fileNameEqDescDiffTitle, parentId, fileTitle, fileNameEqDescDiffTitle)).entry.id;
file8Id = (await apis.user.nodes.createFile(fileTitleEqDesc, parentId, fileTitle, fileTitle)).entry.id;
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]);
await apis.user.favorites.addFavoritesByIds('file', [file1Id, file2Id, file3Id, file4Id, file5Id, file6Id, file7Id, file8Id]);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 8 });
await loginPage.loginWith(username);
done();
});
@@ -161,7 +164,6 @@ describe('File / folder tooltips', () => {
// disabled until ACA-518 is done
xdescribe('on Shared Files', () => {
beforeAll(async (done) => {
await apis.user.shared.waitForApi({ expect: 8 });
await page.clickSharedFilesAndWait();
done();
});

View File

@@ -30,27 +30,27 @@ describe('Trash', () => {
const siteName = `site-${Utils.random()}`;
const fileSite = `file-${Utils.random()}.txt`;
let fileSiteId;
let fileSiteId: string;
const folderAdmin = `folder-${Utils.random()}`;
let folderAdminId;
let folderAdminId: string;
const fileAdmin = `file-${Utils.random()}.txt`;
let fileAdminId;
let fileAdminId: string;
const folderUser = `folder-${Utils.random()}`;
let folderUserId;
let folderUserId: string;
const fileUser = `file-${Utils.random()}.txt`;
let fileUserId;
let fileUserId: string;
const folderDeleted = `folder-${Utils.random()}`;
let folderDeletedId;
let folderDeletedId: string;
const fileDeleted = `file-${Utils.random()}.txt`;
let fileDeletedId;
let fileDeletedId: string;
const folderNotDeleted = `folder-${Utils.random()}`;
let folderNotDeletedId: string;
const fileInFolder = `file-${Utils.random()}.txt`;
let fileInFolderId;
let fileInFolderId: string;
const apis = {
admin: new RepoClient(),
@@ -61,7 +61,7 @@ describe('Trash', () => {
const page = new BrowsingPage();
const { dataTable, breadcrumb } = page;
beforeAll(async (done) => {
beforeAll(async () => {
await apis.admin.people.createUser({ username });
fileAdminId = (await apis.admin.nodes.createFiles([fileAdmin])).entry.id;
folderAdminId = (await apis.admin.nodes.createFolders([folderAdmin])).entry.id;
@@ -80,12 +80,16 @@ describe('Trash', () => {
await apis.user.nodes.deleteNodesById([fileSiteId, fileUserId, folderUserId, fileInFolderId], false);
await apis.user.nodes.deleteNodeById(fileDeletedId, false);
await apis.user.nodes.deleteNodeById(folderDeletedId, false);
done();
});
afterAll(async (done) => {
await Promise.all([apis.admin.sites.deleteSite(siteName), apis.user.nodes.deleteNodeById(folderNotDeletedId), apis.admin.trashcan.emptyTrash()]);
await Promise.all([
apis.admin.sites.deleteSite(siteName),
apis.admin.trashcan.permanentlyDelete(fileAdminId),
apis.admin.trashcan.permanentlyDelete(folderAdminId),
apis.user.nodes.deleteNodeById(folderNotDeletedId),
apis.user.trashcan.emptyTrash()
]);
done();
});
@@ -108,8 +112,6 @@ describe('Trash', () => {
});
it('[C280493] displays the files and folders deleted by everyone', async () => {
expect(await dataTable.getRowsCount()).toEqual(8, 'Incorrect number of deleted items displayed');
expect(await dataTable.isItemPresent(fileAdmin)).toBe(true, `${fileAdmin} not displayed`);
expect(await dataTable.isItemPresent(folderAdmin)).toBe(true, `${folderAdmin} not displayed`);
expect(await dataTable.isItemPresent(fileUser)).toBe(true, `${fileUser} not displayed`);

View File

@@ -197,6 +197,10 @@ describe('Breadcrumb', () => {
await apis.admin.people.createUser({ username: user2 });
userFolderId = (await user2Api.nodes.createFolder(userFolder)).entry.id;
await loginPage.loginWithAdmin();
await page.dataTable.waitForBody();
await page.dataTable.sortByModified('desc');
done();
});

View File

@@ -66,23 +66,15 @@ describe('Single click on item name', () => {
const docLibId = await apis.user.sites.getDocLibId(siteName);
await apis.user.nodes.createFile(fileSite, docLibId);
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.waitForApi({ expect: 2 + 1 });
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
afterAll(async () => {
await apis.user.sites.deleteSite(siteName);
await apis.user.nodes.deleteNodeById(folder1Id);
await apis.user.nodes.deleteNodeById(file1Id);
await apis.user.trashcan.emptyTrash();
done();
});
it('[C284899] Hyperlink does not appear for items in the Trash', async () => {
@@ -93,9 +85,8 @@ describe('Single click on item name', () => {
});
describe('on Personal Files', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickPersonalFilesAndWait();
done();
});
it('[C280032] Hyperlink appears when mouse over a file/folder', async () => {
@@ -118,9 +109,8 @@ describe('Single click on item name', () => {
});
describe('on File Libraries', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickFileLibrariesAndWait();
done();
});
it('[C284901] Hyperlink appears when mouse over a library', async () => {
@@ -136,9 +126,14 @@ describe('Single click on item name', () => {
});
describe('on Shared Files', () => {
beforeEach(async (done) => {
beforeAll(async () => {
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(file1Id);
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
});
beforeEach(async () => {
await page.clickSharedFilesAndWait();
done();
});
it('[C284905] Hyperlink appears when mouse over a file', async () => {
@@ -155,9 +150,8 @@ describe('Single click on item name', () => {
});
describe('on Recent Files', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await page.clickRecentFilesAndWait();
done();
});
it('[C284907] Hyperlink appears when mouse over a file', async () => {
@@ -174,9 +168,15 @@ describe('Single click on item name', () => {
});
describe('on Favorites', () => {
beforeEach(async (done) => {
beforeAll(async () => {
const initialFavoriteTotalItems = await apis.user.favorites.getFavoritesTotalItems();
await apis.user.favorites.addFavoriteById('file', file1Id);
await apis.user.favorites.addFavoriteById('folder', folder1Id);
await apis.user.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 });
});
beforeEach(async () => {
await page.clickFavoritesAndWait();
done();
});
it('[C284909] Hyperlink appears when mouse over a file/folder', async () => {
@@ -199,16 +199,14 @@ describe('Single click on item name', () => {
});
describe('on Search Results', () => {
beforeEach(async (done) => {
beforeEach(async () => {
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
done();
});
afterEach(async (done) => {
afterEach(async () => {
await Utils.pressEscape();
await page.clickPersonalFilesAndWait();
done();
});
it('[C306988] Hyperlink appears when mouse over a file', async () => {

View File

@@ -23,14 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, Utils } from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function favoritesTests() {
export function favoritesTests(username: string) {
const page = new BrowsingPage();
const loginPage = new LoginPage();
const { dataTable, pagination } = page;
describe('Pagination controls : ', () => {
beforeAll(async () => {
await loginPage.loginWith(username);
await page.clickFavoritesAndWait();
});

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
import { Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
import { personalFilesTests } from './personal-files';
import { recentFilesTests } from './recent-files';
import { searchResultsTests } from './search-results';
@@ -45,46 +45,57 @@ describe('Pagination on multiple pages : ', () => {
const userApi = new RepoClient(username, username);
const adminApiActions = new AdminActions();
const loginPage = new LoginPage();
let initialSharedTotalItems: number;
let initialFavoritesTotalItems: number;
let initialSearchTotalItems: number;
beforeAll(async () => {
await adminApiActions.createUser({ username });
initialSearchTotalItems = await userApi.search.getTotalItems(username);
parentId = (await userApi.nodes.createFolder(parent)).entry.id;
filesIds = (await userApi.nodes.createFiles(files, parent)).list.entries.map((entries: any) => entries.entry.id);
initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems();
initialFavoritesTotalItems = await userApi.favorites.getFavoritesTotalItems();
await userApi.shared.shareFilesByIds(filesIds);
await userApi.favorites.addFavoritesByIds('file', filesIds);
await Promise.all([
userApi.favorites.waitForApi({ expect: 101 }),
userApi.shared.waitForApi({ expect: 101 }),
userApi.search.waitForApi(username, { expect: 101 })
]);
await loginPage.loginWith(username);
});
}, 150000);
afterAll(async () => {
await userApi.nodes.deleteNodeById(parentId);
});
describe('on Personal Files', () => {
personalFilesTests(parent);
personalFilesTests(username, parent);
});
describe('on Recent Files', () => {
recentFilesTests();
beforeAll(async () => {
await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 });
}, 120000);
recentFilesTests(username);
});
describe('on Search Results', () => {
searchResultsTests();
beforeAll(async () => {
userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 });
}, 120000);
searchResultsTests(username);
});
describe('on Shared Files', () => {
sharedFilesTests();
beforeAll(async () => {
await userApi.shared.waitForApi({ expect: initialSharedTotalItems + 101 });
}, 120000);
sharedFilesTests(username);
});
describe('on Favorites', () => {
favoritesTests();
beforeAll(async () => {
await userApi.favorites.waitForApi({ expect: initialFavoritesTotalItems + 101 });
}, 120000);
favoritesTests(username);
});
});

View File

@@ -41,16 +41,22 @@ describe('Pagination on multiple pages', () => {
.fill('site')
.map((name, index): string => `${name}-${index + 1}-${random}`);
let initialSitesTotalItems: number;
beforeAll(async () => {
await adminApiActions.createUser({ username });
initialSitesTotalItems = await userApi.sites.getSitesTotalItems();
await userApi.sites.createSitesPrivate(sites);
await userApi.sites.waitForApi({ expect: 101 });
await userApi.sites.waitForApi({ expect: initialSitesTotalItems + 101 });
await loginPage.loginWith(username);
});
}, 150000);
afterAll(async () => {
await userApi.sites.deleteSites(sites);
});
await userApi.sites.waitForApi({ expect: initialSitesTotalItems });
}, 120000);
describe('on My Libraries', () => {
beforeAll(async () => {

View File

@@ -50,7 +50,7 @@ describe('Pagination on multiple pages on Trash', () => {
await loginPage.loginWith(username);
await page.clickTrashAndWait();
});
}, 120000);
afterEach(async () => {
await Utils.pressEscape();

View File

@@ -23,14 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, Utils } from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function personalFilesTests(parentName: string) {
export function personalFilesTests(username: string, parentName: string) {
const page = new BrowsingPage();
const loginPage = new LoginPage();
const { dataTable, pagination } = page;
describe('Pagination controls : ', () => {
beforeAll(async () => {
await loginPage.loginWith(username);
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parentName);
await dataTable.waitForHeader();
@@ -40,7 +42,7 @@ export function personalFilesTests(parentName: string) {
await Utils.pressEscape();
});
it('Pagination control default values - [C280077]', async () => {
it('[C280077] Pagination control default values', async () => {
expect(await pagination.getRange()).toContain('1-25 of 101');
expect(await pagination.getMaxItems()).toContain('25');
expect(await pagination.getCurrentPage()).toContain('Page 1');
@@ -49,7 +51,7 @@ export function personalFilesTests(parentName: string) {
expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled');
});
it('Items per page values - [C280078]', async () => {
it('[C280078] Items per page values', async () => {
await pagination.openMaxItemsMenu();
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
@@ -57,7 +59,7 @@ export function personalFilesTests(parentName: string) {
await pagination.menu.closeMenu();
});
it('current page menu items - [C280079]', async () => {
it('[C280079] current page menu items', async () => {
await pagination.openMaxItemsMenu();
await pagination.menu.clickMenuItem('25');
expect(await pagination.getMaxItems()).toContain('25');
@@ -85,7 +87,7 @@ export function personalFilesTests(parentName: string) {
await pagination.resetToDefaultPageSize();
});
it('change the current page from menu - [C280080]', async () => {
it('[C280080] change the current page from menu', async () => {
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(3);
await dataTable.waitForHeader();
@@ -98,7 +100,7 @@ export function personalFilesTests(parentName: string) {
await pagination.resetToDefaultPageNumber();
});
it('navigate to next and previous pages - [C280083]', async () => {
it('[C280083] navigate to next and previous pages', async () => {
await pagination.clickNext();
await dataTable.waitForHeader();
expect(await pagination.getRange()).toContain('26-50 of 101');
@@ -116,12 +118,12 @@ export function personalFilesTests(parentName: string) {
await pagination.resetToDefaultPageNumber();
});
it('Previous button is disabled on first page - [C280081]', async () => {
it('[C280081] Previous button is disabled on first page', async () => {
expect(await pagination.getCurrentPage()).toContain('Page 1');
expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page');
});
it('Next button is disabled on last page - [C280082]', async () => {
it('[C280082] Next button is disabled on last page', async () => {
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(5);
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page');

View File

@@ -23,14 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, Utils } from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function recentFilesTests() {
export function recentFilesTests(username: string) {
const page = new BrowsingPage();
const loginPage = new LoginPage();
const { dataTable, pagination } = page;
describe('Pagination controls : ', () => {
beforeAll(async () => {
await loginPage.loginWith(username);
await page.clickRecentFilesAndWait();
});

View File

@@ -23,15 +23,17 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, Utils } from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function searchResultsTests() {
export function searchResultsTests(username: string) {
const page = new BrowsingPage();
const loginPage = new LoginPage();
const { dataTable, pagination } = page;
const { searchInput } = page.header;
describe('Pagination controls : ', () => {
beforeAll(async () => {
await loginPage.loginWith(username);
await searchInput.clickSearchButton();
await searchInput.searchFor('my-file-');
await dataTable.waitForBody();

View File

@@ -23,14 +23,16 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowsingPage, Utils } from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
export function sharedFilesTests() {
export function sharedFilesTests(username: string) {
const page = new BrowsingPage();
const loginPage = new LoginPage();
const { dataTable, pagination } = page;
describe('Pagination controls : ', () => {
beforeAll(async () => {
await loginPage.loginWith(username);
await page.clickSharedFilesAndWait();
});
@@ -38,8 +40,8 @@ export function sharedFilesTests() {
await Utils.pressEscape();
});
it('Pagination control default values - [C280095]', async () => {
expect(await pagination.getRange()).toContain('1-25 of 101');
it('[C280095] Pagination control default values', async () => {
expect(await pagination.getRange()).toContain('1-25');
expect(await pagination.getMaxItems()).toContain('25');
expect(await pagination.getCurrentPage()).toContain('Page 1');
expect(await pagination.getTotalPages()).toContain('of 5');
@@ -47,7 +49,7 @@ export function sharedFilesTests() {
expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled');
});
it('Items per page values - [C280096]', async () => {
it('[C280096] Items per page values', async () => {
await pagination.openMaxItemsMenu();
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
@@ -55,7 +57,7 @@ export function sharedFilesTests() {
await pagination.menu.closeMenu();
});
it('current page menu items - [C280097]', async () => {
it('[C280097] current page menu items', async () => {
await pagination.openMaxItemsMenu();
await pagination.menu.clickMenuItem('25');
expect(await pagination.getMaxItems()).toContain('25');
@@ -83,11 +85,11 @@ export function sharedFilesTests() {
await pagination.resetToDefaultPageSize();
});
it('change the current page from menu - [C280098]', async () => {
it('[C280098] change the current page from menu', async () => {
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(3);
await dataTable.waitForHeader();
expect(await pagination.getRange()).toContain('51-75 of 101');
expect(await pagination.getRange()).toContain('51-75');
expect(await pagination.getCurrentPage()).toContain('Page 3');
expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled');
expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled');
@@ -96,10 +98,10 @@ export function sharedFilesTests() {
await pagination.resetToDefaultPageNumber();
});
it('navigate to next and previous pages - [C280101]', async () => {
it('[C280101] navigate to next and previous pages', async () => {
await pagination.clickNext();
await dataTable.waitForHeader();
expect(await pagination.getRange()).toContain('26-50 of 101');
expect(await pagination.getRange()).toContain('26-50');
expect(await dataTable.isItemPresent('my-file-70')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber();
@@ -108,21 +110,20 @@ export function sharedFilesTests() {
await dataTable.waitForHeader();
await pagination.clickPrevious();
await dataTable.waitForHeader();
expect(await pagination.getRange()).toContain('1-25 of 101');
expect(await pagination.getRange()).toContain('1-25');
expect(await dataTable.isItemPresent('my-file-88')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber();
});
it('Previous button is disabled on first page - [C280099]', async () => {
it('[C280099] Previous button is disabled on first page', async () => {
expect(await pagination.getCurrentPage()).toContain('Page 1');
expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page');
});
it('Next button is disabled on last page - [C280100]', async () => {
it('[C280100] Next button is disabled on last page', async () => {
await pagination.openCurrentPageMenu();
await pagination.menu.clickNthItem(5);
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page');
expect(await pagination.getCurrentPage()).toContain('Page 5');
expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page');
});

View File

@@ -50,6 +50,11 @@ describe('Pagination on single page', () => {
beforeAll(async () => {
await adminApiActions.createUser({ username });
const initialFavoriteTotalItems = await userApi.favorites.getFavoritesTotalItems();
const initialRecentFilesTotalItems = await userApi.search.getTotalItems(username);
const initialSharedTotalItems = await userApi.shared.getSharedLinksTotalItems();
const initialTrashTotalItems = await userApi.trashcan.getDeletedNodesTotalItems();
fileId = (await userApi.nodes.createFile(file)).entry.id;
fileInTrashId = (await userApi.nodes.createFile(fileInTrash)).entry.id;
siteId = (await userApi.sites.createSite(siteName)).entry.id;
@@ -59,10 +64,10 @@ describe('Pagination on single page', () => {
await userApi.shared.shareFileById(fileId);
await Promise.all([
userApi.favorites.waitForApi({ expect: 2 }),
userApi.search.waitForApi(username, { expect: 1 }),
userApi.shared.waitForApi({ expect: 1 }),
userApi.trashcan.waitForApi({ expect: 1 })
userApi.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 }),
userApi.search.waitForApi(username, { expect: initialRecentFilesTotalItems + 1 }),
userApi.shared.waitForApi({ expect: initialSharedTotalItems + 1 }),
userApi.trashcan.waitForApi({ expect: initialTrashTotalItems + 1 })
]);
await loginPage.loginWith(username);

View File

@@ -119,6 +119,7 @@ describe('Viewer actions', () => {
afterEach(async (done) => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
@@ -262,7 +263,7 @@ describe('Viewer actions', () => {
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen');
const browserLogAfter = await Utils.getBrowserLog();
expect(browserLogAfter.length).toEqual(0);
expect(browserLogAfter.length).toEqual(0, browserLogAfter.entries);
});
it('[C286313] Share action', async () => {
@@ -347,6 +348,7 @@ describe('Viewer actions', () => {
afterEach(async (done) => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
@@ -534,6 +536,7 @@ describe('Viewer actions', () => {
afterEach(async (done) => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
@@ -708,6 +711,7 @@ describe('Viewer actions', () => {
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFilesByIds([
docxFileId,
xlsxFileId,
@@ -717,7 +721,7 @@ describe('Viewer actions', () => {
fileForUploadNewVersionId,
fileSharedId
]);
await apis.user.shared.waitForApi({ expect: 7 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 7 });
await loginPage.loginWith(username);
done();
@@ -731,6 +735,7 @@ describe('Viewer actions', () => {
afterEach(async (done) => {
await page.closeOpenDialogs();
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});
@@ -926,6 +931,7 @@ describe('Viewer actions', () => {
afterEach(async (done) => {
await Utils.pressEscape();
await page.closeUploadDialog();
done();
});

View File

@@ -67,10 +67,12 @@ describe('Viewer general', () => {
docLibSiteUserId = await apis.user.sites.getDocLibId(siteUser);
await apis.user.upload.uploadFile(fileInSite, docLibSiteUserId);
const initialSharedTotalItems = await apis.user.shared.getSharedLinksTotalItems();
await apis.user.shared.shareFileById(xlsxFileId);
await apis.user.shared.waitForApi({ expect: 1 });
await apis.user.favorites.addFavoriteById('file', xlsxFileId);
await apis.user.favorites.waitForApi({ expect: 2 });
await apis.user.shared.waitForApi({ expect: initialSharedTotalItems + 1 });
await loginPage.loginWith(username);
done();