Skip to content

Commit

Permalink
Container profile edit
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Mar 6, 2025
1 parent 97cbd03 commit 022f0a9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 10 deletions.
21 changes: 11 additions & 10 deletions staff_features/container_profiles/container_profile_edit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ Feature: Container Profile Edit
And a Container Profile has been created
Scenario: Container Profile is opened in the edit mode from the browse menu
Given the Container Profile appears in the search results list
When the user clicks on 'Edit'
Then the Container Profile is opened in the edit mode
When the user clicks on 'Edit'
Then the Container Profile is opened in the edit mode
Scenario: Container Profile is opened in the edit mode from the view mode
Given the Container Profile is opened in the view mode
When the user clicks on 'Edit'
Then the Container Profile is opened in the edit mode
When the user clicks on 'Edit'
Then the Container Profile is opened in the edit mode
Scenario Outline: Container Profile is successfully updated
Given the Container Profile is opened in edit mode
When the user changes the '<Field>' field to '<NewValue>'
Given the Container Profile is opened in the view mode
When the user clicks on 'Edit'
And the user changes the '<Field>' field to '<NewValue>'
And the user clicks on 'Save'
And the user clicks on 'Edit'
Then the field '<Field>' has value '<NewValue>'
Examples:
| Field | NewValue |
| Name | Updated Test Container Profile |
| Width | 10 |
| Field | NewValue |
| Width | 10 |
Scenario: Container Profile is not updated after changes are reverted
Given the Container Profile is opened in edit mode
When the user changes the 'Name' field
Expand All @@ -30,4 +31,4 @@ Feature: Container Profile Edit
And the user clicks on 'Save'
Then the following error message is displayed
| Name - Property is required but was missing |
And the Container Profile Name field has the original value
And the Container Profile Name field has the original value
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# frozen_string_literal: true

Given 'a Container Profile has been created' do
visit "#{STAFF_URL}/container_profiles/new"

fill_in 'container_profile_name_', with: "Container Profile #{@uuid}"
fill_in 'container_profile_depth_', with: '1.1'
fill_in 'container_profile_height_', with: '2.2'
fill_in 'container_profile_width_', with: '3.3'

click_on 'Save'
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Container Profile Created'

@container_profile_id = current_url.split('/').pop
end

Given 'the Container Profile appears in the search results list' do
visit "#{STAFF_URL}/container_profiles"

fill_in 'filter-text', with: @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 Container Profile is opened in the edit mode' do
url_parts = current_url.split('/')
action = url_parts.pop
container_profile_id = url_parts.pop

expect(action).to eq 'edit'
expect(container_profile_id).to eq @container_profile_id
end

Given 'the Container Profile is opened in the view mode' do
visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}"
end

Given 'the Container Profile is opened in edit mode' do
visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}/edit"
end

Then 'the Container Profile Name field has the original value' do
visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}/edit"

expect(page).to have_field('Name', with: "Container Profile #{@uuid}")
end

0 comments on commit 022f0a9

Please sign in to comment.