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

4
.gitignore vendored
View File

@@ -43,8 +43,10 @@ testem.log
/e2e/*.map
/e2e-output
/e2e-downloads
.protractor-fail-fast
.protractor-smartrunner
/protractorFailuresReport
# System Files
.DS_Store
Thumbs.db
!/.protractor-smartrunner/

View File

@@ -1,13 +1,12 @@
dist: bionic
sudo: required
services:
- docker
- xvfb
addons:
chrome: stable
language: node_js
node_js:
- '12.14.0'
- '12.18.1'
cache:
directories:
@@ -21,9 +20,6 @@ branches:
- /.*beta.*/
before_install:
- sudo /etc/init.d/postgresql stop
- npm install -g npm@latest
- sleep 3
- . ./scripts/ci/job_hooks/before_install.sh
install: echo "no install"
@@ -40,6 +36,13 @@ stages:
- name: Trigger DW
if: (branch = master OR branch = develop OR (tag =~ .*beta.*)) AND (type = push OR type = api)
env:
global:
- API_CONTENT_HOST=$API_CONTENT_HOST_REMOTE
- API_AOS_HOST=$API_CONTENT_HOST_REMOTE
- ADMIN_EMAIL=$ADMIN_EMAIL_REMOTE
- ADMIN_PASSWORD=$ADMIN_PASSWORD_REMOTE
jobs:
include:
- stage: Quality and Unit tests
@@ -82,59 +85,47 @@ jobs:
cache: false
- stage: e2e
name: Test Suite appNavigation&search
name: 'Test Suite appNavigation & search'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "authentication,listViews,navigation,application,pagination,search"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=authentication,listViews,navigation,application,pagination,search"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- name: Test Suite actionsAvailable
- name: 'Test Suite actionsAvailable'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "actionsAvailable"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=actionsAvailable"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- name: Test Suite addRemoveContent
- name: 'Test Suite addRemoveContent'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "addRemoveContent"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=addRemoveContent"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- name: Test Suite manageContent
- name: 'Test Suite manageContent'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "manageContent"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=manageContent"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- name: Test Suite sharingContent&markFavorite
- name: 'Test Suite sharingContent & markFavorite'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "sharingContent"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=sharingContent"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- name: Test Suite viewContent&metadata&extensions
- name: 'Test Suite viewContent & metadata & extensions'
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" "./dist/app" "-a"
- ./start.sh
script: ng run app-e2e:e2elite --suite "viewer,infoDrawer,extensions"
script: ./scripts/ci/jobs/affected-project-with.sh -target e2e -options "--suite=viewer,infoDrawer,extensions"
after_script:
- ./scripts/ci/job_hooks/after_e2e.sh
- ./start.sh -d
- stage: Update Rancher
name: Update Rancher
@@ -152,11 +143,6 @@ jobs:
- stage: Trigger DW
script: ./scripts/trigger-travis.sh --pro --branch $TRAVIS_BRANCH Alfresco alfresco-digital-workspace-app $TRAVIS_ACCESS_TOKEN
after_failure:
- alfrescoContainerId=$(docker ps -a | grep 'alfresco-content-repository-community' | awk '{print $1}')
- docker logs $alfrescoContainerId > alfresco.log
- cat alfresco.log
notifications:
slack:
on_pull_requests: false

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();

191
package-lock.json generated
View File

