Skip to content

Commit

Permalink
Agent create
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Feb 1, 2025
1 parent 86d2525 commit 7709ca9
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 49 deletions.
95 changes: 47 additions & 48 deletions staff_features/agents/agent_create.feature
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
Feature: Agent Create
Background:
Given an administrator user is logged in
And the user is on Agents page
And the user clicks on 'Create Agent'
Scenario: Agent type Person is created
When the user clicks on 'Person' in the dropdown menu
And the user fills in 'Primary Part of Name' with 'Person Agent' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the user is on the agent_person edit page
Scenario: Agent type Person is not created because required fields are missing
When the user clicks on 'Person' in the dropdown menu
And the user clicks on 'Save'
Then the following error messages are displayed
| Primary Part of Name - Property is required but was missing |
Scenario: Agent type Family is created
When the user clicks on 'Family' in the dropdown menu
And the user fills in 'Family Name' with 'Family Agent' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the user is on the agent_family edit page
Scenario: Agent type Family is not created because required fields are missing
When the user clicks on 'Family' in the dropdown menu
And the user clicks on 'Save'
Then the following error messages are displayed
| Family Name - Property is required but was missing |
Scenario: Agent type Corporate Entity is created
When the user clicks on 'Corporate Entity' in the dropdown menu
And the user fills in 'Primary Part of Name' with 'Corporate Agent' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the user is on the agent_corporate_entity edit page
Scenario: Agent type Corporate Entity is not created because required fields are missing
When the user clicks on 'Corporate Entity' in the dropdown menu
And the user clicks on 'Save'
Then the following error messages are displayed
| Primary Part of Name - Property is required but was missing |
Scenario: Agent type Software is created
When the user clicks on 'Software' in the dropdown menu
And the user fills in 'Software Name' with 'Software Agent' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the user is on the agent_software edit page
Scenario: Agent type Software is not created because required fields are missing
When the user clicks on 'Software' in the dropdown menu
And the user clicks on 'Save'
Then the following error messages are displayed
| Software Name - Property is required but was missing |

Given an administrator user is logged in
And the user clicks on 'Create'
And the user hovers on 'Agent' in the dropdown menu
Scenario: Agent Person is created
When the user clicks on 'Person'
And the user fills in 'Primary Part of Name' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the 'Primary Part of Name' has a unique value
Scenario: Agent Person is not created because required fields are missing
When the user clicks on 'Person'
And the user clicks on 'Save'
Then the following error messages are displayed
| Primary Part of Name - Property is required but was missing |
Scenario: Agent Family is created
When the user clicks on 'Family'
And the user fills in 'Family Name' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the 'Family Name' has a unique value
Scenario: Agent Family is not created because required fields are missing
When the user clicks on 'Family'
And the user clicks on 'Save'
Then the following error messages are displayed
| Family Name - Property is required but was missing |
Scenario: Agent Corporate Entity is created
When the user clicks on 'Corporate Entity'
And the user fills in 'Primary Part of Name' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the 'Primary Part of Name' has a unique value
Scenario: Agent Corporate Entity is not created because required fields are missing
When the user clicks on 'Corporate Entity'
And the user clicks on 'Save'
Then the following error messages are displayed
| Primary Part of Name - Property is required but was missing |
Scenario: Agent Software is created
When the user clicks on 'Software'
And the user fills in 'Software Name' in the 'Name Forms' form
And the user clicks on 'Save'
Then the 'Agent' created message is displayed
And the 'Software Name' has a unique value
Scenario: Agent Software is not created because required fields are missing
When the user clicks on 'Software'
And the user clicks on 'Save'
Then the following error messages are displayed
| Software Name - Property is required but was missing |
17 changes: 17 additions & 0 deletions staff_features/agents/step_definitions/agent_create.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

Then 'the Agent form has the following values' do |form_values_table|
form_values = form_values_table.hashes

form_values.each do |row|
section_title = find('h3', text: row['form_section'])
section = section_title.ancestor('section', match: :first)
expect(section[:id]).to_not eq nil

within section do
field = find_field(row['form_field'])

expect(field.value.downcase).to eq row['form_value'].downcase
end
end
end
20 changes: 19 additions & 1 deletion staff_features/shared/step_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
end
end

When 'the user hovers on {string} in the dropdown menu' do |string|
within '.dropdown-menu' do
element = find(:xpath, "//button[contains(text(), '#{string}')] | //a[contains(text(), '#{string}')]")

element.hover
end
end

When 'the user clicks on {string} in the transfer form' do |string|
dropdown_menu = find('.transfer-form')

Expand Down Expand Up @@ -161,14 +169,24 @@

When 'the user fills in {string} with {string} in the {string} form' do |label, value, form_title|
section_title = find('h3', text: form_title)
section = section_title.ancestor('section')
section = section_title.ancestor('section', match: :first)
expect(section[:id]).to_not eq nil

within section do
fill_in label, with: value
end
end

When 'the user fills in {string} in the {string} form' do |label, form_title|
section_title = find('h3', text: form_title)
section = section_title.ancestor('section', match: :first)
expect(section[:id]).to_not eq nil

within section do
fill_in label, with: @uuid
end
end

When 'the user fills in {string} with {string} and selects {string} in the {string} form' do |label, value, selected_value, form_title|
section_title = find('h3', text: form_title)
section = section_title.ancestor('section')
Expand Down

0 comments on commit 7709ca9

Please sign in to comment.