-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1aaa83e
commit fde1f1a
Showing
3 changed files
with
185 additions
and
21 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
staff_features/resources/resource_multiple_component_create.feature
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
staff_features/resources/resource_rapid_data_entry.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Feature: Resource Rapid Data Entry | ||
Background: | ||
Given an administrator user is logged in | ||
And a Resource has been created | ||
And the Resource is opened in edit mode | ||
Scenario: Add a new resource component row with valid data | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user selects 'File' from 'Level of Description' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Title' with 'Default Test Title' in the first row of the Rapid Data Entry table | ||
And the user selects 'Single' from 'Date Type' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Begin' with '2021' in the first row of the Rapid Data Entry table | ||
And the user clicks on 'Add Row' in the modal | ||
Then a new row with the following data is added to the Rapid Data Entry table | ||
| Level of Description | File | | ||
| Date Type | Single | | ||
| Begin | 2021 | | ||
Scenario: Validate row succeeds | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user selects 'File' from 'Level of Description' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Title' with 'Default Test Title' in the first row of the Rapid Data Entry table | ||
And the user selects 'Single' from 'Date Type' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Begin' with '2021' in the first row of the Rapid Data Entry table | ||
And the user clicks on 'Validate Rows' in the modal | ||
Then the following message is displayed | ||
| All rows are valid | | ||
Scenario: Validate row fails | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user clicks on 'Validate Rows' in the modal | ||
Then the following error messages are displayed | ||
| 1 row(s) with an error - click a row field to view the errors for that row | | ||
Scenario: Remove a column from the Rapid Data Entry table | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user clicks on 'Columns: 45 visible' | ||
And the user unchecks the 'Basic Information - Title' checkbox in the dropdown menu | ||
Then the 'Basic Information - Title' column is no longer visible in the Rapid Data Entry table | ||
# The following feature has a bug. Label `Fill Value` should have for="basicFillValue" instead of for="basicFillTargetColumn" | ||
# | ||
# Scenario: Fill a column with a designated value | ||
# When the user clicks on 'Rapid Data Entry' | ||
# And the user clicks on 'Fill Column' | ||
# And the user selects 'Basic Information - Level of Description' from 'Column' in the modal | ||
# And the user selects 'Class' from 'Fill Value' in the modal | ||
# And the user clicks on 'Apply fill' in the modal | ||
# Then all rows in 'Basic Information - Level of Description' column should be populated with the 'Class' value | ||
Scenario: Save a Rapid Data Entry Template | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user selects 'File' from 'Level of Description' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Title' with 'Default Test Title' in the first row of the Rapid Data Entry table | ||
And the user selects 'Single' from 'Date Type' in the first row of the Rapid Data Entry table | ||
And the user fills in 'Begin' with '2021' in the first row of the Rapid Data Entry table | ||
And the user clicks on 'Save as Template' in the modal | ||
And the user fills in 'Template name' with 'Test Template' | ||
And the user clicks on 'Save Template' | ||
Then a new template with name 'Test Template' with the following data is added to the Rapid Data Entry templates | ||
| Level of Description | File | | ||
| Title | Default Test Title | | ||
| Date Type | Single | | ||
| Begin | 2021 | | ||
Scenario: Remove a Rapid Data Entry Template | ||
Given a Radpid Data Entry template has been created | ||
When the user clicks on 'Rapid Data Entry' | ||
And the user clicks on 'Remove Templates' in the modal | ||
And the user checks the created Rapid Data Entry template | ||
And the user clicks on 'Confirm Removal' | ||
Then the template is removed from the Rapid Data Entry templates |
120 changes: 120 additions & 0 deletions
120
staff_features/resources/step_definitions/resource_rapid_data_entry.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# frozen_string_literal: true | ||
|
||
When 'the user selects {string} from {string} in the first row of the Rapid Data Entry table' do |option, label| | ||
table_header_cells = all('.fieldset-labels .kiketable-th-text') | ||
|
||
label_position = 0 | ||
table_header_cells.each_with_index do |header, index| | ||
label_position = index if header.text == label | ||
end | ||
|
||
label_position += 1 | ||
expect(label_position).to_not eq 0 | ||
|
||
table_field_cells = all('#rdeTable tbody td') | ||
field_cell = table_field_cells[label_position] | ||
field_cell_select = field_cell.find('select') | ||
field_cell_select.select option | ||
end | ||
|
||
When 'the user fills in {string} with {string} in the first row of the Rapid Data Entry table' do |label, value| | ||
table_header_cells = all('.fieldset-labels .kiketable-th-text') | ||
|
||
label_position = 0 | ||
table_header_cells.each_with_index do |header, index| | ||
label_position = index if header.text == label | ||
end | ||
|
||
label_position += 1 | ||
expect(label_position).to_not eq 0 | ||
|
||
table_field_cells = all('#rdeTable tbody td') | ||
field_cell = table_field_cells[label_position] | ||
field_cell_input = field_cell.find('input') | ||
field_cell_input.fill_in with: value | ||
end | ||
|
||
Then 'a new row with the following data is added to the Rapid Data Entry table' do |form_values_table| | ||
table_header_cells = all('.fieldset-labels .kiketable-th-text') | ||
table_field_rows = all('#rdeTable tbody tr') | ||
|
||
expect(table_field_rows.length).to eq 2 | ||
|
||
form_values_hash = form_values_table.rows_hash | ||
form_values_hash.each do |field, value| | ||
field_position = 0 | ||
table_header_cells.each_with_index do |header, index| | ||
field_position = index if header.text == field | ||
end | ||
field_position += 1 | ||
expect(field_position).to_not eq 0 | ||
|
||
table_field_cells = table_field_rows[1].all('td') | ||
field_cell = table_field_cells[field_position] | ||
|
||
expect(field_cell.find('input, select, textarea').value.downcase.gsub(' ', '_')).to eq value.downcase.gsub(' ', '_') | ||
end | ||
end | ||
|
||
Then 'a new template with name {string} with the following data is added to the Rapid Data Entry templates' do |template, form_values_table| | ||
visit "#{STAFF_URL}/resources/#{@resource_id}/edit" | ||
click_on 'Rapid Data Entry' | ||
wait_for_ajax | ||
|
||
click_on 'Apply an RDE Template' | ||
find('a span', text: template, match: :first).click | ||
|
||
table_header_cells = all('.fieldset-labels .kiketable-th-text') | ||
table_field_rows = all('#rdeTable tbody tr') | ||
|
||
expect(table_field_rows.length).to eq 1 | ||
|
||
form_values_hash = form_values_table.rows_hash | ||
form_values_hash.each do |field, value| | ||
field_position = 0 | ||
table_header_cells.each_with_index do |header, index| | ||
field_position = index if header.text == field | ||
end | ||
field_position += 1 | ||
expect(field_position).to_not eq 0 | ||
|
||
table_field_cells = table_field_rows[0].all('td') | ||
field_cell = table_field_cells[field_position] | ||
|
||
expect(field_cell.find('input, select, textarea').value.downcase.gsub(' ', '_')).to eq value.downcase.gsub(' ', '_') | ||
end | ||
end | ||
|
||
Given 'a Radpid Data Entry template has been created' do | ||
visit "#{STAFF_URL}/resources/#{@resource_id}/edit" | ||
click_on 'Rapid Data Entry' | ||
wait_for_ajax | ||
|
||
click_on 'Save as Template' | ||
fill_in 'templateName', with: "RDE Template #{@uuid}" | ||
click_on 'Save Template' | ||
|
||
visit "#{STAFF_URL}/resources/#{@resource_id}/edit" | ||
wait_for_ajax | ||
end | ||
|
||
When 'the user checks the created Rapid Data Entry template' do | ||
find('label', text: "RDE Template #{@uuid}").click | ||
end | ||
|
||
Then 'the template is removed from the Rapid Data Entry templates' do | ||
visit "#{STAFF_URL}/resources/#{@resource_id}/edit" | ||
click_on 'Rapid Data Entry' | ||
wait_for_ajax | ||
click_on 'Apply an RDE Template' | ||
|
||
expect(find('.dropdown-menu')).to_not have_text "RDE Template #{@uuid}" | ||
end | ||
|
||
When 'the user unchecks the {string} checkbox in the dropdown menu' do |label| | ||
uncheck label | ||
end | ||
|
||
Then 'the {string} column is no longer visible in the Rapid Data Entry table' do |string| | ||
expect(page).to_not have_css('.fieldset-label.sticky.kiketable-th', text: string) | ||
end |