[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:
Akash Rathod
2023-09-25 18:39:16 +02:00
committed by GitHub
parent 97f01386f8
commit be761bae7d
13 changed files with 191 additions and 375 deletions

View File

@@ -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;
}
}