[ADF-4457] StorageService should be independent of AppConfigService (#4712)

* [ADF-4457] StorageService should be independent of AppConfigService

* [ADF-4457] Fix e2e tests

* [ADF-4457] Fix e2e tests

* [ADF-4457] Improve storage service workflow

* Fix linting

* Fix unit tests

* Fix e2e test

* Add missing class to constructor

* Fix e2e test

* Rebase branch

* Improve unit test

* fix test
This commit is contained in:
davidcanonieto
2019-06-25 16:21:13 +01:00
committed by Eugenio Romano
parent 90c403ae9e
commit 5c07d5b3e6
29 changed files with 432 additions and 369 deletions

View File

@@ -31,6 +31,12 @@ export class LocalStorageUtil {
);
}
static async removeStorageItem(field: string) {
await browser.executeScript(
'window.adf.removeStorageItem(`' + field + '`);'
);
}
static async setUserPreference(field: string, value: any) {
await browser.executeScript(
'window.adf.setUserPreference(`' + field + '`, `' + value + '`);'

View File

@@ -16,7 +16,7 @@
*/
import { AlfrescoApiCompatibility, AlfrescoApiConfig } from '@alfresco/js-api';
import { AlfrescoApiService, AppConfigValues, AppConfigService } from '@alfresco/adf-core';
import { AlfrescoApiService, AppConfigValues, AppConfigService, StorageService } from '@alfresco/adf-core';
export class TestingAlfrescoApiService extends AlfrescoApiService {
@@ -25,9 +25,10 @@ export class TestingAlfrescoApiService extends AlfrescoApiService {
config = {
};
constructor(public appConfig: AppConfigService) {
super(null);
constructor(public appConfig: AppConfigService, public storageService: StorageService) {
super(null, null);
const oauth = Object.assign({}, this.appConfig.get<any>(AppConfigValues.OAUTHCONFIG, null));
this.storageService.prefix = this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX, '');
this.config = new AlfrescoApiConfig({
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
@@ -37,6 +38,7 @@ export class TestingAlfrescoApiService extends AlfrescoApiService {
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
domainPrefix: this.storageService.prefix,
oauth2: oauth
});
}