@@ -3680,6 +3680,11 @@
"resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz",
"integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY="
},
"basic-auth": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.1.0.tgz",
"integrity": "sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ="
},
"batch": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
@@ -4473,6 +4478,12 @@
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"chokidar": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz",
@@ -5121,6 +5132,15 @@
"resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz",
"integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg=="
},
"connect-logger": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/connect-logger/-/connect-logger-0.0.1.tgz",
"integrity": "sha1-TZmZeKHSC7RgjnzUNNdBZSJVF0s=",
"dev": true,
"requires": {
"moment": "*"
}
},
"console-browserify": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
@@ -5338,6 +5358,11 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
"integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c="
},
"cosmiconfig": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",
@@ -6746,6 +6771,24 @@
"safer-buffer": "^2.1.0"
}
},
"ecstatic": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz",
"integrity": "sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==",
"requires": {
"he": "^1.1.1",
"mime": "^1.6.0",
"minimist": "^1.1.0",
"url-join": "^2.0.5"
},
"dependencies": {
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
}
}
},
"editorconfig": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
@@ -8109,6 +8152,12 @@
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
},
"get-func-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true
},
"get-own-enumerable-property-symbols": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz",
@@ -8375,6 +8424,11 @@
"minimalistic-assert": "^1.0.1"
}
},
"he": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
},
"hex-color-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
@@ -8669,6 +8723,23 @@
}
}
},
"http-server": {
"version": "0.12.3",
"resolved": "https://registry.npmjs.org/http-server/-/http-server-0.12.3.tgz",
"integrity": "sha512-be0dKG6pni92bRjq0kvExtj/NrrAd28/8fCXkaI/4piTwQMSDSLMhWyW0NI1V+DBI3aa1HMlQu46/HjVLfmugA==",
"requires": {
"basic-auth": "^1.0.3",
"colors": "^1.4.0",
"corser": "^2.0.1",
"ecstatic": "^3.3.2",
"http-proxy": "^1.18.0",
"minimist": "^1.2.5",
"opener": "^1.5.1",
"portfinder": "^1.0.25",
"secure-compare": "3.0.1",
"union": "~0.5.0"
}
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@@ -10688,6 +10759,27 @@
"through": "^2.3.8"
}
},
"lite-server": {
"version": "2.5.4",
"resolved": "https://registry.npmjs.org/lite-server/-/lite-server-2.5.4.tgz",
"integrity": "sha512-57SverS67UqRFiRm0ktdzEG5yZeyzkywRJ9Q8PHVSGuLm9K97Mr6jF43XTu5v9lVe8g0WHJ4eKlIeGSd1Bq/sw==",
"dev": true,
"requires": {
"browser-sync": "^2.26.7",
"connect-history-api-fallback": "^1.2.0",
"connect-logger": "0.0.1",
"lodash": "^4.17.15",
"minimist": "1.2.0"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
}
}
},
"loader-runner": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
@@ -11294,8 +11386,7 @@
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minipass": {
"version": "3.1.3",
@@ -11407,7 +11498,6 @@
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
@@ -12179,6 +12269,11 @@
"integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==",
"dev": true
},
"opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="
},
"openurl": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/openurl/-/openurl-1.1.1.tgz",
@@ -12626,6 +12721,12 @@
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true
},
"pbkdf2": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz",
@@ -12707,7 +12808,6 @@
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
"dev": true,
"requires": {
"async": "^2.6.2",
"debug": "^3.1.1",
@@ -12718,7 +12818,6 @@
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
"integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
"dev": true,
"requires": {
"lodash": "^4.17.14"
}
@@ -12727,7 +12826,6 @@
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
@@ -13666,6 +13764,69 @@
}
}
},
"protractor-retry-angular-cli": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/protractor-retry-angular-cli/-/protractor-retry-angular-cli-1.3.0.tgz",
"integrity": "sha512-CD8uqrfHIdbrS6OLOd6E8ETeRYSNg6HOQ5swdLHNffrMxPz9et3jDXj9vzhrJpkQ1OPylRjJQq9ieV3n9gsDoA==",
"dev": true,
"requires": {
"array-unique": "~0.3.2",
"chai": "4.x",
"chai-as-promised": "7.x",
"debug": "^4.1.1",
"lodash": "^4.17.15",
"mkdirp": "^1.0.3",
"q": "^1.5.1",
"xml2js": "~0.4.23",
"yargs": "^15.1.0"
},
"dependencies": {
"chai": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true,
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
"deep-eql": "^3.0.1",
"get-func-name": "^2.0.0",
"pathval": "^1.1.0",
"type-detect": "^4.0.5"
}
},
"chai-as-promised": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
"dev": true,
"requires": {
"check-error": "^1.0.2"
}
},
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true,
"requires": {
"type-detect": "^4.0.0"
}
},
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
}
}
},
"protractor-screenshoter-plugin": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/protractor-screenshoter-plugin/-/protractor-screenshoter-plugin-0.10.3.tgz",
@@ -14811,6 +14972,11 @@
"integrity": "sha1-Cm+I1fXRrBa2z3Ji7/ujH+5I7RI=",
"dev": true
},
"secure-compare": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
"integrity": "sha1-8aAymzCLIh+uN7mXTz1XjQypmeM="
},
"select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
@@ -17095,6 +17261,14 @@
"integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==",
"dev": true
},
"union": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
"integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
"requires": {
"qs": "^6.4.0"
}
},
"union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
@@ -17342,6 +17516,11 @@
}
}
},
"url-join": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz",
"integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg="
},
"url-parse": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",

View File

