mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
fix
This commit is contained in:
@@ -37,7 +37,7 @@ export class UploadActions {
|
||||
async uploadFile(fileLocation, fileName, parentFolderId): Promise<any> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
|
||||
return this.uploadApi.uploadFile(
|
||||
const uploadPromise = this.uploadApi.uploadFile(
|
||||
file,
|
||||
'',
|
||||
parentFolderId,
|
||||
@@ -48,6 +48,12 @@ export class UploadActions {
|
||||
renditions: 'doclib'
|
||||
}
|
||||
);
|
||||
|
||||
uploadPromise.then(() => {
|
||||
Logger.info(`${fileName} uploaded in ${parentFolderId}`);
|
||||
})
|
||||
|
||||
return uploadPromise;
|
||||
}
|
||||
|
||||
async createEmptyFiles(emptyFileNames: string[], parentFolderId): Promise<NodeEntry> {
|
||||
@@ -74,6 +80,7 @@ export class UploadActions {
|
||||
async deleteFileOrFolder(nodeId: string) {
|
||||
const apiCall = async () => {
|
||||
try {
|
||||
Logger.error(`Deleting ${nodeId}`);
|
||||
return this.nodesApi.deleteNode(nodeId, { permanent: true });
|
||||
} catch (error) {
|
||||
Logger.error('Error delete file or folder');
|
||||
@@ -91,8 +98,18 @@ export class UploadActions {
|
||||
if (files && files.length > 0) {
|
||||
for (const fileName of files) {
|
||||
const pathFile = path.join(sourcePath, fileName);
|
||||
promises.push(this.uploadFile(pathFile, fileName, folder));
|
||||
|
||||
const uploadPromise = this.uploadFile(pathFile, fileName, folder);
|
||||
|
||||
await uploadPromise.then(() => {
|
||||
Logger.info(`File ${fileName} uploaded successfully in ${folder}!`);
|
||||
}).catch(() => {
|
||||
Logger.error(`File ${fileName} error during the upload in ${folder}!`);
|
||||
});
|
||||
|
||||
promises.push(uploadPromise);
|
||||
}
|
||||
|
||||
uploadedFiles = await Promise.all(promises);
|
||||
}
|
||||
|
||||
|
@@ -83,6 +83,14 @@ export class IdentityService {
|
||||
const queryParams = {};
|
||||
const postBody = {};
|
||||
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
|
||||
const deletePromise = this.api.performIdentityOperation(path, method, queryParams, postBody)
|
||||
|
||||
deletePromise.then(() => {
|
||||
Logger.info(`user ${userId} delete`);
|
||||
})
|
||||
|
||||
return deletePromise;
|
||||
}
|
||||
|
||||
async getUserInfoByUsername(username: string): Promise<any> {
|
||||
|
@@ -66,6 +66,8 @@ export class LoginPage {
|
||||
Logger.log('Login With ' + username);
|
||||
const authType = await LocalStorageUtil.getConfigField('authType');
|
||||
|
||||
Logger.log(`AuthType ${authType}`);
|
||||
|
||||
if (!authType || authType === 'OAUTH') {
|
||||
await this.loginSSOIdentityService(username, password, options);
|
||||
} else {
|
||||
@@ -83,7 +85,10 @@ export class LoginPage {
|
||||
await BrowserActions.getUrl(loginURL);
|
||||
|
||||
if (oauth2 && oauth2.silentLogin === false) {
|
||||
Logger.log(`Login SSO`);
|
||||
await this.clickOnSSOButton();
|
||||
}else{
|
||||
Logger.log(`Login SSO silent login`);
|
||||
}
|
||||
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.usernameField);
|
||||
@@ -98,6 +103,8 @@ export class LoginPage {
|
||||
}
|
||||
|
||||
async loginBasicAuth(username: string, password: string, options: LoginOptions = { waitForUserIcon: true }): Promise<void> {
|
||||
Logger.log(`Login Basic`);
|
||||
|
||||
await this.goToLoginPage();
|
||||
|
||||
await this.enterUsernameBasicAuth(username);
|
||||
|
@@ -23,7 +23,7 @@ export class FileBrowserUtil {
|
||||
|
||||
static async isFileDownloaded(fileName: string): Promise<boolean> {
|
||||
const DEFAULT_ROOT_PATH = browser.params.testConfig ? browser.params.testConfig.main.rootPath : __dirname;
|
||||
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000);
|
||||
const file = await browser.driver.wait(() => fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName)), 30000,`${fileName} not downloaded`);
|
||||
|
||||
await expect(file).toBe(true, `${fileName} not downloaded`);
|
||||
|
||||
|
Reference in New Issue
Block a user