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

Commit e4628f3

Browse files
Repository view
1 parent f124254 commit e4628f3

File tree

3 files changed

+95
-4
lines changed

3 files changed

+95
-4
lines changed

staff_features/repositories/repository_view.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Feature: Repository View
55
Given a Repository has been created
66
When the user clicks on 'System'
77
And the user clicks on 'Manage Repositories'
8-
And the user filters by text with the Repository title
8+
And the user filters by text with the Repository name
99
Then the Repository is in the search results
1010
Scenario: View Repository from the search results
1111
Given a Repository has been created
1212
When the user clicks on 'System'
1313
And the user clicks on 'Manage Repositories'
14-
And the user filters by text with the Repository title
14+
And the user filters by text with the Repository name
1515
And the user clicks on 'View'
1616
Then the Repository view page is displayed
1717
Scenario: Sort Repositories by title
1818
Given two Repositories have been created with a common keyword in their title
19-
And the two Repositories are displayed sorted by ascending title
19+
And the two Repositories are displayed sorted by ascending title in the searh results
2020
When the user clicks on 'Title'
21-
Then the two Repositories are displayed sorted by descending title
21+
Then the two Repositories are displayed sorted by ascending title
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# frozen_string_literal: true
2+
3+
Given 'a Repository has been created' do
4+
visit "#{STAFF_URL}/repositories/new"
5+
6+
fill_in 'Repository Short Name', with: "repository_test_#{@uuid}"
7+
fill_in 'Repository Name', with: "repository_test_#{@uuid}"
8+
9+
click_on 'Save'
10+
11+
expect(find('.alert').text).to eq 'Repository Created'
12+
13+
url_parts = current_url.split('repositories').pop.split('/')
14+
@repository_id = url_parts.pop
15+
end
16+
17+
When 'the user filters by text with the Repository name' do
18+
fill_in 'Filter by text', with: "repository_test_#{@uuid}"
19+
20+
find('#filter-text').send_keys(:enter)
21+
22+
rows = []
23+
checks = 0
24+
25+
while checks < 5
26+
checks += 1
27+
28+
begin
29+
rows = all('tr', text: @uuid)
30+
rescue Selenium::WebDriver::Error::JavascriptError
31+
sleep 1
32+
end
33+
34+
break if rows.length == 1
35+
end
36+
end
37+
38+
Then 'the Repository view page is displayed' do
39+
expect(current_url).to eq "#{STAFF_URL}/repositories/#{@repository_id}"
40+
end
41+
42+
Then 'the Repository is in the search results' do
43+
expect(page).to have_css('tr', text: @uuid)
44+
end
45+
46+
Given 'two Repositories have been created with a common keyword in their title' do
47+
@shared_repository_uuid = SecureRandom.uuid
48+
@repository_a_uuid = SecureRandom.uuid
49+
@repository_b_uuid = SecureRandom.uuid
50+
51+
visit "#{STAFF_URL}/repositories/new"
52+
fill_in 'Repository Short Name', with: "repository_test_a_#{@repository_a_uuid}_#{@shared_repository_uuid}"
53+
fill_in 'Repository Name', with: "Repository Test A #{@repository_a_uuid} #{@shared_repository_uuid}"
54+
click_on 'Save'
55+
56+
uri_parts = current_url.split('/')
57+
uri_parts.pop
58+
@repository_first_id = uri_parts.pop
59+
60+
visit "#{STAFF_URL}/repositories/new"
61+
fill_in 'Repository Short Name', with: "repository_test_b_#{@repository_b_uuid}_#{@shared_repository_uuid}"
62+
fill_in 'Repository Name', with: "Repository Test B #{@repository_b_uuid} #{@shared_repository_uuid}x"
63+
click_on 'Save'
64+
uri_parts = current_url.split('/')
65+
uri_parts.pop
66+
@repository_second_id = uri_parts.pop
67+
end
68+
69+
Given 'the two Repositories are displayed sorted by ascending title in the searh results' do
70+
visit "#{STAFF_URL}/repositories"
71+
72+
fill_in 'filter-text', with: @shared_repository_uuid
73+
74+
within '.search-filter' do
75+
find('button').click
76+
end
77+
78+
search_result_rows = all('#tabledSearchResults tbody tr')
79+
80+
expect(search_result_rows.length).to eq 2
81+
expect(search_result_rows[0]).to have_text @repository_a_uuid
82+
expect(search_result_rows[1]).to have_text @repository_b_uuid
83+
end
84+
85+
Then 'the two Repositories are displayed sorted by ascending title' do
86+
search_result_rows = all('#tabledSearchResults tbody tr')
87+
88+
expect(search_result_rows.length).to eq 2
89+
expect(search_result_rows[0]).to have_text @repository_a_uuid
90+
expect(search_result_rows[1]).to have_text @repository_b_uuid
91+
end

0 commit comments

Comments
 (0)