@@ -60,6 +60,7 @@
"@ngx-translate/core": "^13.0.0",
"browser-sync": "^2.26.12",
"chalk": "^4.1.0",
"http-server": "^0.12.3",
"inquirer": "^7.3.3",
"minimatch-browser": "^1.0.0",
"moment": "^2.27.0",
@@ -103,11 +104,13 @@
"karma-jasmine-html-reporter": "^1.5.4",
"karma-mocha-reporter": "^2.2.5",
"lint-staged": "^10.2.13",
"lite-server": "^2.4.0",
"ng-packagr": "^10.0.4",
"node-stream-zip": "^1.11.3",
"prettier": "^2.1.1",
"protractor": "^7.0.0",
"protractor-retry": "^1.2.13",
"protractor-retry-angular-cli": "^1.3.0",
"protractor-smartrunner": "^0.1.1",
"rxjs-tslint": "^0.1.8",
"rxjs-tslint-rules": "^4.34.1",

View File

@@ -53,6 +53,8 @@ export class DataTable extends Component {
emptySearchText = this.byCss('.empty-search__text');
selectedRow = this.byCss('.adf-datatable-row.adf-is-selected');
columnModified = this.byCss('.adf-datatable-header [data-automation-id="auto_id_modifiedAt"]');
menu = new Menu();
constructor(ancestor?: string) {
@@ -85,6 +87,30 @@ export class DataTable extends Component {
return this.head.element(locator);
}
async sortBy(label: string, order: 'asc' | 'desc'): Promise<void> {
const sortColumn = await this.getSortedColumnHeaderText();
const sortOrder = await this.getSortingOrder();
if (sortColumn !== label) {
await this.getColumnHeaderByLabel(label).click();
if (sortOrder !== order) {
await this.getColumnHeaderByLabel(label).click();
}
}
}
async sortByModified(order: 'asc' | 'desc'): Promise<void> {
const sortOrder = await this.getSortingOrder();
const sortColumn = await this.getSortedColumnHeaderText();
if (sortColumn !== 'Modified') {
await this.columnModified.click();
if (sortOrder !== order) {
await this.columnModified.click();
}
}
}
private getSortedColumnHeader(): ElementFinder {
const locator = by.css(DataTable.selectors.sortedColumnHeader);
return this.head.element(locator);
@@ -202,7 +228,7 @@ export class DataTable extends Component {
await browser.actions().mouseMove(item).perform();
await browser.actions().doubleClick().perform();
} catch (error) {
Logger.error('--- catch: doubleClickOnRowByName', error);
Logger.error('--- catch: doubleClickOnRowByName : ', error);
}
}
@@ -213,7 +239,7 @@ export class DataTable extends Component {
const item = this.getRowFirstCell(name, location);
await item.click();
} catch (e) {
Logger.error('--- select item catch : ', e);
Logger.error(`--- select item catch : failed to select ${name} from location : ${location} : `, e);
}
}
}

View File

