Skip to content

Commit

Permalink
Select Dialog Fixes (#3034)
Browse files Browse the repository at this point in the history
Signed-off-by: James Talton <[email protected]>
  • Loading branch information
jamestalton authored and ZitaNemeckova committed Aug 22, 2024
1 parent 6647532 commit f96da67
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 66 deletions.
24 changes: 4 additions & 20 deletions cypress/e2e/awx/infrastructure/hosts/hosts.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { randomString } from '../../../../../framework/utils/random-string';
import { Inventory } from '../../../../../frontend/awx/interfaces/Inventory';
import { Organization } from '../../../../../frontend/awx/interfaces/Organization';
import { Project } from '../../../../../frontend/awx/interfaces/Project';
import { randomString } from '../../../../../framework/utils/random-string';
import { awxAPI } from '../../../../support/formatApiPathForAwx';
import {
checkHostGroup,
createHostAndCancelJob,
launchHostJob,
} from '../../../../support/hostsfunctions';
import { awxAPI } from '../../../../support/formatApiPathForAwx';

describe('Host Tests', () => {
let organization: Organization;
Expand Down Expand Up @@ -39,15 +39,7 @@ describe('Host Tests', () => {
cy.verifyPageTitle('Create Host');
cy.getByDataCy('name').type(hostName);
cy.getByDataCy('description').type('This is the description');
cy.getByDataCy('inventory').click();
cy.contains('button', 'Browse').click();
cy.intercept('GET', awxAPI`/inventories/?*`).as('inventories');
cy.getModal().within(() => {
cy.filterTableBySingleSelect('name', inventory.name);
cy.wait('@inventories');
cy.get(`[data-cy="checkbox-column-cell"] input`).click();
cy.contains('button', 'Confirm').click();
});
cy.singleSelectByDataCy('inventory', inventory.name);
cy.getByDataCy('variables').type('test: true');
cy.clickButton(/^Create host/);
cy.hasDetail(/^Name$/, hostName);
Expand Down Expand Up @@ -93,15 +85,7 @@ describe('Host Tests', () => {
cy.verifyPageTitle('Create Host');
cy.getByDataCy('name').type(hostName);
cy.getByDataCy('description').type('This is the description');
cy.getByDataCy('inventory').click();
cy.contains('button', 'Browse').click();
cy.intercept('GET', awxAPI`/inventories/?*`).as('inventories');
cy.getModal().within(() => {
cy.filterTableBySingleSelect('name', inventory.name);
cy.wait('@inventories');
cy.get(`[data-cy="checkbox-column-cell"] input`).click();
cy.contains('button', 'Confirm').click();
});
cy.singleSelectByDataCy('inventory', inventory.name);
cy.getByDataCy('variables').type('test: true');
cy.clickButton(/^Create host/);
cy.hasDetail(/^Name$/, hostName);
Expand Down
15 changes: 1 addition & 14 deletions cypress/e2e/awx/inventories/inventories.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,7 @@ describe('Inventories Tests', () => {
cy.getByDataCy('create-smart-inventory').click();
cy.getByDataCy('name').type(name);
cy.getByDataCy('description').type('description');
cy.getByDataCy('organization').click();
cy.contains('button', 'Browse').click();
cy.get(`[role="dialog"]`).within(() => {
cy.get(`[aria-label="Simple table"] tr`);
cy.contains('button', 'Cancel');
cy.contains('button', 'Confirm');
cy.get('#filter');
});
cy.get(`[role="dialog"]`).within(() => {
cy.filterTableByMultiSelect('name', [org.name]);
cy.get(`[aria-label="Simple table"] tr`).should('have.length', 2);
cy.get(`input[type="radio"]`).click();
cy.contains('button', 'Confirm').click();
});
cy.singleSelectByDataCy('organization', org.name);
cy.getByDataCy('host-filter').type('name=host1');
cy.getByDataCy('Submit').click();
cy.getByDataCy('name').should('have.text', name);
Expand Down
8 changes: 1 addition & 7 deletions cypress/e2e/awx/inventory-host/inventoryHostRegular.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ describe('Inventory Host Tab Tests for regular inventory', () => {
cy.verifyPageTitle('Create Host');
cy.getByDataCy('name').type(hostName);
cy.getByDataCy('description').type('This is the description');
cy.getByDataCy('inventory').click();
cy.contains('button', 'Browse').click();
cy.getModal().within(() => {
cy.filterTableBySingleSelect('name', inventory.name);
cy.get(`[data-cy="checkbox-column-cell"] input`).click();
cy.contains('button', 'Confirm').click();
});
cy.singleSelectByDataCy('inventory', inventory.name);
cy.getByDataCy('variables').type('test: true');
cy.clickButton(/^Create host/);
cy.hasDetail(/^Name$/, hostName);
Expand Down
19 changes: 1 addition & 18 deletions cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,7 @@ export function testDelete(name: string, options?: { details?: boolean }) {
}

export function selectOrganization(orgName: string) {
cy.get(`[data-cy="organization"]`).click();
cy.contains('button', 'Browse').click();

// sync dialog
cy.intercept('GET', awxAPI`/organizations/*`).as('orgList');
cy.get(`[role="dialog"]`).within(() => {
cy.contains('button', 'Confirm');
cy.contains('button', 'Cancel');
cy.wait('@orgList');
cy.get(`[aria-label="Simple table"]`);
});

cy.filterTableByMultiSelect('name', [orgName]);
cy.get(`[aria-label="Simple table"] tr`).should('have.length', 2);

cy.contains(`[aria-label="Simple table"]`, orgName);
cy.get(`[aria-label="Select row 0"]`).click();
cy.contains('button', 'Confirm').click();
cy.singleSelectByDataCy('organization', orgName);
}

function fillBasicData(notificationName: string, type: string) {
Expand Down
8 changes: 1 addition & 7 deletions cypress/support/hostsfunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ export function createAndCheckHost(host_type: string, inventory: string) {
cy.getByDataCy('description').type('This is the description');

if (host_type === 'stand_alone_host') {
cy.getByDataCy('inventory').click();
cy.contains('button', 'Browse').click();
cy.getModal().within(() => {
cy.filterTableBySingleSelect('name', inventory);
cy.get(`[data-cy="checkbox-column-cell"] input`).click();
cy.contains('button', 'Confirm').click();
});
cy.singleSelectByDataCy('inventory', inventory);
}

// after creation - verify data is currect
Expand Down

0 comments on commit f96da67

Please sign in to comment.