From a4c8c0b78bf13352b96fdcdc44ce153b64bd71d9 Mon Sep 17 00:00:00 2001 From: Carla Martinez Date: Wed, 12 Feb 2025 14:24:28 +0100 Subject: [PATCH] Fix issues on tests and components 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 --- .../AutoMemUserRules/AutoMemUserRules.tsx | 29 ----------- tests/features/hostgroup_members.feature | 50 +++++++++++++------ 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/pages/AutoMemUserRules/AutoMemUserRules.tsx b/src/pages/AutoMemUserRules/AutoMemUserRules.tsx index d5305688..c3700e31 100644 --- a/src/pages/AutoMemUserRules/AutoMemUserRules.tsx +++ b/src/pages/AutoMemUserRules/AutoMemUserRules.tsx @@ -675,35 +675,6 @@ const AutoMemUserRules = () => { messageText="Are you sure you want to change default group?" messageObj={defaultGroup} /> - - { - onSelectDefaultGroup(defaultGroup); - }} - > - OK - , - - Cancel - , - ]} - messageText="Are you sure you want to change default group?" - messageObj={defaultGroup} - /> ); }; diff --git a/tests/features/hostgroup_members.feature b/tests/features/hostgroup_members.feature index 8b6a9d53..c11267bc 100644 --- a/tests/features/hostgroup_members.feature +++ b/tests/features/hostgroup_members.feature @@ -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 @@ -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" @@ -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" @@ -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 @@ -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