Skip to content

Commit

Permalink
fix viewer page loading method (#6577)
Browse files Browse the repository at this point in the history
  • Loading branch information
eromano committed Jan 26, 2021
1 parent 099bec6 commit 5258a34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
21 changes: 19 additions & 2 deletions lib/cli/scripts/init-aae-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function getApplicationByStatus(status: string) {
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword);

return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts).on('error',(error)=>{
contentTypes, accepts).on('error', (error) => {
logger.error(`Get application by status ${error} `);
});

Expand Down Expand Up @@ -138,7 +138,7 @@ function getProjectRelease(projectId: string) {
}
}

function releaseProject(projectId: string) {
async function releaseProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;

const pathParams = {}, queryParams = {},
Expand All @@ -149,11 +149,28 @@ function releaseProject(projectId: string) {
contentTypes, accepts);

} catch (error) {
await deleteProject(projectId);
logger.error('Post Projects Release' + error.status);
isValid = false;
}
}

function deleteProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}`;

const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
try {
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);

} catch (error) {
logger.error('Delete project error' + error.status);
isValid = false;
}
}

async function importAndReleaseProject(absoluteFilePath: string) {
const fileContent = await fs.createReadStream(absoluteFilePath);

Expand Down
9 changes: 6 additions & 3 deletions lib/testing/src/lib/core/pages/viewer.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { Logger } from '../utils/logger';

export class ViewerPage {

MAX_LOADING_TIME = 120000;

tabsPage = new TabsPage();
togglePage = new TogglePage();

Expand Down Expand Up @@ -117,13 +119,14 @@ export class ViewerPage {
async waitTillContentLoaded(): Promise<void> {
await browser.sleep(500);

if (this.isSpinnerPresent()) {
if (await this.isSpinnerPresent()) {
Logger.log('wait spinner disappear');
await BrowserVisibility.waitUntilElementIsNotPresent(element(by.tagName('mat-progress-spinner')));
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
} else {
try {
Logger.log('wait spinner is present');
await BrowserVisibility.waitUntilElementIsPresent(element(by.tagName('mat-progress-spinner')));
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner')));
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), this.MAX_LOADING_TIME);
} catch (error) {
}
}
Expand Down

0 comments on commit 5258a34

Please sign in to comment.