Skip to content

Commit

Permalink
feat(Tests):added liftime extension adjustment test
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jul 17, 2024
1 parent d1dadf0 commit 82bce91
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 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 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
20 changes: 13 additions & 7 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 @@ -101,13 +108,12 @@ 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 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', () => {
Expand Down
15 changes: 14 additions & 1 deletion tests/page_objects/application_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ export class ApplicationOverviewPage {
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 @@ -146,6 +148,17 @@ export class ApplicationOverviewPage {
);
}

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> {
await this.goToModificationRequests();
await this.page.waitForTimeout(10000);
Expand Down

0 comments on commit 82bce91

Please sign in to comment.