Skip to content

Commit

Permalink
removed unused tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jul 2, 2024
1 parent e85e148 commit ffe0ad8
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 33 deletions.
29 changes: 16 additions & 13 deletions tests/page_objects/application_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Expand Down Expand Up @@ -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<any> {
Expand All @@ -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<any> {
Expand All @@ -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<any> {
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<any> {
Expand All @@ -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<any> {
Expand All @@ -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);
Expand Down
30 changes: 20 additions & 10 deletions tests/page_objects/facility_application_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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',
});
Expand Down Expand Up @@ -112,22 +117,24 @@ export class FacilityApplicationOverviewPage {

async approveApplication(application_name: string): Promise<any> {
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();
}

async approveApplicationExtension(application_name: string): Promise<any> {
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();
}

Expand All @@ -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<any> {
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();
}
}
3 changes: 3 additions & 0 deletions tests/page_objects/formular.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion tests/page_objects/profile.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 6 additions & 6 deletions tests/page_objects/project_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
Expand All @@ -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),
Expand All @@ -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(
Expand Down
24 changes: 21 additions & 3 deletions tests/page_objects/vo_overview.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<any> {
Expand All @@ -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))
Expand All @@ -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<any> {
Expand Down

0 comments on commit ffe0ad8

Please sign in to comment.