|
| 1 | +import { awxAPI } from '../../../../../frontend/awx/common/api/awx-utils'; |
1 | 2 | import { Inventory } from '../../../../../frontend/awx/interfaces/Inventory';
|
2 | 3 | import { Organization } from '../../../../../frontend/awx/interfaces/Organization';
|
3 | 4 | import { AwxUser } from '../../../../../frontend/awx/interfaces/User';
|
| 5 | +import { runCommand } from './runCommandFunction'; |
| 6 | +import { randomString } from '../../../../../framework/utils/random-string'; |
| 7 | + |
4 | 8 | import {
|
5 | 9 | checkHostGroup,
|
6 | 10 | createAndEditAndDeleteHost,
|
7 | 11 | testHostBulkDelete,
|
| 12 | + createHost, |
8 | 13 | } from '../../../../support/hostsfunctions';
|
9 | 14 |
|
10 | 15 | describe('Inventory Host Tab Tests for regular inventory', () => {
|
@@ -80,19 +85,75 @@ describe('Inventory Host Tab Tests for regular inventory', () => {
|
80 | 85 | //5) Cancel the job and assert that it has been canceled
|
81 | 86 | });
|
82 | 87 |
|
83 |
| - it.skip(`can run an ad-hoc command against a host on the inventory hosts tab`, () => { |
| 88 | + it(`can run an ad-hoc command against a host on the inventory hosts tab`, () => { |
84 | 89 | //1) Use the inventory created in before, access the host tab of that inventory
|
85 | 90 | //2) Use a host, EE, and credential - these resources are needed to run a command against a host
|
86 | 91 | //3) Assert redirect to the job output screen
|
87 | 92 | //4) Navigate to the details page of the job and assert the values there match what was entered in the Run Command Wizard
|
88 | 93 | //5) Navigate back to the Inventory -> Jobs Tab to assert that the Run Command job shows up there
|
| 94 | + createHost('inventory_host', inventory.id); |
| 95 | + |
| 96 | + cy.navigateTo('awx', 'inventories'); |
| 97 | + cy.intercept('get', awxAPI`/inventories/?name=${inventory.name}*`).as('getInventories'); |
| 98 | + cy.filterTableByMultiSelect('name', [inventory.name]); |
| 99 | + cy.wait('@getInventories'); |
| 100 | + |
| 101 | + cy.contains('a', inventory.name).click(); |
| 102 | + cy.contains(`a[role="tab"]`, 'Hosts').click(); |
| 103 | + |
| 104 | + cy.getByDataCy('run-command').click(); |
| 105 | + |
| 106 | + runCommand({ |
| 107 | + selections: 'all', |
| 108 | + module: 'shell', |
| 109 | + verbosity: '0-(normal)', |
| 110 | + forks: 2, |
| 111 | + show_changes: true, |
| 112 | + become_enabled: true, |
| 113 | + organization, |
| 114 | + }); |
89 | 115 | });
|
90 | 116 |
|
91 |
| - it.skip('can run an ad-hoc command against the host on the groups tab of a host-inventory from the host details page', () => { |
| 117 | + it('can run an ad-hoc command against the host on the groups tab of a host-inventory from the host details page', () => { |
92 | 118 | //1) Use the inventory created in before, access the host tab of that inventory, visit the host details page
|
93 | 119 | //2) Use a host, EE, and credential - these resources are needed to run a command against a host
|
94 | 120 | //3) Assert redirect to the job output screen
|
95 | 121 | //4) Navigate to the details page of the job and assert the values there match what was entered in the Run Command Wizard
|
96 | 122 | //5) Navigate back to the Inventory -> Jobs Tab to assert that the Run Command job shows up there
|
| 123 | + |
| 124 | + createHost('inventory_host', inventory.id); |
| 125 | + const groupName = 'E2E group ' + randomString(4); |
| 126 | + cy.createInventoryGroup(inventory, groupName); |
| 127 | + cy.log(`inv: ${inventory.name}, group: ${groupName}`); |
| 128 | + |
| 129 | + cy.navigateTo('awx', 'inventories'); |
| 130 | + |
| 131 | + cy.intercept('get', awxAPI`/inventories/?name=${inventory.name}*`).as('getInventories'); |
| 132 | + cy.filterTableByMultiSelect('name', [inventory.name]); |
| 133 | + cy.wait('@getInventories'); |
| 134 | + |
| 135 | + cy.contains('a', inventory.name).click(); |
| 136 | + |
| 137 | + cy.contains(`a[role="tab"]`, 'Groups').click(); |
| 138 | + cy.reload(); |
| 139 | + cy.contains('a', groupName).click(); |
| 140 | + |
| 141 | + cy.contains(`a[role="tab"]`, 'Hosts').click(); |
| 142 | + // add existing host |
| 143 | + cy.getByDataCy('add-existing-host').click(); |
| 144 | + cy.getByDataCy('select-all').click(); |
| 145 | + cy.clickModalButton('Add hosts'); |
| 146 | + |
| 147 | + cy.getByDataCy('run-command').click(); |
| 148 | + |
| 149 | + runCommand({ |
| 150 | + selections: 'all', |
| 151 | + module: 'shell', |
| 152 | + verbosity: '0-(normal)', |
| 153 | + forks: 2, |
| 154 | + show_changes: true, |
| 155 | + become_enabled: true, |
| 156 | + organization, |
| 157 | + }); |
97 | 158 | });
|
98 | 159 | });
|
0 commit comments