|
82 | 82 | select "Teaching", from: :project_purpose |
83 | 83 | fill_in :description, with: "An awesome project to show the wizard is magic" |
84 | 84 | expect(page).to have_content "46/1000 characters" |
85 | | - expect(page).not_to have_content("(77777) RDSS-Research Data and Scholarship Services") |
86 | | - # Non breaking space `u00A0` is at the end of every option to indicate an option was selected |
87 | | - select "(77777) RDSS-Research Data and Scholarship Services\u00A0", from: "department_find" |
88 | | - # This is triggering the html5 element like it would normally if the page has focus |
89 | | - page.find(:datalist_input, "department_find").execute_script("document.getElementById('department_find').dispatchEvent(new Event('input'))") |
90 | | - expect(page).to have_content("(77777) RDSS-Research Data and Scholarship Services") |
91 | | - expect(page).to have_field("request[departments][]", type: :hidden, with: "{\"code\":\"77777\",\"name\":\"RDSS-Research Data and Scholarship Services\"}") |
| 85 | + expect(page).not_to have_content("RDSS-Research Data and Scholarship Services") |
| 86 | + select_and_verify_department(department: "RDSS-Research Data and Scholarship Services", department_code: "77777", department_list: []) |
| 87 | + select_and_verify_department(department: "HPC-High Performance Computing", department_code: "66666", department_list: [{ code: "77777", name: "RDSS-Research Data and Scholarship Services" }]) |
92 | 88 |
|
93 | 89 | select_user(current_user, "data_sponsor", "request[data_sponsor]") |
94 | 90 | select_user(current_user, "data_manager", "request[data_manager]") |
|
156 | 152 | fill_in :project_folder, with: "skeletor" |
157 | 153 | fill_in :description, with: "An awesome project to show the wizard is magic" |
158 | 154 | expect(page).to have_content "46/1000 characters" |
159 | | - expect(page).not_to have_content("(77777) RDSS-Research Data and Scholarship Services") |
160 | | - # Non breaking space `u00A0` is at the end of every option to indicate an option was selected |
161 | | - select "(77777) RDSS-Research Data and Scholarship Services\u00A0", from: "department_find" |
162 | 155 | select "Research", from: "project_purpose" |
163 | | - # This is triggering the html5 element like it would normally if the page has focus |
164 | | - page.find(:datalist_input, "department_find").execute_script("document.getElementById('department_find').dispatchEvent(new Event('input'))") |
165 | | - expect(page).to have_content("(77777) RDSS-Research Data and Scholarship Services") |
166 | | - expect(page).to have_field("request[departments][]", type: :hidden, with: "{\"code\":\"77777\",\"name\":\"RDSS-Research Data and Scholarship Services\"}") |
| 156 | + expect(page).not_to have_content("RDSS-Research Data and Scholarship Services") |
| 157 | + select_and_verify_department(department: "RDSS-Research Data and Scholarship Services", department_code: "77777", department_list: []) |
167 | 158 |
|
168 | 159 | # force a save and page reload to make sure all data is being saved to the model |
169 | 160 | click_on "Next" |
|
184 | 175 | expect(page).to have_field("parent_folder", with: "abc_lab") |
185 | 176 | expect(page).to have_field("project_folder", with: "skeletor") |
186 | 177 | expect(page).to have_field("description", with: "An awesome project to show the wizard is magic") |
187 | | - expect(page).to have_content("(77777) RDSS-Research Data and Scholarship Services") |
| 178 | + expect(page).to have_content("RDSS-Research Data and Scholarship Services") |
188 | 179 | expect(page).to have_field("request[departments][]", type: :hidden, with: "{\"code\":\"77777\",\"name\":\"RDSS-Research Data and Scholarship Services\"}") |
189 | 180 | click_on "Next" |
190 | 181 | # TODO: when the wizard is fully functional the correct next step(s) are below |
|
273 | 264 | expect(page).to have_content "46/1000 characters" |
274 | 265 |
|
275 | 266 | # Select a department |
276 | | - department_to_test = "(77777) RDSS-Research Data and Scholarship Services" |
277 | | - expect(page).not_to have_content(department_to_test) |
278 | | - # Non breaking space `u00A0` is at the end of every option to indicate an option was selected |
279 | | - select "#{department_to_test}\u00A0", from: "department_find" |
280 | | - # This is triggering the html5 element like it would normally if the page has focus |
281 | | - page.find(:datalist_input, "department_find").execute_script("document.getElementById('department_find').dispatchEvent(new Event('input'))") |
282 | | - expect(page).to have_content(department_to_test) |
283 | | - expect(page).to have_field("request[departments][]", type: :hidden, with: "{\"code\":\"77777\",\"name\":\"RDSS-Research Data and Scholarship Services\"}") |
| 267 | + department_to_test = "RDSS-Research Data and Scholarship Services" |
| 268 | + select_and_verify_department(department: department_to_test, department_code: "77777", department_list: []) |
284 | 269 |
|
285 | 270 | # Remove the department |
286 | | - page.execute_script("document.getElementsByClassName('remove-department')[0].click()") |
| 271 | + within(".departments") do |
| 272 | + page.execute_script("document.getElementsByClassName('remove-item')[0].click()") |
| 273 | + end |
287 | 274 | expect(page).not_to have_content(department_to_test) |
288 | 275 | end |
289 | 276 |
|
|
342 | 329 | sign_in current_user |
343 | 330 | visit "new-project/project-info" |
344 | 331 |
|
345 | | - # Non breaking space `u00A0` is at the end of every option to indicate an option was selected |
346 | | - select "(77777) RDSS-Research Data and Scholarship Services\u00A0", from: "department_find" |
347 | | - select "(77777) RDSS-Research Data and Scholarship Services\u00A0", from: "department_find" |
348 | | - # This is triggering the html5 element like it would normally if the page has focus |
349 | | - page.find(:datalist_input, "department_find").execute_script("document.getElementById('department_find').dispatchEvent(new Event('input'))") |
| 332 | + select_and_verify_department(department: "RDSS-Research Data and Scholarship Services", department_code: "77777", department_list: []) |
| 333 | + # the option is no longer available |
| 334 | + within(".departments") do |
| 335 | + page.find(".lux-field input").fill_in with: "77777" |
| 336 | + within(".lux-autocomplete-input") do |
| 337 | + expect(page).not_to have_content "RDSS-Research Data and Scholarship Services" |
| 338 | + end |
| 339 | + end |
| 340 | + |
350 | 341 | expect(page).to have_field("request[departments][]", type: :hidden, with: "{\"code\":\"77777\",\"name\":\"RDSS-Research Data and Scholarship Services\"}") |
351 | | - expect(page).to have_content("(77777) RDSS-Research Data and Scholarship Services").exactly(2).times |
| 342 | + expect(page).to have_content("RDSS-Research Data and Scholarship Services").exactly(1).times |
352 | 343 |
|
353 | 344 | click_on "Review and Submit" |
354 | 345 | expect(page).to have_content("Take a moment to review your details and make any necessary edits before finalizing.") |
355 | | - expect(page).to have_content("(77777) RDSS-Research Data and Scholarship Services").exactly(1).times |
| 346 | + expect(page).to have_content("RDSS-Research Data and Scholarship Services").exactly(1).times |
356 | 347 |
|
357 | 348 | fill_in :project_title, with: "No Duplicate Departments Project" |
358 | 349 | fill_in :parent_folder, with: "abc_lab" |
|
0 commit comments