From fe3f6aac87ae35c7137fcb5d33a182ca2034b69e Mon Sep 17 00:00:00 2001 From: dinadi Date: Tue, 28 Jan 2025 15:50:26 +0200 Subject: [PATCH 1/2] Agent edit --- staff_features/agents/agent_edit.feature | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 staff_features/agents/agent_edit.feature diff --git a/staff_features/agents/agent_edit.feature b/staff_features/agents/agent_edit.feature new file mode 100644 index 00000000..7d1557f3 --- /dev/null +++ b/staff_features/agents/agent_edit.feature @@ -0,0 +1,26 @@ +Feature: Agent Edit + Background: + Given an administrator user is logged in + And an Agent has been created + Scenario: Agent is opened in the edit mode from the browse menu + Given the Agent appears in the search results list + When the user clicks on 'Edit' + Then the Agent is opened in the edit mode + Scenario: Agent is opened in the edit mode from the view mode + Given the Agent is opened in the view mode + When the user clicks on 'Edit' + Then the Agent is opened in the edit mode + Scenario Outline: Agent is successfully updated + Given the Agent is opened in edit mode + When the user changes the '' field to '' + And the user clicks on 'Save' + Then the 'Agent' saved message is displayed + And the field '' has value '' + Examples: + | Field | NewValue | + | Authority ID | Test | + Scenario: Agent is not updated after changes are reverted + Given the Agent is opened in edit mode + When the user changes the 'Authority ID' field + And the user clicks on 'Revert Changes' + Then the Authority ID has the original value From f2cb6cc79f68ef5e5809e7286b28474bf6b38747 Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Thu, 6 Feb 2025 09:47:59 +0200 Subject: [PATCH 2/2] Agent Edit --- staff_features/agents/agent_edit.feature | 10 ++-- .../agents/step_definitions/agent_edit.rb | 51 +++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 staff_features/agents/step_definitions/agent_edit.rb diff --git a/staff_features/agents/agent_edit.feature b/staff_features/agents/agent_edit.feature index 7d1557f3..debe2463 100644 --- a/staff_features/agents/agent_edit.feature +++ b/staff_features/agents/agent_edit.feature @@ -16,11 +16,11 @@ Feature: Agent Edit And the user clicks on 'Save' Then the 'Agent' saved message is displayed And the field '' has value '' - Examples: - | Field | NewValue | - | Authority ID | Test | + Examples: + | Field | NewValue | + | Prefix | Test | Scenario: Agent is not updated after changes are reverted Given the Agent is opened in edit mode - When the user changes the 'Authority ID' field + When the user fills in 'Primary Part of Name' with 'New Agent Name' And the user clicks on 'Revert Changes' - Then the Authority ID has the original value + Then the Primary Part of Name has the original value diff --git a/staff_features/agents/step_definitions/agent_edit.rb b/staff_features/agents/step_definitions/agent_edit.rb new file mode 100644 index 00000000..5d0fa355 --- /dev/null +++ b/staff_features/agents/step_definitions/agent_edit.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +Given 'an Agent has been created' do + visit "#{STAFF_URL}/agents/agent_person/new" + + fill_in 'Primary Part of Name', with: "Agent #{@uuid}" + select 'Local sources', from: 'Source' + click_on 'Save' + + expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Agent Created' + url_parts = current_url.split('agents/agent_person').pop.split('/') + url_parts.pop + @agent_id = url_parts.pop +end + +Given 'the Agent appears in the search results list' do + visit "#{STAFF_URL}/agents" + + fill_in 'filter-text', with: "Agent #{@uuid}" + + within '.search-filter' do + find('button').click + end + + search_result_rows = all('#tabledSearchResults tbody tr') + expect(search_result_rows.length).to eq 1 +end + +Then 'the Agent is opened in the edit mode' do + uri = current_url.split('/') + + action = uri.pop + agent_id = uri.pop + + expect(action).to eq 'edit' + expect(agent_id).to eq @agent_id +end + +Given 'the Agent is opened in edit mode' do + visit "#{STAFF_URL}/agents/agent_person/#{@agent_id}/edit" +end + +Given 'the Agent is opened in the view mode' do + visit "#{STAFF_URL}/agents/agent_person/#{@agent_id}" +end + +Then 'the Primary Part of Name has the original value' do + visit "#{STAFF_URL}/agents/agent_person/#{@agent_id}/edit" + + expect(page).to have_field('Primary Part of Name', with: "Agent #{@uuid}") +end