diff --git a/cypress/e2e/awx/infrastructure/hosts/hosts.cy.ts b/cypress/e2e/awx/infrastructure/hosts/hosts.cy.ts index 62999c14f3..ccde2fa40a 100644 --- a/cypress/e2e/awx/infrastructure/hosts/hosts.cy.ts +++ b/cypress/e2e/awx/infrastructure/hosts/hosts.cy.ts @@ -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; @@ -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); @@ -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); diff --git a/cypress/e2e/awx/inventories/inventories.cy.ts b/cypress/e2e/awx/inventories/inventories.cy.ts index 10f5baa14a..beb458d8f7 100644 --- a/cypress/e2e/awx/inventories/inventories.cy.ts +++ b/cypress/e2e/awx/inventories/inventories.cy.ts @@ -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); diff --git a/cypress/e2e/awx/inventory-host/inventoryHostRegular.cy.ts b/cypress/e2e/awx/inventory-host/inventoryHostRegular.cy.ts index 694feaf988..40ac0a5d4e 100644 --- a/cypress/e2e/awx/inventory-host/inventoryHostRegular.cy.ts +++ b/cypress/e2e/awx/inventory-host/inventoryHostRegular.cy.ts @@ -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); diff --git a/cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts b/cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts index e660a3e8e3..3ef5269611 100644 --- a/cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts +++ b/cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts @@ -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) { diff --git a/cypress/support/hostsfunctions.ts b/cypress/support/hostsfunctions.ts index 12d0ef9f94..e4d1f42eac 100644 --- a/cypress/support/hostsfunctions.ts +++ b/cypress/support/hostsfunctions.ts @@ -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