diff --git a/tests/page_objects/application_overview.po.ts b/tests/page_objects/application_overview.po.ts index 888fa05b16..69d00de806 100644 --- a/tests/page_objects/application_overview.po.ts +++ b/tests/page_objects/application_overview.po.ts @@ -54,8 +54,12 @@ export class ApplicationOverviewPage { async goToSubmittedApplication() { await this.goto(); + console.log('Click submitted tab'); + await this.page.locator(Util.by_data_test_id_str(this.SUBMITTED_APPLICATIONS_TAB)).click(); + console.log('wait till loader is hidden'); await this.page.waitForSelector(Util.by_data_test_id_str(this.LOADING_APPLICATIONS), { state: 'hidden' }); + console.log('wait till submitted visible'); await this.page.waitForSelector(Util.by_data_test_id_str('submitted_applications_container'), { state: 'visible', }); @@ -107,9 +111,8 @@ export class ApplicationOverviewPage { await this.goToModificationRequests(); await this.page.locator(Util.by_data_test_id_str(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_MESSAGE} >> text=${this.MODIFICATION_REQUEST_RESULT_TEXT}`, - ); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + } async approveSimpleVMModificationRequest(application_name: string): Promise { @@ -129,9 +132,8 @@ export class ApplicationOverviewPage { .locator(Util.by_data_test_id_str_prefix(this.APPROVAL_CLIENT_LIMIT_PREFIX + application_name)) .first() .click(); - await this.page.waitForSelector( - `data-test-id=${this.NOTIFICATION_MESSAGE} >> text=${this.MODIFICATION_REQUEST_RESULT_TEXT}`, - ); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + } async approveSimpleVMExtensionRequest(application_name: string): Promise { @@ -141,18 +143,16 @@ export class ApplicationOverviewPage { .first() .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_MESSAGE} >> text=${this.EXTENSION_RESULT_SIMPLEVM_TEXT}`, - ); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + } async approveOpenStackExtensionRequest(application_name: string): Promise { await this.goToLifetimeRequests(); await this.page.locator(Util.by_data_test_id_str(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_MESSAGE} >> text=${this.EXTENSION_RESULT_OPENSTACK_TEXT}`, - ); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + } async approveSimpleVm(application_name: string): Promise { @@ -166,7 +166,8 @@ export class ApplicationOverviewPage { }); await this.page.locator(Util.by_data_test_id_str(this.APPROVAL_PREFIX + application_name)).click(); await this.page.locator(Util.by_data_test_id_str(this.APPROVAL_CLIENT_LIMIT_PREFIX + application_name)).click(); - await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MESSAGE} >> text=${this.SIMPLE_VM_CREATED}`); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + } async approveOpenStackApplication(application_name: string): Promise { @@ -183,6 +184,8 @@ export class ApplicationOverviewPage { await this.page.locator(Util.by_data_test_id_str(this.APPROVAL_PREFIX + application_name)).click(); await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click(); await this.page.waitForSelector(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE), { state: 'visible' }); + await this.page.waitForTimeout(5000); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); const approval_response: string = await this.page.innerText(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE)); expect(approval_response).toContain(this.PROJECT_FACILITY_ASSIGNED); diff --git a/tests/page_objects/facility_application_overview.po.ts b/tests/page_objects/facility_application_overview.po.ts index 8c8418411b..1fa6da8273 100644 --- a/tests/page_objects/facility_application_overview.po.ts +++ b/tests/page_objects/facility_application_overview.po.ts @@ -27,6 +27,7 @@ export class FacilityApplicationOverviewPage { private readonly CLOSE_NOTIFICATION_BTN: string = 'close_notification_modal_btn'; private DEFAULT_DENBI_COMPUTE_CENTER: string = 'de.NBI Cloud Portal - Development'; private readonly SELECT_FACILITY_SELECT: string = 'selectFacilitySelect'; + private CONFIRM_CONFIRMATION_MODAL_BUTTON: string = 'confirm_confirmation_modal_btn'; private readonly TERMINATE_REQUESTS_APPLICATIONS_TAB = 'terminate_requests_applications_tab'; @@ -57,8 +58,12 @@ export class FacilityApplicationOverviewPage { async goToSubmittedApplication() { await this.goto(); + console.log('Click submitted tab'); await this.page.locator(Util.by_data_test_id_str(this.SUBMITTED_APPLICATIONS_TAB)).click(); + console.log('Wait that loader is absent'); await this.page.waitForSelector(Util.by_data_test_id_str(this.LOADING_APPLICATIONS), { state: 'hidden' }); + console.log('Wait till submitted applications are visible'); + await this.page.waitForSelector(Util.by_data_test_id_str(this.SUBMITTED_APPLICATIONS_CONTAINER), { state: 'visible', }); @@ -112,11 +117,13 @@ export class FacilityApplicationOverviewPage { async approveApplication(application_name: string): Promise { await this.goToSubmittedApplication(); - console.log(`Approve Application${application_name}`); + console.log(`Approve Application: ${application_name}`); await this.page.locator(Util.by_data_test_id_str(this.APPLICATION_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`); - const approval_response: string = await this.page.innerText(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE)); - expect(approval_response).toContain(this.SUCCESSFULLY_APPROVED_APPL); + // const approval_response: string = await this.page.innerText(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE), { timeout: 10000 }); + // expect(approval_response).toContain(this.SUCCESSFULLY_APPROVED_APPL); await this.page.locator(Util.by_data_test_id_str(this.CLOSE_NOTIFICATION_MODAL)).click(); } @@ -124,10 +131,10 @@ export class FacilityApplicationOverviewPage { await this.goToLifetimeRequests(); console.log(`Approve Application${application_name} Extension`); await this.page.locator(Util.by_data_test_id_str(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`); - const approval_response: string = await this.page.innerText(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE)); - expect(approval_response).toContain(this.EXTENSION_SUCCESSFULLY); await this.page.locator(Util.by_data_test_id_str(this.CLOSE_NOTIFICATION_MODAL)).click(); } @@ -137,25 +144,28 @@ export class FacilityApplicationOverviewPage { const project_count: number = await this.page.locator(Util.by_data_test_id_str(this.TERMINATE_PROJECT_BTN)).count(); console.log(`Terminating ${project_count} openstack projects with name ${project_name}`); // eslint-disable-next-line no-plusplus - for (let i = 0; i < project_count; i++) { + while (await this.page.locator(Util.by_data_test_id_str(this.TERMINATE_PROJECT_BTN)).first().isVisible()) { // eslint-disable-next-line no-await-in-loop await this.page.locator(Util.by_data_test_id_str(this.TERMINATE_PROJECT_BTN)).first().click(); // eslint-disable-next-line no-await-in-loop - await this.page.locator(Util.by_data_test_id_str(this.APPROVE_TERMINATION_PT_APPLICATION_BTN)).first().click(); + await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_CONFIRMATION_MODAL_BUTTON)).click(); + // eslint-disable-next-line no-await-in-loop - await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MESSAGE} >> text=${this.WAS_TERMINATED}`); + await this.page.waitForSelector(`data-test-id=${this.NOTIFICATION_MODAL_TITLE} >> text=Success`); + // eslint-disable-next-line no-await-in-loop await this.page.locator(Util.by_data_test_id_str(this.CLOSE_NOTIFICATION_BTN)).click(); } + } async approveApplicationModification(application_name: string): Promise { await this.goToModificationRequests(); await this.page.locator(Util.by_data_test_id_str(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`); - const approval_response: string = await this.page.innerText(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE)); - expect(approval_response).toContain(this.MODIFICATION_EXTENSION_SUCCESS_TEXT); await this.page.locator(Util.by_data_test_id_str(this.CLOSE_NOTIFICATION_MODAL)).click(); } } diff --git a/tests/page_objects/formular.po.ts b/tests/page_objects/formular.po.ts index 388d567fbb..35ea6515cf 100644 --- a/tests/page_objects/formular.po.ts +++ b/tests/page_objects/formular.po.ts @@ -88,7 +88,10 @@ export class FormularPage { await this.page.locator('[role=option]').click(); await this.page.locator(Util.by_data_test_id_str('project_application_horizon_switch')).click(); await this.page.fill(Util.by_data_test_id_str('project_application_horizon2020_input'), 'Horizon2020Project'); + await this.page.fill(Util.by_data_test_id_str('project_application_volume_counter'), '2'); + await this.page.fill(Util.by_data_test_id_str('project_application_volume_limit_input'), '2'); + await this.page.locator(Util.by_data_test_id_str('project_application_report_allowed_switch')).click(); await this.page.locator(Util.by_data_test_id_str('project_application_person_related_data_switch')).click(); await this.page.locator(Util.by_data_test_id_str('project_application_no_personal_data_switch')).click(); diff --git a/tests/page_objects/profile.po.ts b/tests/page_objects/profile.po.ts index f50950dab4..f6fa4e9eab 100644 --- a/tests/page_objects/profile.po.ts +++ b/tests/page_objects/profile.po.ts @@ -62,7 +62,8 @@ export class ProfilePage { await this.page.locator(Util.by_data_test_id_str(this.OPEN_SET_KEY_BUTTON)).click(); console.log('Copying public key into textfield.'); await this.page.fill(Util.by_data_test_id_str(this.ENTER_PUBLIC_KEY_AREA), this.TEST_PUBLIC_KEY); - await this.page.locator(Util.by_data_test_id_str(this.PUBLIC_KEY_ACKNOWLEDGE_CHECKBOX)).click(); + console.log('Confirming effects of generating a new Key'); + // await this.page.locator(Util.by_data_test_id_str(this.GENERATE_KEY_CHECKBOX)).click(); console.log('Clicking on Set-Button'); await Promise.all([ this.page.waitForResponse(response => response.status() === 200), diff --git a/tests/page_objects/project_overview.po.ts b/tests/page_objects/project_overview.po.ts index 9f11b6efb8..a86a0c744b 100644 --- a/tests/page_objects/project_overview.po.ts +++ b/tests/page_objects/project_overview.po.ts @@ -78,7 +78,7 @@ export class ProjectOverViewPage { console.log(`Project ${project_name} should be visible!`); await this.page - .locator(Util.by_data_test_id_str_prefix(`${this.PROJECT_OVERVIEW_BUTTON_PREFIX}${project_name}`)) + .locator(Util.by_data_test_id_str_prefix(`${this.PROJECT_OVERVIEW_BUTTON_PREFIX}${project_name}`)).first() .click(); console.log(this.page.url()); @@ -92,9 +92,9 @@ export class ProjectOverViewPage { simpleVM ? console.log('Filling extension formular and requesting extension for SimpleVM project') : console.log('Filling extension formular and requesting extension for Openstack project'); - await this.page.locator(Util.by_data_test_id_str(this.OPEN_EXTENSION_REQUEST_BUTTON)).click(); - await this.page.locator(Util.by_data_test_id_str(this.CONTINUE_TESTIMONIAL_MODAL_BUTTON)).click(); - await this.page.locator(Util.by_data_test_id_str(this.DECLINE_NEW_PUBLICATION_BUTTON)).click(); + await this.page.locator(Util.by_data_test_id_str(this.OPEN_EXTENSION_REQUEST_BUTTON)).first().click(); + await this.page.locator(Util.by_data_test_id_str(this.CONTINUE_TESTIMONIAL_MODAL_BUTTON)).first().click(); + // await this.page.locator(Util.by_data_test_id_str(this.DECLINE_NEW_PUBLICATION_BUTTON)).first().click(); await this.page.waitForSelector(`data-test-id=${this.PROJECT_EXTENSION_MONTHS_INPUT}`); await this.page.fill(Util.by_data_test_id_str(this.PROJECT_EXTENSION_MONTHS_INPUT), '3'); await this.page.locator(Util.by_data_test_id_str(this.SUBMIT_EXTENSION_REQUEST_BUTTON)).click(); @@ -109,7 +109,7 @@ export class ProjectOverViewPage { simpleVM ? console.log('Filling modification formular and requesting extension for SimpleVM project') : console.log('Filling modification formular and requesting extension for Openstack project'); - await this.page.locator(Util.by_data_test_id_str(this.OPEN_MODIFICATION_REQUEST_BUTTON)).click(); + await this.page.locator(Util.by_data_test_id_str(this.OPEN_MODIFICATION_REQUEST_BUTTON)).first().click(); await this.page.fill(Util.by_data_test_id_str('std_1'), this.NUMBER_MODIFICATION_FLAVORS); await this.page.fill( Util.by_data_test_id_str(this.MODIFICATION_REQUEST_VOLUME_COUNTER_INPUT), @@ -127,7 +127,7 @@ export class ProjectOverViewPage { } async requestTermination() { - await this.page.locator(Util.by_data_test_id_str(this.OPEN_TERMINATION_REQUEST_BUTTON)).click(); + await this.page.locator(Util.by_data_test_id_str(this.OPEN_TERMINATION_REQUEST_BUTTON)).first().click(); await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_TERMINATION_REQUEST_INPUT)).click(); await this.page.locator(Util.by_data_test_id_str(this.CONFIRM_TERMINATION_REQUEST_BUTTON)).click(); await this.page.waitForSelector( diff --git a/tests/page_objects/vo_overview.po.ts b/tests/page_objects/vo_overview.po.ts index f5a939f1b7..508f1f50a2 100644 --- a/tests/page_objects/vo_overview.po.ts +++ b/tests/page_objects/vo_overview.po.ts @@ -12,12 +12,13 @@ export class VoOverviewPage { private NOTIFICATION_MESSAGE: string = 'notification_message'; private CLOSE_NOTIFICATION_BTN: string = 'close_notification_modal_btn'; private PROJECT_TERMINATED_MESSAGE: string = 'The project was terminated.'; - private PROJECT_TERMINATION_FORWARDED_TO_FACILITY: string = 'The request to terminate the project was forwarded to the facility manager.'; + private PROJECT_TERMINATION_FORWARDED_TO_FACILITY: string = 'The request to terminate the project was forwarded to the facility manager.'; private TERMINATE_BUTTON_TEXT: string = 'Terminate Project'; private NOTIFICATION_MODAL_TITLE: string = 'notification_modal_title'; private SUCCESS: string = 'Success'; private SITE_LOADER: string = 'site-loader'; + private SPINNER: string = 'spinner'; readonly page: Page; readonly baseURL: string; @@ -34,6 +35,17 @@ export class VoOverviewPage { expect(this.page.url()).toContain(this.VO_OVERVIEW_URL); await this.page.waitForSelector(Util.by_data_test_id_str(this.SITE_LOADER), { state: 'hidden' }); + + try { + await this.page.waitForSelector(Util.by_data_test_id_str(this.SPINNER), { state: 'visible', timeout: 5000 }); + } catch (error) { + console.log('Spinner not visible within 5 seconds, continuing...'); + } + + await this.page.waitForSelector(Util.by_data_test_id_str(this.SPINNER), { state: 'hidden' }); + + // Add a 3-second wait at the end + await this.page.waitForTimeout(3000); } async filterForProjects(filter: string): Promise { @@ -46,12 +58,12 @@ export class VoOverviewPage { await this.goto(); await this.filterForProjects(project_name); - const project_count: number = await this.page + let project_count: number = await this.page .locator(Util.by_data_test_id_str_prefix(this.SHOW_TERMINATE_PREFIX + Util.OPENSTACK_APPLICATION_NAME)) .count(); console.log(`Terminating ${project_count} openstack projects with name ${project_name}`); // eslint-disable-next-line no-plusplus - for (let i = 0; i < project_count; i++) { + while (project_count > 0) { // eslint-disable-next-line no-await-in-loop await this.page .locator(Util.by_data_test_id_str_prefix(this.SHOW_TERMINATE_PREFIX + Util.OPENSTACK_APPLICATION_NAME)) @@ -64,7 +76,13 @@ export class VoOverviewPage { await expect(this.page.locator(Util.by_data_test_id_str(this.NOTIFICATION_MESSAGE))).toHaveClass(/alert-success/); // eslint-disable-next-line no-await-in-loop await this.page.locator(Util.by_data_test_id_str(this.CLOSE_NOTIFICATION_BTN)).click(); + await this.page.waitForTimeout(1500); + + project_count = await this.page + .locator(Util.by_data_test_id_str_prefix(this.SHOW_TERMINATE_PREFIX + Util.OPENSTACK_APPLICATION_NAME)) + .count(); } + } async terminateSimpleVMProjects(project_name: string): Promise {