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

Commit 96f6406

Browse files
authored
Assessment Create (#119)
1 parent 73ef251 commit 96f6406

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

env.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@
6565

6666
Capybara.save_path = SCREENSHOTS_PATH
6767

68+
Capybara::Screenshot.register_driver(:firefox) do |driver, path|
69+
driver.browser.save_screenshot(path)
70+
end
71+
6872
After do |scenario|
6973
if scenario.failed?
7074
uuid = SecureRandom.uuid
7175

7276
scenario_name = scenario.name.downcase.gsub(' ', '_')
7377

74-
Capybara::Screenshot.register_filename_prefix_formatter(:cucumber) do |_example|
78+
Capybara::Screenshot.register_filename_prefix_formatter(:firefox) do |_example|
7579
scenario_name
7680
end
7781

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Feature: Assessment Create
2+
Background:
3+
Given an administrator user is logged in
4+
And a Digital Object has been created
5+
Scenario: Assessment is created
6+
Given the user is on the New Assessment page
7+
When the user clicks on the Records dropdown
8+
And the user clicks on 'Browse' in the dropdown menu
9+
And the user filters by text with the Digital Object title in the modal
10+
And the user selects the Digital Object from the search results in the modal
11+
And the user clicks on 'Link' in the modal
12+
And the user clicks on the Surveyed By dropdown
13+
And the user clicks on 'Browse' in the dropdown menu
14+
And the user filters by text with the Agent name in the modal
15+
And the user selects the Agent from the search results in the modal
16+
And the user clicks on 'Link' in the modal
17+
And the user clicks on 'Save'
18+
Then the 'Assessment' created message is displayed
19+
Scenario: Assessment is not created because required fields are missing
20+
Given the user is on the New Assessment page
21+
When the user clicks on 'Save'
22+
Then the following error messages are displayed
23+
| Records - At least 1 item(s) is required |
24+
| Surveyed By - At least 1 item(s) is required |
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# frozen_string_literal: true
2+
3+
Given 'the user is on the New Assessment page' do
4+
visit "#{STAFF_URL}/assessments/new"
5+
end
6+
7+
When 'the user clicks on the Records dropdown' do
8+
sleep 3
9+
10+
find_field('Records').find(:xpath, './ancestor::div[1]').find('button', match: :first).click
11+
end
12+
13+
When('the user filters by text with the Digital Object title in the modal') do
14+
within '.modal-content' do
15+
find('.text-filter-field.form-control.rounded-left').fill_in with: @uuid
16+
17+
find('.search-filter button').click
18+
end
19+
end
20+
21+
When 'the user selects the Digital Object from the search results in the modal' do
22+
find('tr', text: @uuid, match: :first).click
23+
end
24+
25+
When 'the user clicks on the Surveyed By dropdown' do
26+
find_field('Surveyed By').find(:xpath, './ancestor::div[1]').find('button', match: :first).click
27+
end
28+
29+
When 'the user filters by text with the Agent name in the modal' do
30+
within '.modal-content' do
31+
find('.text-filter-field.form-control.rounded-left').fill_in with: 'test'
32+
33+
find('.search-filter button').click
34+
end
35+
end
36+
37+
When('the user selects the Agent from the search results in the modal') do
38+
rows = all('#tabledSearchResults tbody tr input')
39+
expect(rows.length).to eq 1
40+
rows[0].click
41+
end

0 commit comments

Comments
 (0)