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

Commit 4f344d9

Browse files
Repository edit (#135)
1 parent 7ed6e36 commit 4f344d9

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Feature: Repository Edit
2+
Background:
3+
Given an administrator user is logged in
4+
And a Repository has been created
5+
Scenario: Repository is opened in the edit mode from the browse menu
6+
Given the Repository appears in the search results list
7+
When the user clicks on 'Edit'
8+
Then the Repository is opened in edit mode
9+
Scenario: Repository is opened in the edit mode from the view mode
10+
Given the Repository is opened in the view mode
11+
When the user clicks on 'Edit'
12+
Then the Repository is opened in edit mode
13+
Scenario: Repository is not updated after changes are canceled
14+
Given the Repository is opened in edit mode
15+
When the user changes the 'Short Name' field
16+
And the user clicks on 'Cancel'
17+
Then the Repository Short Name field has the original value
18+
Scenario: Delete required field of a Repository fails
19+
Given the Repository is opened in edit mode
20+
When the user clears the 'Repository Short Name' field
21+
And the user clicks on 'Save Repository'
22+
Then the following error messages are displayed
23+
| Repository Short Name - Property is required but was missing |
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)