mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5639] fix viewer exclude test from protractor and playwright (#3443)
* [ACS-5923] sidenav and singleclick test * remove protractor test and fix flaky test * test fix * [ACS-5639] fix exclude test in viewer * remove exclude test and fix test
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
import { FavoriteEntry } from '@alfresco/js-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../utils';
|
||||
|
||||
export class FavoritesPageApi {
|
||||
private apiService: ApiClientFactory;
|
||||
@@ -47,4 +49,38 @@ export class FavoritesPageApi {
|
||||
};
|
||||
return await this.apiService.favorites.createFavorite('-me-', data);
|
||||
}
|
||||
|
||||
private async getFavorites(username: string) {
|
||||
try {
|
||||
return await this.apiService.favorites.listFavorites(username);
|
||||
} catch (error) {
|
||||
Logger.error(`FavoritesApi getFavorites : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async isFavorite(username: string, nodeId: string) {
|
||||
try {
|
||||
return JSON.stringify((await this.getFavorites(username)).list.entries).includes(nodeId);
|
||||
} catch (error) {
|
||||
Logger.error(`FavoritesApi isFavorite : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async isFavoriteWithRetry(username: string, nodeId: string, data: { expect: boolean }) {
|
||||
let isFavorite = false;
|
||||
try {
|
||||
const favorite = async () => {
|
||||
isFavorite = await this.isFavorite(username, nodeId);
|
||||
if (isFavorite !== data.expect) {
|
||||
return Promise.reject(isFavorite);
|
||||
} else {
|
||||
return Promise.resolve(isFavorite);
|
||||
}
|
||||
};
|
||||
return await Utils.retryCall(favorite);
|
||||
} catch (error) {}
|
||||
return isFavorite;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user