Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 460745d

Browse files
Repository edit
1 parent 35212b8 commit 460745d

File tree

3 files changed

+58
-14
lines changed

3 files changed

+58
-14
lines changed

staff_features/repositories/repository_edit.feature

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,11 @@ Feature: Repository Edit
55
Scenario: Repository is opened in the edit mode from the browse menu
66
Given the Repository appears in the search results list
77
When the user clicks on 'Edit'
8-
Then the Repository is opened in the edit mode
8+
Then the Repository is opened in edit mode
99
Scenario: Repository is opened in the edit mode from the view mode
1010
Given the Repository is opened in the view mode
1111
When the user clicks on 'Edit'
12-
Then the Repository is opened in the edit mode
13-
Scenario Outline:Repository is successfully updated
14-
Given the Repository is opened in the edit mode
15-
When the user changes the '<Field>' field to '<NewValue>'
16-
And the user clicks on 'Save Repository'
17-
Then the 'Repository' saved message is displayed
18-
And the field '<Field>' has value '<NewValue>'
19-
Examples:
20-
| Field | NewValue |
21-
| Repository Short Name | Test Short Name |
22-
| Description | Test Description |
12+
Then the Repository is opened in edit mode
2313
Scenario: Repository is not updated after changes are canceled
2414
Given the Repository is opened in edit mode
2515
When the user changes the 'Short Name' field
@@ -31,4 +21,4 @@ Feature: Repository Edit
3121
And the user clicks on 'Save Repository'
3222
Then the following error messages are displayed
3323
| Repository Short Name - Property is required but was missing |
34-
Then the Repository Short Name field has the original value
24+
Then the Repository Short Name field has the original value
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# frozen_string_literal: true
2+
3+
Given 'the Repository appears in the search results list' do
4+
visit "#{STAFF_URL}/repositories"
5+
6+
fill_in 'filter-text', with: @uuid
7+
8+
within '.search-filter' do
9+
find('button').click
10+
end
11+
12+
search_result_rows = all('#tabledSearchResults tbody tr')
13+
expect(search_result_rows.length).to eq 1
14+
end
15+
16+
Then 'the Repository is opened in the edit mode' do
17+
uri = current_url.split('/')
18+
19+
action = uri.pop
20+
repository_id = uri.pop
21+
22+
expect(action).to eq 'edit'
23+
expect(repository_id).to eq @repository_id
24+
end
25+
26+
Given 'the Repository is opened in the view mode' do
27+
visit "#{STAFF_URL}/repositories/#{@repository_id}"
28+
end
29+
30+
Given 'the Repository is opened in edit mode' do
31+
visit "#{STAFF_URL}/repositories/#{@repository_id}/edit"
32+
end
33+
34+
Then 'the Repository Short Name field has the original value' do
35+
visit "#{STAFF_URL}/repositories/#{@repository_id}/edit"
36+
37+
expect(page).to have_field('Repository Short Name', with: "repository_test_#{@uuid}")
38+
end
39+
40+
Then 'the Repository form has the following values' do |form_values_table|
41+
form_values = form_values_table.hashes
42+
43+
form_values.each do |row|
44+
section_title = find('h3', text: row['form_section'])
45+
section = section_title.ancestor('section')
46+
expect(section[:id]).to_not eq nil
47+
48+
within section do
49+
field = find_field(row['form_field'])
50+
51+
expect(field.value.downcase).to eq row['form_value'].downcase
52+
end
53+
end
54+
end

staff_features/repositories/step_definitions/repository_view.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
visit "#{STAFF_URL}/repositories/new"
55

66
fill_in 'Repository Short Name', with: "repository_test_#{@uuid}"
7-
fill_in 'Repository Name', with: "repository_test_#{@uuid}"
7+
fill_in 'Repository Name', with: "Repository Test #{@uuid}"
88

99
click_on 'Save'
1010

0 commit comments

Comments
 (0)