Skip to content

Commit

Permalink
feat(Tests):added test for modification adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jul 17, 2024
1 parent cd1af5e commit d1dadf0
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,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 +247,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 +264,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 +279,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 @@ -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
8 changes: 8 additions & 0 deletions tests/openstack_application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ test.describe.serial('@openstack_application', () => {
await projectOverviewPage.goToProjectOverview(Util.OPENSTACK_APPLICATION_NAME);
await projectOverviewPage.requestProjectModification(false);
});

test.describe('Should ajdust 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 });
Expand Down
83 changes: 62 additions & 21 deletions tests/page_objects/application_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ 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 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 CONFIRM_CONFIRMATION_MODAL_BUTTON: string = 'confirm_confirmation_modal_btn';
private SITE_LOADER: string = 'site-loader';
Expand Down Expand Up @@ -64,7 +71,6 @@ export class ApplicationOverviewPage {
state: 'visible',
});
console.log('submitted visible');

}

async goToLifetimeRequests() {
Expand Down Expand Up @@ -99,7 +105,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 +120,30 @@ 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 approveSimpleVMModificationRequest(application_name: string): Promise<any> {
Expand All @@ -135,7 +164,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 +174,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

0 comments on commit d1dadf0

Please sign in to comment.