From 82bce91216a6847e35833ff0741d6f3b0e933e89 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Wed, 17 Jul 2024 10:16:27 +0200 Subject: [PATCH] feat(Tests):added liftime extension adjustment test --- .../application-vo-actions.component.html | 3 +++ .../adjust-lifetime-request.component.html | 2 ++ .../adjust-lifetime-request.component.ts | 4 ---- tests/openstack_application.spec.ts | 20 ++++++++++++------- tests/page_objects/application_overview.po.ts | 15 +++++++++++++- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/app/applications/application-vo-actions/application-vo-actions.component.html b/src/app/applications/application-vo-actions/application-vo-actions.component.html index d4b11ec942..407ced35d7 100644 --- a/src/app/applications/application-vo-actions/application-vo-actions.component.html +++ b/src/app/applications/application-vo-actions/application-vo-actions.component.html @@ -174,6 +174,7 @@ (click)="showConfirmationModal(ConfirmationActions.APPROVE_APPLICATION)" [disabled]="!selectedComputeCenter" type="button" + tooltip="Approve Application" class="btn btn-success" >   @@ -197,6 +198,7 @@ (click)="showConfirmationModal(ConfirmationActions.APPROVE_EXTENSION)" type="button" class="btn btn-success" + tooltip="Approve Extension" >   Approve Extension @@ -209,6 +211,7 @@ type="button" (click)="showAdjustLifetimeExtensionModal()" class="btn btn-primary" + tooltip="Adjust Extension" >   Adjust Extension diff --git a/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.html b/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.html index 4e09857fd5..4a61a139bc 100644 --- a/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.html +++ b/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.html @@ -40,6 +40,7 @@

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" @@ -91,6 +92,7 @@

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" > diff --git a/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.ts b/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.ts index 2dcb3a6f35..4f43e70759 100644 --- a/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.ts +++ b/src/app/projectmanagement/modals/adjust-lifetime/adjust-lifetime-request.component.ts @@ -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); }, ); diff --git a/tests/openstack_application.spec.ts b/tests/openstack_application.spec.ts index 7fd3c482fc..7b9f28604a 100644 --- a/tests/openstack_application.spec.ts +++ b/tests/openstack_application.spec.ts @@ -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 }) => { @@ -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', () => { diff --git a/tests/page_objects/application_overview.po.ts b/tests/page_objects/application_overview.po.ts index dc01af8d96..80a9322533 100644 --- a/tests/page_objects/application_overview.po.ts +++ b/tests/page_objects/application_overview.po.ts @@ -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'; @@ -146,6 +148,17 @@ export class ApplicationOverviewPage { ); } + async adjustOpenStackLifetimeRequest(application_name: string): Promise { + 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 { await this.goToModificationRequests(); await this.page.waitForTimeout(10000);