From 69df84797a75d6aa2cb03cbe23961c53ab344420 Mon Sep 17 00:00:00 2001 From: dinadi Date: Fri, 7 Feb 2025 11:22:28 +0200 Subject: [PATCH 1/2] Agent export --- staff_features/agents/agent_export.feature | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 staff_features/agents/agent_export.feature diff --git a/staff_features/agents/agent_export.feature b/staff_features/agents/agent_export.feature new file mode 100644 index 00000000..ba8b02d8 --- /dev/null +++ b/staff_features/agents/agent_export.feature @@ -0,0 +1,11 @@ +Feature: Agent Export + Background: + Given an administrator user is logged in + And an Agent has been created + And the Agent is opened in edit mode + Scenario: Agent Download EAC-CPF + When the user clicks on 'Download EAC-CPF' + Then an XML file is downloaded + Scenario: Agent Download MARCXML AUTHORITY + When the user clicks on 'Download MARCXML AUTHORITY' + Then an XML file is downloaded From cef8d93b9121e2492af5dcdcad6919aab7949ae7 Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Tue, 11 Feb 2025 14:16:26 +0200 Subject: [PATCH 2/2] Agent export --- staff_features/agents/agent_export.feature | 6 +-- .../agents/step_definitions/agent_export.rb | 38 +++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 staff_features/agents/step_definitions/agent_export.rb diff --git a/staff_features/agents/agent_export.feature b/staff_features/agents/agent_export.feature index ba8b02d8..784bdbb5 100644 --- a/staff_features/agents/agent_export.feature +++ b/staff_features/agents/agent_export.feature @@ -5,7 +5,7 @@ Feature: Agent Export And the Agent is opened in edit mode Scenario: Agent Download EAC-CPF When the user clicks on 'Download EAC-CPF' - Then an XML file is downloaded + Then an EAC-CPF XML file is downloaded Scenario: Agent Download MARCXML AUTHORITY - When the user clicks on 'Download MARCXML AUTHORITY' - Then an XML file is downloaded + When the user clicks on 'Download MARCXML Authority' + Then a MARC XML file is downloaded diff --git a/staff_features/agents/step_definitions/agent_export.rb b/staff_features/agents/step_definitions/agent_export.rb new file mode 100644 index 00000000..0be30d30 --- /dev/null +++ b/staff_features/agents/step_definitions/agent_export.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +Then 'an EAC-CPF XML file is downloaded' do + files = Dir.glob(File.join(Dir.tmpdir, '*.xml')) + + first_part_of_uuid = @uuid.split('-').pop + + downloaded_file = nil + files.each do |file| + downloaded_file = file if file.include?('__eac.xml') && + file.include?(first_part_of_uuid) + end + + expect(downloaded_file).to_not eq nil + + load_file = File.read(downloaded_file) + expect(load_file).to include 'person' + expect(load_file).to include "Agent #{@uuid}" +end + +Then 'a MARC XML file is downloaded' do + files = Dir.glob(File.join(Dir.tmpdir, '*.xml')) + + first_part_of_uuid = @uuid.split('-').pop + + downloaded_file = nil + files.each do |file| + downloaded_file = file if file.include?('__marc.xml') && + file.include?(first_part_of_uuid) + end + + expect(downloaded_file).to_not eq nil + + load_file = File.read(downloaded_file) + expect(load_file).to include 'Agent #{@uuid}" +end