@@ -26,7 +26,7 @@
import { browser, by, ElementFinder } from 'protractor';
import { Logger } from '@alfresco/adf-testing';
import { USE_HASH_STRATEGY } from './../configs';
import { Utils, waitElement, waitForPresence, waitForVisibility } from '../utilities/utils';
import { Utils, waitElement, waitForPresence, waitForVisibility, isPresentAndDisplayed } from '../utilities/utils';
export abstract class Page {
appRoot = 'app-root';
@@ -41,6 +41,9 @@ export abstract class Page {
genericErrorIcon = this.byCss('aca-generic-error .mat-icon');
genericErrorTitle = this.byCss('.generic-error__title');
uploadDialog = this.byCss('.adf-upload-dialog');
closeUploadButton = this.byCss('.adf-upload-dialog [id="adf-upload-dialog-close"]');
constructor(public url: string = '') {}
protected byCss(css: string): ElementFinder {
@@ -71,6 +74,16 @@ export abstract class Page {
}
}
async isUploadDialogOpen(): Promise<boolean> {
return isPresentAndDisplayed(this.uploadDialog);
}
async closeUploadDialog(): Promise<void> {
if (await this.isUploadDialogOpen()) {
await this.closeUploadButton.click();
}
}
async refresh(): Promise<void> {
await browser.refresh();
await this.waitForApp();

View File

@@ -49,7 +49,7 @@ export class FavoritesApi extends RepoApi {
};
return await this.favoritesApi.createFavorite('-me-', data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.addFavorite.name}`, error);
this.handleError(`FavoritesApi addFavorite : catch : `, error);
return null;
}
}
@@ -72,7 +72,7 @@ export class FavoritesApi extends RepoApi {
};
return await this.favoritesApi.createFavorite('-me-', data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.addFavoriteById.name}`, error);
this.handleError(`FavoritesApi addFavoriteById : catch : `, error);
return null;
}
}
@@ -84,7 +84,7 @@ export class FavoritesApi extends RepoApi {
await this.addFavoriteById(nodeType, current);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.addFavoritesByIds.name}`, error);
this.handleError(`FavoritesApi addFavoritesByIds : catch : `, error);
}
}
@@ -93,17 +93,27 @@ export class FavoritesApi extends RepoApi {
await this.apiAuth();
return await this.favoritesApi.listFavorites(this.getUsername());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getFavorites.name}`, error);
this.handleError(`FavoritesApi getFavorites : catch : `, error);
return null;
}
}
async getFavoritesTotalItems(): Promise<number> {
try {
await this.apiAuth();
return (await this.favoritesApi.listFavorites(this.getUsername())).list.pagination.totalItems;
} catch (error) {
this.handleError(`FavoritesApi getFavoritesTotalItems : catch : `, error);
return -1;
}
}
async getFavoriteById(nodeId: string) {
try {
await this.apiAuth();
return await this.favoritesApi.getFavorite('-me-', nodeId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getFavoriteById.name}`, error);
this.handleError(`FavoritesApi getFavoriteById : catch : `, error);
return null;
}
}
@@ -112,7 +122,7 @@ export class FavoritesApi extends RepoApi {
try {
return JSON.stringify((await this.getFavorites()).list.entries).includes(nodeId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.isFavorite.name}`, error);
this.handleError(`FavoritesApi isFavorite : catch : `, error);
return null;
}
}
@@ -129,9 +139,7 @@ export class FavoritesApi extends RepoApi {
}
};
return await Utils.retryCall(favorite);
} catch (error) {
// this.handleError(`${this.constructor.name} ${this.isFavoriteWithRetry.name}`, error);
}
} catch (error) {}
return isFavorite;
}
@@ -140,7 +148,7 @@ export class FavoritesApi extends RepoApi {
await this.apiAuth();
return await this.favoritesApi.deleteFavorite('-me-', nodeId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.removeFavoriteById.name}`, error);
this.handleError(`FavoritesApi removeFavoriteById : catch : `, error);
}
}
@@ -151,14 +159,14 @@ export class FavoritesApi extends RepoApi {
await this.removeFavoriteById(current);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.removeFavoritesByIds.name}`, error);
this.handleError(`FavoritesApi removeFavoritesByIds : catch : `, error);
}
}
async waitForApi(data: { expect: number }) {
try {
const favoriteFiles = async () => {
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
const totalItems = await this.getFavoritesTotalItems();
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -167,7 +175,7 @@ export class FavoritesApi extends RepoApi {
};
return await Utils.retryCall(favoriteFiles);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
Logger.error(`FavoritesApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -45,11 +45,20 @@ export class QueriesApi extends RepoApi {
await this.apiAuth();
return this.queriesApi.findSites(searchTerm, data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.findSites.name}`, error);
this.handleError(`QueriesApi findSites : catch : `, error);
return null;
}
}
async findSitesTotalItems(searchTerm: string): Promise<number> {
try {
return (await this.findSites(searchTerm)).list.pagination.totalItems;
} catch (error) {
this.handleError(`QueriesApi findSitesTotalItems : catch :`, error);
return -1;
}
}
async findNodes(searchTerm: string) {
const data = {
term: searchTerm,
@@ -60,7 +69,7 @@ export class QueriesApi extends RepoApi {
await this.apiAuth();
return this.queriesApi.findNodes(searchTerm, data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.findNodes.name}`, error);
this.handleError(`QueriesApi findNodes : catch : `, error);
return null;
}
}
@@ -68,7 +77,7 @@ export class QueriesApi extends RepoApi {
async waitForSites(searchTerm: string, data: { expect: number }) {
try {
const sites = async () => {
const totalItems = (await this.findSites(searchTerm)).list.pagination.totalItems;
const totalItems = await this.findSitesTotalItems(searchTerm);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -78,7 +87,7 @@ export class QueriesApi extends RepoApi {
return await Utils.retryCall(sites);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForSites.name} catch: `);
Logger.error(`QueriesApi waitForSites : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}
@@ -96,7 +105,7 @@ export class QueriesApi extends RepoApi {
return await Utils.retryCall(nodes);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForFilesAndFolders.name} catch: `);
Logger.error(`QueriesApi waitForFilesAndFolders : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -52,11 +52,20 @@ export class SearchApi extends RepoApi {
await this.apiAuth();
return this.searchApi.search(data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.queryRecentFiles.name}`, error);
this.handleError(`SearchApi queryRecentFiles : catch : `, error);
return null;
}
}
async getTotalItems(username: string): Promise<number> {
try {
return (await this.queryRecentFiles(username)).list.pagination.totalItems;
} catch (error) {
this.handleError(`SearchApi getTotalItems : catch : `, error);
return -1;
}
}
async queryNodesNames(searchTerm: string) {
const data = {
query: {
@@ -70,11 +79,20 @@ export class SearchApi extends RepoApi {
await this.apiAuth();
return this.searchApi.search(data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.queryNodesNames.name}`, error);
this.handleError(`SearchApi queryNodesNames : catch : `, error);
return null;
}
}
async getSearchByTermTotalItems(searchTerm: string): Promise<number> {
try {
return (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
} catch (error) {
this.handleError(`SearchApi getSearchByTermTotalItems : catch : `, error);
return -1;
}
}
async queryNodesExactNames(searchTerm: string) {
const data = {
query: {
@@ -88,7 +106,7 @@ export class SearchApi extends RepoApi {
await this.apiAuth();
return this.searchApi.search(data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.queryNodesExactNames.name}`, error);
this.handleError(`SearchApi queryNodesExactNames : catch : `, error);
return null;
}
}
@@ -96,7 +114,7 @@ export class SearchApi extends RepoApi {
async waitForApi(username: string, data: { expect: number }) {
try {
const recentFiles = async () => {
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
const totalItems = await this.getTotalItems(username);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -106,7 +124,7 @@ export class SearchApi extends RepoApi {
return await Utils.retryCall(recentFiles);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
Logger.error(`SearchApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}
@@ -114,7 +132,7 @@ export class SearchApi extends RepoApi {
async waitForNodes(searchTerm: string, data: { expect: number }) {
try {
const nodes = async () => {
const totalItems = (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
const totalItems = await this.getSearchByTermTotalItems(searchTerm);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -124,7 +142,7 @@ export class SearchApi extends RepoApi {
return await Utils.retryCall(nodes);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForNodes.name} catch: `);
Logger.error(`SearchApi waitForNodes : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -44,7 +44,7 @@ export class SharedLinksApi extends RepoApi {
};
return await this.sharedlinksApi.createSharedLink(data);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.shareFileById.name}`, error);
this.handleError(`SharedLinksApi shareFileById : catch : `, error);
return null;
}
}
@@ -56,17 +56,17 @@ export class SharedLinksApi extends RepoApi {
return this.shareFileById(current);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.shareFilesByIds.name}`, error);
this.handleError(`SharedLinksApi shareFilesByIds : catch : `, error);
}
}
async getSharedIdOfNode(name: string) {
async getSharedIdOfNode(name: string): Promise<string> {
try {
const sharedLinks = (await this.getSharedLinks()).list.entries;
const found = sharedLinks.find((sharedLink) => sharedLink.entry.name === name);
const sharedLinksEntries = (await this.getSharedLinks())?.list.entries;
const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.name === name);
return (found || { entry: { id: null } }).entry.id;
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getSharedIdOfNode.name}`, error);
this.handleError(`SharedLinksApi getSharedIdOfNode : catch : `, error);
return null;
}
}
@@ -76,24 +76,41 @@ export class SharedLinksApi extends RepoApi {
const id = await this.getSharedIdOfNode(name);
return await this.sharedlinksApi.deleteSharedLink(id);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.unshareFile.name}`, error);
this.handleError(`SharedLinksApi unshareFile : catch : `, error);
}
}
async getSharedLinks() {
try {
await this.apiAuth();
return await this.sharedlinksApi.listSharedLinks();
const opts = {
maxItems: 250
};
return await this.sharedlinksApi.listSharedLinks(opts);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getSharedLinks.name}`, error);
this.handleError(`SharedLinksApi getSharedLinks : catch : `, error);
return null;
}
}
async getSharedLinksTotalItems(): Promise<number> {
try {
await this.apiAuth();
const opts = {
maxItems: 250
};
const sharedList = await this.sharedlinksApi.listSharedLinks(opts);
return sharedList.list.entries.length;
} catch (error) {
this.handleError(`SharedLinksApi getSharedLinksTotalItems : catch : `, error);
return -1;
}
}
async waitForApi(data: { expect: number }) {
try {
const sharedFiles = async () => {
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
const totalItems = await this.getSharedLinksTotalItems();
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -103,7 +120,7 @@ export class SharedLinksApi extends RepoApi {
return await Utils.retryCall(sharedFiles);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
Logger.error(`SharedLinksApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -49,7 +49,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.getSite(siteId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getSite.name}`, error);
this.handleError(`SitesApi getSite : catch : `, error);
return null;
}
}
@@ -59,17 +59,27 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.listSiteMembershipsForPerson(this.getUsername());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getSites.name}`, error);
this.handleError(`SitesApi getSites : catch : `, error);
return null;
}
}
async getDocLibId(siteId: string) {
async getSitesTotalItems(): Promise<number> {
try {
await this.apiAuth();
return (await this.sitesApi.listSiteMembershipsForPerson(this.getUsername())).list.pagination.totalItems;
} catch (error) {
this.handleError(`SitesApi getSitesTotalItems : catch : `, error);
return -1;
}
}
async getDocLibId(siteId: string): Promise<string> {
try {
await this.apiAuth();
return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id;
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getDocLibId.name}`, error);
this.handleError(`SitesApi getDocLibId : catch : `, error);
return null;
}
}
@@ -79,7 +89,7 @@ export class SitesApi extends RepoApi {
const site = await this.getSite(siteId);
return site.entry.visibility;
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getVisibility.name}`, error);
this.handleError(`SitesApi getVisibility : catch : `, error);
return null;
}
}
@@ -89,7 +99,7 @@ export class SitesApi extends RepoApi {
const site = await this.getSite(siteId);
return site.entry.description;
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getDescription.name}`, error);
this.handleError(`SitesApi getDescription : catch : `, error);
return null;
}
}
@@ -99,7 +109,7 @@ export class SitesApi extends RepoApi {
const site = await this.getSite(siteId);
return site.entry.title;
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getTitle.name}`, error);
this.handleError(`SitesApi getTitle : catch : `, error);
return null;
}
}
@@ -116,7 +126,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.createSite(site);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.createSite.name}`, error);
this.handleError(`SitesApi createSite : catch : `, error);
return null;
}
}
@@ -136,7 +146,7 @@ export class SitesApi extends RepoApi {
return this.createSite(current, visibility);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.createSites.name}`, error);
this.handleError(`SitesApi createSites : catch : `, error);
}
}
@@ -149,7 +159,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.deleteSite(siteId, { permanent });
} catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteSite.name}`, error);
this.handleError(`SitesApi deleteSite : catch : `, error);
}
}
@@ -160,7 +170,7 @@ export class SitesApi extends RepoApi {
return this.deleteSite(current, permanent);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteSites.name}`, error);
this.handleError(`SitesApi deleteSites : catch : `, error);
}
}
@@ -173,7 +183,7 @@ export class SitesApi extends RepoApi {
return this.deleteSite(current, permanent);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteAllUserSites.name}`, error);
this.handleError(`SitesApi deleteAllUserSites : catch : `, error);
}
}
@@ -186,7 +196,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.updateSiteMember.name}`, error);
this.handleError(`SitesApi updateSiteMember : catch : `, error);
return null;
}
}
@@ -201,8 +211,12 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.createSiteMembership(siteId, memberBody);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.addSiteMember.name}`, error);
return null;
if (error.status === 409) {
return this.updateSiteMember(siteId, userId, role);
} else {
this.handleError(`SitesApi addSiteMember : catch : `, error);
return null;
}
}
}
@@ -227,7 +241,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.deleteSiteMembership(siteId, userId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteSiteMember.name}`, error);
this.handleError(`SitesApi deleteSiteMember : catch : `, error);
}
}
@@ -240,7 +254,7 @@ export class SitesApi extends RepoApi {
await this.apiAuth();
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.requestToJoin.name}`, error);
this.handleError(`SitesApi requestToJoin : catch : `, error);
return null;
}
}
@@ -251,7 +265,7 @@ export class SitesApi extends RepoApi {
const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map((e) => e.entry.id);
return requests.includes(siteId);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.hasMembershipRequest.name}`, error);
this.handleError(`SitesApi hasMembershipRequest : catch : `, error);
return null;
}
}
@@ -259,7 +273,7 @@ export class SitesApi extends RepoApi {
async waitForApi(data: { expect: number }) {
try {
const sites = async () => {
const totalItems = (await this.getSites()).list.pagination.totalItems;
const totalItems = await this.getSitesTotalItems();
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -269,7 +283,7 @@ export class SitesApi extends RepoApi {
return await Utils.retryCall(sites);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
Logger.error(`SitesApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -40,7 +40,7 @@ export class TrashcanApi extends RepoApi {
await this.apiAuth();
return await this.trashcanApi.deleteDeletedNode(id);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.permanentlyDelete.name}`, error);
this.handleError(`TrashcanApi permanentlyDelete : catch : `, error);
}
}
@@ -49,7 +49,7 @@ export class TrashcanApi extends RepoApi {
await this.apiAuth();
return await this.trashcanApi.restoreDeletedNode(id);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.restore.name}`, error);
this.handleError(`TrashcanApi restore : catch : `, error);
return null;
}
}
@@ -62,11 +62,24 @@ export class TrashcanApi extends RepoApi {
await this.apiAuth();
return await this.trashcanApi.listDeletedNodes(opts);
} catch (error) {
this.handleError(`${this.constructor.name} ${this.getDeletedNodes.name}`, error);
this.handleError(`TrashcanApi getDeletedNodes : catch : `, error);
return null;
}
}
async getDeletedNodesTotalItems(): Promise<number> {
const opts = {
maxItems: 1000
};
try {
await this.apiAuth();
return (await this.trashcanApi.listDeletedNodes(opts)).list.pagination.totalItems;
} catch (error) {
this.handleError(`TrashcanApi getDeletedNodesTotalItems : catch : `, error);
return -1;
}
}
async emptyTrash() {
try {
const ids = (await this.getDeletedNodes()).list.entries.map((entries) => entries.entry.id);
@@ -76,14 +89,14 @@ export class TrashcanApi extends RepoApi {
return this.permanentlyDelete(current);
}, Promise.resolve());
} catch (error) {
this.handleError(`${this.constructor.name} ${this.emptyTrash.name}`, error);
this.handleError(`TrashcanApi emptyTrash : catch : `, error);
}
}
async waitForApi(data: { expect: number }) {
try {
const deletedFiles = async () => {
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
const totalItems = await this.getDeletedNodesTotalItems();
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
@@ -93,7 +106,7 @@ export class TrashcanApi extends RepoApi {
return await Utils.retryCall(deletedFiles);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
Logger.error(`TrashcanApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}

View File

@@ -119,7 +119,7 @@ export class Utils {
await browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`);
}
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1500): Promise<any> {
const pause = (duration: number) => new Promise((res) => setTimeout(res, duration));
const run = (retries: number): Promise<any> => {

View File

@@ -2,18 +2,19 @@
// https://github.com/angular/protractor/blob/master/lib/config.ts
const path = require('path');
const {SpecReporter} = require('jasmine-spec-reporter');
const { SpecReporter } = require('jasmine-spec-reporter');
const fs = require('fs');
const resolve = require('path').resolve;
const logger = require('./tools/helpers/logger');
const retry = require('protractor-retry').retry;
const retry = require('protractor-retry-angular-cli').retry;
const { uploadScreenshot } = require('./e2e/e2e-config/utils/upload-output');
require('dotenv').config({path: process.env.ENV_FILE});
require('dotenv').config({ path: process.env.ENV_FILE });
const SmartRunner = require('protractor-smartrunner');
const projectRoot = path.resolve(__dirname);
const downloadFolder = path.join(__dirname, 'e2e-downloads');
const screenshotsFolder = path.resolve(__dirname, 'e2e-output');
const e2eFolder = path.resolve(projectRoot, 'e2e');
const E2E_HOST = process.env.E2E_HOST || 'http://localhost:4200';
const BROWSER_RUN = process.env.BROWSER_RUN;
@@ -47,7 +48,7 @@ const appConfig = {
};
exports.config = {
allScriptsTimeout: 50000,
allScriptsTimeout: 150000,
params: {
config: appConfig,
@@ -112,7 +113,6 @@ exports.config = {
SELENIUM_PROMISE_MANAGER: false,
capabilities: {
loggingPrefs: {
browser: 'ALL' // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
},
@@ -121,30 +121,32 @@ exports.config = {
maxInstances: MAXINSTANCES,
shardTestFiles: true,
shardTestFiles: MAXINSTANCES > 1,
chromeOptions: {
prefs: {
'credentials_enable_service': false,
'download': {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': downloadFolder
credentials_enable_service: false,
download: {
prompt_for_download: false,
directory_upgrade: true,
default_directory: downloadFolder
},
'browser': {
'setDownloadBehavior': {
'behavior': 'allow',
'downloadPath': downloadFolder
browser: {
setDownloadBehavior: {
behavior: 'allow',
downloadPath: downloadFolder
}
}
},
args: ['--incognito',
args: [
'--incognito',
`--window-size=${width},${height}`,
'--disable-gpu',
'--no-sandbox',
'--disable-web-security',
'--disable-browser-side-navigation',
...(BROWSER_RUN === true ? [] : ['--headless'])]
...(BROWSER_RUN === true ? [] : ['--headless'])
]
}
},
@@ -152,27 +154,31 @@ exports.config = {
baseUrl: E2E_HOST,
getPageTimeout: 50000,
getPageTimeout: 150000,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 100000,
print: function () {
},
...(process.env.CI ? SmartRunner.withOptionalExclusions(resolve(__dirname, './e2e/protractor.excludes.json')) : {})
defaultTimeoutInterval: 150000,
includeStackTrace: true,
print: function () {},
...SmartRunner.withOptionalExclusions(resolve(__dirname, './e2e/protractor.excludes.json'))
},
plugins: [{
package: 'protractor-screenshoter-plugin',
screenshotPath: path.resolve(__dirname, '../e2e-output/'),
screenshotOnExpect: 'failure',
withLogs: true,
writeReportFreq: 'end',
imageToAscii: 'none',
htmlOnExpect: 'none',
htmlOnSpec: 'none'
}],
plugins: [
{
package: 'protractor-screenshoter-plugin',
screenshotPath: screenshotsFolder,
screenshotOnExpect: 'failure',
screenshotOnSpec: 'none',
withLogs: true,
writeReportFreq: 'end',
imageToAscii: 'none',
htmlOnExpect: 'none',
htmlOnSpec: 'none',
clearFoldersBeforeTest: true
}
],
onCleanUp(results) {
if (process.env.CI) {
@@ -182,12 +188,12 @@ exports.config = {
onPrepare() {
if (process.env.CI) {
retry.onPrepare();
const repoHash = process.env.GIT_HASH || '';
const outputDirectory = process.env.SMART_RUNNER_DIRECTORY;
logger.info(`SmartRunner's repoHash: "${repoHash}"`);
logger.info(`SmartRunner's repoHash : "${repoHash}"`);
logger.info(`SmartRunner's outputDirectory: "${outputDirectory}"`);
SmartRunner.apply({outputDirectory, repoHash});
retry.onPrepare();
SmartRunner.apply({ outputDirectory, repoHash });
}
const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json');
@@ -230,7 +236,7 @@ exports.config = {
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, trying to save screenshots.`);
try {
await uploadScreenshot(1, 'ACA');
await uploadScreenshot(1);
console.log('Screenshots saved successfully.');
} catch (e) {
console.log('Error happened while trying to upload screenshots and test reports: ', e);

53
sanity-check.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
show_help() {
echo "Usage: ./start.sh"
echo ""
echo "-hi or --host-ip set the host ip"
echo "-hp or --host-port set the host port. Default 4200"
echo "-h or --help"
}
set_host_ip(){
SET_HOST_IP=$1
}
set_host_port(){
export HOST_PORT=$1
}
set_time(){
export TIME=$1
}
# Defaults
SET_HOST_IP=""
HOST_PORT="8080"
TIME="10000"
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-hi|--host-ip) set_host_ip $2; shift 2;;
-hp|--host-port) set_host_port $2; shift 2;;
-t|--time) set_time $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
if [ -n "${SET_HOST_IP}" ];then
export HOST_IP=${SET_HOST_IP}
else
echo "No HOST_IP set, try to figure out on its own ..."
fi
echo "HOST_IP: ${HOST_IP}"
echo "Waiting for the content ..."
HOST_IP=$HOST_IP HOST_PORT=$HOST_PORT npm run wait:application
if [ $? == 1 ]; then
echo "Angular Application is not running check the configuration"
exit 1
else
echo "Application up and running"
fi

View File

@@ -7,7 +7,7 @@ const fs = require('fs');
const API_HOST = process.env.API_HOST || null;
const API_CONTENT_HOST = process.env.API_CONTENT_HOST || API_HOST;
const API_PROCESS_HOST = process.env.API_PROCESS_HOST || API_HOST;
const API_AOS_HOST = process.env.AOS_HOST || API_HOST;
const API_AOS_HOST = process.env.API_AOS_HOST || API_HOST;
const OAUTH_HOST = process.env.OAUTH_HOST || 'oauth-host-default-replaced-value';
const IDENTITY_HOST = process.env.IDENTITY_HOST || 'identity-host-default-replaced-value';
const NOTIFICATION_LAST = parseInt(process.env.NOTIFICATION_LAST, 10) || 2000;
@@ -21,6 +21,7 @@ const options = {
appConfig.apiHost = API_HOST;
appConfig.bpmHost = API_PROCESS_HOST;
appConfig.ecmHost = API_CONTENT_HOST;
appConfig.baseShareUrl = API_CONTENT_HOST + '/#/preview/s';
appConfig.aosHost = API_AOS_HOST;
}
},

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
show_help() {
echo "Usage: affected-filtered-project.sh"
echo ""
echo "-target Project target"
echo "-tag Filter project with tag"
echo "-name Filter project with name"
}
project_target(){
PROJECT_TARGET=$1
}
target_options(){
OPTIONS="$1"
}
while [[ $1 == -* ]]; do
case "$1" in
-target) project_target $2; shift 2;;
-options) target_options $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac
done
echo "Run alfresco-content-e2e protractor with options $OPTIONS"
echo "./node_modules/.bin/protractor \"./protractor.conf.js\" $OPTIONS || exit 1"
./node_modules/.bin/tsc -p "./e2e/tsconfig.e2e.json" || exit 1;
./node_modules/.bin/http-server -c-1 ./dist/app -p 4200 > /dev/null &\
./node_modules/.bin/protractor "./protractor.conf.js" $OPTIONS || exit 1