Skip to content

Commit

Permalink
Fix issues on tests and components
Browse files Browse the repository at this point in the history
The `hostgroup_members.feature` test needs to use
an already-created host group to perform the
checks on operations.

Also, there are some duplicated components in
the `AutoMemUserRules` component (most likely
due to a rebase) that need to be corrected.

Signed-off-by: Carla Martinez <[email protected]>
  • Loading branch information
carma12 committed Feb 12, 2025
1 parent 4bde204 commit a4c8c0b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 44 deletions.
29 changes: 0 additions & 29 deletions src/pages/AutoMemUserRules/AutoMemUserRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -675,35 +675,6 @@ const AutoMemUserRules = () => {
messageText="Are you sure you want to change default group?"
messageObj={defaultGroup}
/>
<DeleteRule
show={showDeleteModal}
handleModalToggle={onToggleDeleteModal}
onRefresh={refreshData}
buttonsData={deleteButtonsData}
selectedData={selectedData}
ruleType="group"
/>
<ConfirmationModal
title="Default user group"
isOpen={showChangeConfirmationModal}
onClose={onCloseConfirmationModal}
actions={[
<Button
variant="primary"
key="change-default"
onClick={() => {
onSelectDefaultGroup(defaultGroup);
}}
>
OK
</Button>,
<SecondaryButton key="cancel" onClickHandler={onCancelDefaultGroup}>
Cancel
</SecondaryButton>,
]}
messageText="Are you sure you want to change default group?"
messageObj={defaultGroup}
/>
</Page>
);
};
Expand Down
50 changes: 35 additions & 15 deletions tests/features/hostgroup_members.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,29 @@ Feature: Hostgroup members
* I should see "success" alert with text "New host group added"
Then I should see "testgroup" entry in the data table

Scenario: Add another host group to work with
When I click on "Add" button
* I type in the field "Group name" text "main-host-group"
When in the modal dialog I click on "Add" button
* I should see "success" alert with text "New host group added"
Then I should see "main-host-group" entry in the data table

#
# Test "Host" members
#
Scenario: Add a Host member into the host group
Given I click on "ipaservers" entry in the data table
Given I click on "main-host-group" entry in the data table
Given I click on "Members" page tab
Given I am on "ipaservers" group > Members > "Hosts" section
Then I should see the "host" tab count is "1"
Given I am on "main-host-group" group > Members > "Hosts" section
Then I should see the "host" tab count is "0"
When I click on "Add" button located in the toolbar
Then I should see the dialog with title "Assign hosts to host group: ipaservers"
Then I should see the dialog with title "Assign hosts to host group: main-host-group"
When I move user "myhost.dom-server.ipa.demo" from the available list and move it to the chosen options
And in the modal dialog I click on "Add" button
* I should see "success" alert with text "Assigned new hosts to host group 'ipaservers'"
* I should see "success" alert with text "Assigned new hosts to host group 'main-host-group'"
* I close the alert
Then I should see the element "myhost.dom-server.ipa.demo" in the table
Then I should see the "host" tab count is "2"
Then I should see the "host" tab count is "1"

Scenario: Search for a host
When I type "myhost" in the search field
Expand All @@ -58,31 +65,31 @@ Feature: Hostgroup members
When I click on the "indirect" button
Then I should see the "host" tab count is "0"
When I click on the "direct" button
Then I should see the "host" tab count is "2"
Then I should see the "host" tab count is "1"

Scenario: Remove Host from the host group
When I select entry "myhost.dom-server.ipa.demo" in the data table
And I click on "Delete" button located in the toolbar
Then I should see the dialog with title "Delete hosts from host group: ipaservers"
Then I should see the dialog with title "Delete hosts from host group: main-host-group"
And the "myhost.dom-server.ipa.demo" element should be in the dialog table
When in the modal dialog I click on "Delete" button
Then I should see "success" alert with text "Removed hosts from host group 'ipaservers'"
Then I should see "success" alert with text "Removed hosts from host group 'main-host-group'"
* I close the alert
And I should not see "myhost.dom-server.ipa.demo" entry in the data table
Then I should see the "host" tab count is "1"
Then I should see the "host" tab count is "0"

#
# Test "HostGroup" members
#
Scenario: Add a Host group member into the host group
Given I click on "Host groups" page tab
Given I am on "ipaservers" group > Members > "Host groups" section
Given I am on "main-host-group" group > Members > "Host groups" section
Then I should see the "hostgroup" tab count is "0"
When I click on "Add" button located in the toolbar
Then I should see the dialog with title "Assign host groups to host group: ipaservers"
Then I should see the dialog with title "Assign host groups to host group: main-host-group"
When I move user "testgroup" from the available list and move it to the chosen options
And in the modal dialog I click on "Add" button
* I should see "success" alert with text "Assigned new host groups to host group 'ipaservers'"
* I should see "success" alert with text "Assigned new host groups to host group 'main-host-group'"
* I close the alert
Then I should see the element "testgroup" in the table
Then I should see the "hostgroup" tab count is "1"
Expand Down Expand Up @@ -110,10 +117,10 @@ Feature: Hostgroup members
Scenario: Remove Host group from the host group
When I select entry "testgroup" in the data table
And I click on "Delete" button located in the toolbar
Then I should see the dialog with title "Delete host groups from host group: ipaservers"
Then I should see the dialog with title "Delete host groups from host group: main-host-group"
And the "testgroup" element should be in the dialog table
When in the modal dialog I click on "Delete" button
Then I should see "success" alert with text "Removed host groups from host group 'ipaservers'"
Then I should see "success" alert with text "Removed host groups from host group 'main-host-group'"
* I close the alert
And I should not see "testgroup" entry in the data table
Then I should see the "hostgroup" tab count is "0"
Expand All @@ -129,6 +136,7 @@ Feature: Hostgroup members
* I should see partial "myhost.dom-server.ipa.demo" entry in the data table
When in the modal dialog I click on "Delete" button
* I should see "success" alert with text "Hosts removed"
* I close the alert
Then I should not see "myhost.dom-server.ipa.demo" entry in the data table

Scenario: Cleanup - delete the test host group
Expand All @@ -139,4 +147,16 @@ Feature: Hostgroup members
* I should see "testgroup" entry in the data table
When in the modal dialog I click on "Delete" button
* I should see "success" alert with text "Host groups removed"
* I close the alert
Then I should not see "testgroup" entry in the data table

Scenario: Cleanup - delete the 'main-host-group' host group
Given I should see "main-host-group" entry in the data table
Then I select entry "main-host-group" in the data table
When I click on "Delete" button
* I see "Remove host groups" modal
* I should see "main-host-group" entry in the data table
When in the modal dialog I click on "Delete" button
* I should see "success" alert with text "Host groups removed"
* I close the alert
Then I should not see "main-host-group" entry in the data table

0 comments on commit a4c8c0b

Please sign in to comment.