diff --git a/e2e/utilities/repo-client/apis/search/search-api.ts b/e2e/utilities/repo-client/apis/search/search-api.ts
index e2549dc39..d8d879caf 100755
--- a/e2e/utilities/repo-client/apis/search/search-api.ts
+++ b/e2e/utilities/repo-client/apis/search/search-api.ts
@@ -60,6 +60,6 @@ export class SearchApi extends RepoApiNew {
}
};
- return Utils.retryCall(recentFiles);
+ return await Utils.retryCall(recentFiles);
}
}
diff --git a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts
index b7595e294..94024a6a7 100755
--- a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts
+++ b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts
@@ -71,6 +71,6 @@ export class SharedLinksApi extends RepoApiNew {
}
};
- return Utils.retryCall(sharedFiles);
+ return await Utils.retryCall(sharedFiles);
}
}
diff --git a/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts b/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts
old mode 100755
new mode 100644
index 0f94d5ee6..f8dcf15cf
--- a/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts
+++ b/e2e/utilities/repo-client/apis/trashcan/trashcan-api.ts
@@ -23,54 +23,52 @@
* along with Alfresco. If not, see .
*/
-import { RepoApi } from '../repo-api';
+import { RepoApiNew } from '../repo-api-new';
import { Utils } from '../../../../utilities/utils';
-export class TrashcanApi extends RepoApi {
- permanentlyDelete(id: string): Promise {
- return this
- .delete(`/deleted-nodes/${id}`)
- .catch(this.handleError);
+export class TrashcanApi extends RepoApiNew {
+
+ constructor(username?, password?) {
+ super(username, password);
}
- restore(id: string) {
- return this
- .post(`/deleted-nodes/${id}/restore`)
- .catch(this.handleError);
+ async permanentlyDelete(id: string) {
+ await this.apiAuth();
+ return await this.alfrescoJsApi.core.nodesApi.purgeDeletedNode(id);
}
- getDeletedNodes(): Promise {
- return this
- .get(`/deleted-nodes?maxItems=1000`)
- .catch(this.handleError);
+ async restore(id: string) {
+ await this.apiAuth();
+ return await this.alfrescoJsApi.core.nodesApi.restoreNode(id);
}
- emptyTrash(): Promise {
- return this.getDeletedNodes()
- .then(resp => {
- return resp.data.list.entries.map(entries => entries.entry.id);
- })
- .then(ids => {
- return ids.reduce((previous, current) => (
- previous.then(() => this.permanentlyDelete(current))
- ), Promise.resolve());
- })
- .catch(this.handleError);
+ async getDeletedNodes() {
+ const opts = {
+ maxItems: 1000
+ };
+ await this.apiAuth();
+ return await this.alfrescoJsApi.core.nodesApi.getDeletedNodes(opts);
}
- waitForApi(data) {
- const deletedFiles = () => {
- return this.getDeletedNodes()
- .then(response => response.data.list.pagination.totalItems)
- .then(totalItems => {
- if ( totalItems < data.expect) {
- return Promise.reject(totalItems);
- } else {
- return Promise.resolve(totalItems);
- }
- });
+ async emptyTrash() {
+ const ids = (await this.getDeletedNodes()).list.entries.map(entries => entries.entry.id);
+
+ return await ids.reduce(async (previous, current) => {
+ await previous;
+ return await this.permanentlyDelete(current);
+ }, Promise.resolve());
+ }
+
+ async waitForApi(data) {
+ const deletedFiles = async () => {
+ const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
+ if ( totalItems < data.expect) {
+ return Promise.reject(totalItems);
+ } else {
+ return Promise.resolve(totalItems);
+ }
};
- return Utils.retryCall(deletedFiles);
+ return await Utils.retryCall(deletedFiles);
}
}
diff --git a/e2e/utilities/repo-client/repo-client.ts b/e2e/utilities/repo-client/repo-client.ts
index b9edf5f76..1528e27b6 100755
--- a/e2e/utilities/repo-client/repo-client.ts
+++ b/e2e/utilities/repo-client/repo-client.ts
@@ -66,7 +66,7 @@ export class RepoClient {
}
get trashcan() {
- return new TrashcanApi(this.auth, this.config);
+ return new TrashcanApi(this.auth.username, this.auth.password);
}
get search() {