Skip to content

Commit

Permalink
Merge pull request #6116 from deNBI/feat/test_adjustment
Browse files Browse the repository at this point in the history
Feat/test adjustment
  • Loading branch information
dweinholz authored Jul 22, 2024
2 parents cd1af5e + a4c1265 commit c4fdd09
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
(click)="showConfirmationModal(ConfirmationActions.APPROVE_APPLICATION)"
[disabled]="!selectedComputeCenter"
type="button"
tooltip="Approve Application"
class="btn btn-success"
>
<i class="fa fa-check"></i>&nbsp;
Expand All @@ -197,6 +198,7 @@
(click)="showConfirmationModal(ConfirmationActions.APPROVE_EXTENSION)"
type="button"
class="btn btn-success"
tooltip="Approve Extension"
>
<i class="fa fa-check"></i>&nbsp;
<span class="d-none">Approve Extension</span>
Expand All @@ -209,6 +211,7 @@
type="button"
(click)="showAdjustLifetimeExtensionModal()"
class="btn btn-primary"
tooltip="Adjust Extension"
>
<i class="fa fa-pen"></i>&nbsp;
<span class="d-none"> Adjust Extension</span>
Expand All @@ -228,6 +231,7 @@
[attr.data-test-id]="'modification_approval_' + application?.project_application_name"
(click)="showConfirmationModal(ConfirmationActions.APPROVE_MODIFICATION)"
type="button"
tooltip="Approve Modification"
class="btn btn-success"
>
<i class="fa fa-check"></i>&nbsp;
Expand All @@ -246,6 +250,7 @@
[attr.data-test-id]="'modification_approval_' + application?.project_application_name"
(click)="showClientsLimitsModal(true)"
type="button"
tooltip="Approve Modification"
class="btn btn-success"
>
<i class="fa fa-check"></i>&nbsp;
Expand All @@ -262,6 +267,7 @@
[attr.data-test-id]="'modification_adjustment_' + application?.project_application_shortname"
style="margin: 2px"
type="button"
tooltip="Adjust Modification"
(click)="showModificationAdjustmentModal()"
class="btn btn-primary"
>
Expand All @@ -276,6 +282,7 @@
<button
type="button"
class="btn btn-danger"
tooltip="Decline Modification"
style="margin: 2px"
(click)="showConfirmationModal(ConfirmationActions.DECLINE_MODIFICATION)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h4>Adjust lifetime extension for {{ application?.project_application_shortname
required
class="form-control"
id="adjusted_lifetime_counter"
data-test-id="adjusted_lifetime_counter"
name="adjusted_lifetime_counter"
placeholder="e.g. 3 months"
type="number"
Expand Down Expand Up @@ -91,6 +92,7 @@ <h4>Adjust lifetime extension for {{ application?.project_application_shortname
class="btn btn-primary"
form="lifetime_adjustment_form"
id="submitLifetimeAdjustmentButton"
data-test-id="submitLifetimeAdjustmentButton"
(click)="adjustLifetimeExtension()"
[disabled]="lifetimeAdjustmentForm.invalid"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ export class AdjustLifetimeRequestComponent implements OnInit {
this.loaded = false;
this.applicationsService.adjustLifetimeExtension(this.adjustedApplicationLifetimeExtension).subscribe(
(): void => {
this.hide();

this.eventSuccess.emit(true);
},
(): void => {
this.hide();

this.eventSuccess.emit(false);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ <h6 class="col-md-8 form-control-label">
type="text"
id="id_project_application_renewal_manager_comment"
name="project_application_renewal_manager_comment"
data-test-id="vo_manager_comment_input"
class="form-control"
maxlength="8192"
placeholder=""
Expand Down Expand Up @@ -724,7 +725,7 @@ <h6 class="col-md-8 form-control-label">
class="btn btn-primary"
form="resource_modification_application_form"
id="submit_adjustment_btn"
data-test-id="submit_modification_request_button"
data-test-id="submit_modification_adjustment_button"
(click)="bsModalRef.hide(); showSubmitModal(true)"
[disabled]="modificationForm.invalid || !min_vm_adjusted"
>
Expand Down
14 changes: 14 additions & 0 deletions tests/openstack_application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ test.describe.serial('@openstack_application', () => {
await projectOverviewPage.requestProjectExtension(false);
});
});
test.describe('Should adjust a project lifetime extesion for OpenStack', () => {
test.use({ storageState: Util.VO_MANAGER_STORAGE });
test('VO @openstack_application', async ({ page, baseURL }) => {
const applicationPage = new ApplicationOverviewPage(page, baseURL);
await applicationPage.adjustOpenStackLifetimeRequest(Util.OPENSTACK_APPLICATION_NAME);
});
});
test.describe('Should request a project modification for OpenStack', () => {
test.use({ storageState: Util.MEMBER_STORAGE });
test('Member @openstack_application', async ({ page, baseURL }) => {
Expand All @@ -102,6 +109,13 @@ test.describe.serial('@openstack_application', () => {
await projectOverviewPage.requestProjectModification(false);
});
});
test.describe('Should adjust a project modification for OpenStack', () => {
test.use({ storageState: Util.VO_MANAGER_STORAGE });
test('VO @openstack_application', async ({ page, baseURL }) => {
const applicationPage = new ApplicationOverviewPage(page, baseURL);
await applicationPage.adjustOpenStackModificationRequest(Util.OPENSTACK_APPLICATION_NAME);
});
});
test.describe('Should approve a project extension for OpenStack', () => {
test.use({ storageState: Util.VO_MANAGER_STORAGE });
test('VO @openstack_application', async ({ page, baseURL }) => {
Expand Down
98 changes: 76 additions & 22 deletions tests/page_objects/application_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ export class ApplicationOverviewPage {
private SUBMITTED_APPLICATIONS_TAB: string = 'submitted_applications_tab';
private LOADING_APPLICATIONS: string = 'loading_applications';
private APPLICATIONS_CONTAINER: string = 'applications_container';

private MODIFICATION_ADJUSTMENT_PREFIX = 'modification_adjustment_';
private LIFETIME_ADJUSTMENT_PREFIX: string = 'extension_adjustment_';
private ADJUSTMENT_FLAVOR_STD_4: string = 'adjusted_std_4'; // de.NBI mini
private VO_MANAGER_COMMENT_INPUT: string = 'vo_manager_comment_input';
private SUBMIT_MODIFICATION_ADJUSTMENT_BUTTON: string = 'submit_modification_adjustment_button';
private CONFIRM_ADJUSTMENT_BUTTON: string = 'confirm_adjustment_request_button';
private MODIFICATION_ADJUSTMENT_REQUEST: string = 'modification_adjustment_request_result_div';
private MODIFICATION_ADJUSTMENT_SUCCESSFULL_TXT: string = 'Modification adjustment successfully submitted!';
private SUBMITTED_LIFETIME_ADJUSTMENT_BUTTON: string = 'submitLifetimeAdjustmentButton';
private ADJUSTED_LIFETIME_COUNTER: string = 'adjusted_lifetime_counter';
private CONFIRM_CONFIRMATION_MODAL_BUTTON: string = 'confirm_confirmation_modal_btn';
private SITE_LOADER: string = 'site-loader';

Expand Down Expand Up @@ -64,7 +73,6 @@ export class ApplicationOverviewPage {
state: 'visible',
});
console.log('submitted visible');

}

async goToLifetimeRequests() {
Expand Down Expand Up @@ -99,7 +107,10 @@ export class ApplicationOverviewPage {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < application_count; i++) {
// eslint-disable-next-line no-await-in-loop
await this.page.locator(Util.by_data_test_id_str_prefix(this.DECLINE_OPEN_APPLICATION_PRE + projectName)).first().click();
await this.page
.locator(Util.by_data_test_id_str_prefix(this.DECLINE_OPEN_APPLICATION_PRE + projectName))
.first()
.click();
// eslint-disable-next-line no-await-in-loop
await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click();
// eslint-disable-next-line no-await-in-loop
Expand All @@ -111,10 +122,41 @@ export class ApplicationOverviewPage {

async approveOpenStackModificationRequest(application_name: string): Promise<any> {
await this.goToModificationRequests();
await this.page.locator(Util.by_data_test_id_str_prefix(this.MODIFICATION_APPROVAL_BTN_PREFIX + application_name)).click();
await this.page
.locator(Util.by_data_test_id_str_prefix(this.MODIFICATION_APPROVAL_BTN_PREFIX + application_name))
.click();
await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click();
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);
}

async adjustOpenStackModificationRequest(application_name: string): Promise<any> {
await this.goToModificationRequests();
await this.page
.locator(Util.by_data_test_id_str_prefix(this.MODIFICATION_ADJUSTMENT_PREFIX + application_name))
.click();
await this.page.waitForTimeout(2000);
console.log('Fill Adjustment Flavor');
await this.page.fill(Util.by_data_test_id_str(this.ADJUSTMENT_FLAVOR_STD_4), '4');
console.log('Fill Vo Adjustment Comment ');

await this.page.fill(Util.by_data_test_id_str(this.VO_MANAGER_COMMENT_INPUT), 'PlawrightUpdate');
await Util.clickByDataTestIdStr(this.page, this.SUBMIT_MODIFICATION_ADJUSTMENT_BUTTON);
await Util.clickByDataTestIdStr(this.page, this.CONFIRM_ADJUSTMENT_BUTTON);
console.log('Wait for Success Message');
await this.page.waitForSelector(
`data-test-id=${this.MODIFICATION_ADJUSTMENT_REQUEST} >> text=${this.MODIFICATION_ADJUSTMENT_SUCCESSFULL_TXT}`,
);
}

async adjustOpenStackLifetimeRequest(application_name: string): Promise<any> {
await this.goToLifetimeRequests();
await this.page.locator(Util.by_data_test_id_str_prefix(this.LIFETIME_ADJUSTMENT_PREFIX + application_name)).click();
await this.page.waitForTimeout(2000);
await this.page.fill(Util.by_data_test_id_str(this.ADJUSTED_LIFETIME_COUNTER), '3');

await Util.clickByDataTestIdStr(this.page, this.SUBMITTED_LIFETIME_ADJUSTMENT_BUTTON);
console.log('Wait for Success Message');
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);
}

async approveSimpleVMModificationRequest(application_name: string): Promise<any> {
Expand All @@ -135,7 +177,6 @@ export class ApplicationOverviewPage {
.first()
.click();
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);

}

async approveSimpleVMExtensionRequest(application_name: string): Promise<any> {
Expand All @@ -146,41 +187,54 @@ export class ApplicationOverviewPage {
.click();
await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click();
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);

}

async approveOpenStackExtensionRequest(application_name: string): Promise<any> {
await this.goToLifetimeRequests();
await this.page.locator(Util.by_data_test_id_str_prefix(this.EXTENSION_APPROVAL_BTN_PREFIX + application_name)).click();
await this.page
.locator(Util.by_data_test_id_str_prefix(this.EXTENSION_APPROVAL_BTN_PREFIX + application_name))
.click();
await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click();
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);

}

async approveSimpleVm(application_name: string): Promise<any> {
console.log('Approve Simple VM');
await this.goToSubmittedApplication();
await this.page.waitForSelector(Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name), {
state: 'visible',
});
await this.page.selectOption(Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name), {
label: this.DEFAULT_DENBI_COMPUTE_CENTER,
});
await this.page.waitForSelector(
Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name),
{
state: 'visible',
},
);
await this.page.selectOption(
Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name),
{
label: this.DEFAULT_DENBI_COMPUTE_CENTER,
},
);
await this.page.locator(Util.by_data_test_id_str_prefix(this.APPROVAL_PREFIX + application_name)).click();
await this.page.locator(Util.by_data_test_id_str_prefix(this.APPROVAL_CLIENT_LIMIT_PREFIX + application_name)).click();
await this.page
.locator(Util.by_data_test_id_str_prefix(this.APPROVAL_CLIENT_LIMIT_PREFIX + application_name))
.click();
await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`);

}

async approveOpenStackApplication(application_name: string): Promise<any> {
console.log('Approve Openstack');
await this.goToSubmittedApplication();
await this.page.waitForSelector(Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name), {
state: 'visible',
});
await this.page.selectOption(Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name), {
label: this.DEFAULT_DENBI_COMPUTE_CENTER,
});
await this.page.waitForSelector(
Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name),
{
state: 'visible',
},
);
await this.page.selectOption(
Util.by_data_test_id_str_prefix(this.COMPUTE_CENTER_SELECTION_PREFIX + application_name),
{
label: this.DEFAULT_DENBI_COMPUTE_CENTER,
},
);
await this.page.waitForTimeout(10000);
await this.page.locator(Util.by_data_test_id_str_prefix(this.APPROVAL_PREFIX + application_name)).isEnabled();
await this.page.locator(Util.by_data_test_id_str_prefix(this.APPROVAL_PREFIX + application_name)).click();
Expand Down
9 changes: 5 additions & 4 deletions tests/page_objects/login.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ export class LoginPagePlaywright {
async useOrcid(email: string, psw: string): Promise<any> {
console.log('Using Orcid Login');
await Util.consoleLogCurrentUrl(this.page);
const link = await this.page.locator('a:has-text("ORCID")').first({ timeout: 15000 });
await this.page.locator('a:has-text("ORCID")').elementHandle({ timeout: 10000});
const link = this.page.locator('a:has-text("ORCID")').first();
await link.click();
await Util.consoleLogCurrentUrl(this.page);
await this.acceptAllCookies();
console.log('Waiting for login page');
await Util.consoleLogCurrentUrl(this.page);
await this.page.waitForURL('https://orcid.org/signin**', { timeout: 5000 });
await this.page.waitForURL('https://orcid.org/signin**', { timeout: 10000 });
await this.page.fill('id=username-input', email);
await this.page.fill('id=password', psw);
console.log('click signin button');
Expand All @@ -78,7 +79,7 @@ export class LoginPagePlaywright {
await this.giveConsent();
await Util.consoleLogCurrentUrl(this.page);
// await this.skipElixirTestWarning()
await this.page.waitForURL(`${this.baseURL}/#/userinfo`);
await this.page.waitForURL(`**/userinfo`);
await Util.consoleLogCurrentUrl(this.page);
}

Expand All @@ -101,7 +102,7 @@ export class LoginPagePlaywright {
try {
await this.page.waitForURL('**/oauth/authorize**', { timeout: 5000 });
await this.page.waitForSelector('[id="authorize-button"]');
const authorizeButton = await this.page.$('[id="authorize-button"]');
const authorizeButton = await this.page.$('[id="authorize-button"]')
authorizeButton?.click();
} catch (error) {
console.log(`Didn't Authorize ${error}`);
Expand Down

0 comments on commit c4fdd09

Please sign in to comment.