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

Commit 12667a8

Browse files
authored
Event View (#124)
1 parent a71dbd9 commit 12667a8

File tree

3 files changed

+176
-1
lines changed

3 files changed

+176
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Feature: Event View
2+
Background:
3+
Given an administrator user is logged in
4+
Scenario: Search Event by type
5+
Given an Event has been created
6+
When the user clicks on 'Browse'
7+
And the user clicks on 'Events'
8+
And the user filters by text with the Event record link title
9+
Then the Event is in the search results
10+
Scenario: View Event from the search results
11+
Given an Event has been created
12+
When the user clicks on 'Browse'
13+
And the user clicks on 'Events'
14+
And the user filters by text with the Event record link title
15+
And the user clicks on 'View'
16+
Then the Event view page is displayed
17+
Scenario: Sort Events by type
18+
Given two Events have been created with a common keyword in their record link title
19+
And the two Events are displayed sorted by ascending type
20+
When the user clicks on 'Type'
21+
Then the two Events are displayed sorted by descending type
22+
Scenario: Sort Events by Outcome
23+
Given two Events have been created with a common keyword in their record link title
24+
And the two Events are displayed sorted by ascending type
25+
When the user clicks on 'Outcome'
26+
Then the two Events are displayed sorted by ascending outcome
27+
Scenario: Sort Events by date created
28+
Given two Events have been created with a common keyword in their record link title
29+
And the two Events are displayed sorted by ascending type
30+
When the user clicks on 'Type Ascending'
31+
And the user hovers on 'Created' in the dropdown menu
32+
And the user clicks on 'Ascending' in the dropdown menu
33+
Then the two Events are displayed sorted by ascending created date
34+
Scenario: Sort Events by modified date
35+
Given two Events have been created with a common keyword in their record link title
36+
And the two Events are displayed sorted by ascending type
37+
When the user clicks on 'Type Ascending'
38+
And the user hovers on 'Modified' in the dropdown menu
39+
And the user clicks on 'Ascending' in the dropdown menu
40+
Then the two Events are displayed sorted by ascending modified date

staff_features/events/step_definitions/event_edit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
dropdown_items.first.click
1818

1919
select 'Outcome', from: 'event_linked_records__0__role_'
20-
fill_in 'token-input-event_linked_records__0__ref_', with: 'test_agent'
20+
fill_in 'token-input-event_linked_records__0__ref_', with: 'test_accession'
2121
dropdown_items = all('li.token-input-dropdown-item2')
2222
dropdown_items.first.click
2323

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# frozen_string_literal: true
2+
3+
When 'the user filters by text with the Event record link title' do
4+
fill_in 'Filter by text', with: @uuid
5+
6+
find('#filter-text').send_keys(:enter)
7+
8+
rows = []
9+
checks = 0
10+
11+
while checks < 5
12+
checks += 1
13+
14+
begin
15+
rows = all('tr', text: @uuid)
16+
rescue Selenium::WebDriver::Error::JavascriptError
17+
sleep 1
18+
end
19+
20+
break if rows.length == 1
21+
end
22+
end
23+
24+
Then 'the Event view page is displayed' do
25+
expect(current_url).to eq "#{STAFF_URL}/events/#{@event_id}"
26+
end
27+
28+
Then 'the Event is in the search results' do
29+
expect(page).to have_css('tr', text: 'test_agent')
30+
end
31+
32+
Given 'two Events have been created with a common keyword in their record link title' do
33+
@shared_accession_uuid = SecureRandom.uuid
34+
@accession_a_uuid = SecureRandom.uuid
35+
@accession_b_uuid = SecureRandom.uuid
36+
37+
visit "#{STAFF_URL}/accessions/new"
38+
fill_in 'accession_title_', with: "Accession A #{@accession_a_uuid} #{@shared_accession_uuid}"
39+
fill_in 'accession_id_0_', with: "Accession A #{@accession_a_uuid}"
40+
click_on 'Save'
41+
42+
visit "#{STAFF_URL}/accessions/new"
43+
fill_in 'accession_title_', with: "Accession B #{@accession_b_uuid} #{@shared_accession_uuid}"
44+
fill_in 'accession_id_0_', with: "Accession B #{@accession_b_uuid}"
45+
click_on 'Save'
46+
47+
visit "#{STAFF_URL}/events/new"
48+
fill_in 'Outcome Note', with: "A #{@shared_accession_uuid}"
49+
within '#event_date' do
50+
select 'Single', from: 'Type'
51+
fill_in 'Begin', with: '2020-01-01'
52+
end
53+
select 'Authorizer', from: 'event_linked_agents__0__role_'
54+
fill_in 'token-input-event_linked_agents__0__ref_', with: 'test_agent'
55+
dropdown_items = all('li.token-input-dropdown-item2')
56+
dropdown_items.first.click
57+
select 'Outcome', from: 'event_linked_records__0__role_'
58+
fill_in 'token-input-event_linked_records__0__ref_', with: "Accession A #{@accession_a_uuid} #{@shared_accession_uuid}"
59+
dropdown_items = all('li.token-input-dropdown-item2')
60+
dropdown_items.first.click
61+
find('button', text: 'Save Event', match: :first).click
62+
expect(find('.alert.alert-success').text).to eq 'Event Created'
63+
url_parts = current_url.split('events').pop.split('/')
64+
url_parts.pop
65+
@event_first_id = url_parts.pop
66+
67+
visit "#{STAFF_URL}/events/new"
68+
fill_in 'Outcome Note', with: "B #{@shared_accession_uuid}"
69+
within '#event_date' do
70+
select 'Single', from: 'Type'
71+
fill_in 'Begin', with: '2020-01-01'
72+
end
73+
select 'Authorizer', from: 'event_linked_agents__0__role_'
74+
fill_in 'token-input-event_linked_agents__0__ref_', with: 'test_agent'
75+
dropdown_items = all('li.token-input-dropdown-item2')
76+
dropdown_items.first.click
77+
select 'Outcome', from: 'event_linked_records__0__role_'
78+
fill_in 'token-input-event_linked_records__0__ref_', with: "Accession B #{@accession_b_uuid} #{@shared_accession_uuid}"
79+
dropdown_items = all('li.token-input-dropdown-item2')
80+
dropdown_items.first.click
81+
select 'Accumulation', from: 'event_event_type_'
82+
find('button', text: 'Save Event', match: :first).click
83+
expect(find('.alert.alert-success').text).to eq 'Event Created'
84+
url_parts = current_url.split('events').pop.split('/')
85+
url_parts.pop
86+
@event_first_id = url_parts.pop
87+
end
88+
89+
Then 'the two Events are displayed sorted by descending type' do
90+
search_result_rows = all('#tabledSearchResults tbody tr')
91+
92+
expect(search_result_rows.length).to eq 2
93+
expect(search_result_rows[1]).to have_text @accession_a_uuid
94+
expect(search_result_rows[0]).to have_text @accession_b_uuid
95+
end
96+
97+
Then 'the two Events are displayed sorted by ascending outcome' do
98+
search_result_rows = all('#tabledSearchResults tbody tr')
99+
100+
expect(search_result_rows.length).to eq 2
101+
expect(search_result_rows[0]).to have_text @accession_a_uuid
102+
expect(search_result_rows[1]).to have_text @accession_b_uuid
103+
end
104+
105+
Then 'the two Events are displayed sorted by ascending created date' do
106+
search_result_rows = all('#tabledSearchResults tbody tr')
107+
108+
expect(search_result_rows.length).to eq 2
109+
expect(search_result_rows[0]).to have_text @accession_a_uuid
110+
expect(search_result_rows[1]).to have_text @accession_b_uuid
111+
end
112+
113+
Then 'the two Events are displayed sorted by ascending modified date' do
114+
search_result_rows = all('#tabledSearchResults tbody tr')
115+
116+
expect(search_result_rows.length).to eq 2
117+
expect(search_result_rows[0]).to have_text @accession_a_uuid
118+
expect(search_result_rows[1]).to have_text @accession_b_uuid
119+
end
120+
121+
Given 'the two Events are displayed sorted by ascending type' do
122+
visit "#{STAFF_URL}/events"
123+
124+
fill_in 'filter-text', with: @shared_accession_uuid
125+
126+
within '.search-filter' do
127+
find('button').click
128+
end
129+
130+
search_result_rows = all('#tabledSearchResults tbody tr')
131+
132+
expect(search_result_rows.length).to eq 2
133+
expect(search_result_rows[0]).to have_text @accession_a_uuid
134+
expect(search_result_rows[1]).to have_text @accession_b_uuid
135+
end

0 commit comments

Comments
 (0)