From 135f76e246cb1a769161b2ba1abd27facc1b7d06 Mon Sep 17 00:00:00 2001 From: DevAdm Date: Wed, 24 Jul 2024 10:40:37 -0400 Subject: [PATCH 1/2] first commit --- app/assets/javascripts/theses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/theses.js b/app/assets/javascripts/theses.js index 0f19e60..532562b 100644 --- a/app/assets/javascripts/theses.js +++ b/app/assets/javascripts/theses.js @@ -23,7 +23,7 @@ $(document).ready(function () { $(".simple_form").on("click", ".remove_fields", function (event) { $(this).prev("input[type=hidden]").val("1"); - $(this).closest("fieldset").hide(); + $(this).closest("fieldset").remove(); event.preventDefault(); }); From b5d3fd100fa4903c961d70d775ce30f29c130867 Mon Sep 17 00:00:00 2001 From: DevAdm Date: Wed, 24 Jul 2024 12:17:04 -0400 Subject: [PATCH 2/2] added test --- test/system/students_test.rb | 50 ++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/test/system/students_test.rb b/test/system/students_test.rb index 28b80e8..5b50893 100644 --- a/test/system/students_test.rb +++ b/test/system/students_test.rb @@ -5,7 +5,7 @@ class StudentsTest < ApplicationSystemTestCase include SystemTestHelper # Include the SystemTestHelper module here - + setup do @gem_record = FactoryGirl.create(:gem_record) @@ -20,6 +20,22 @@ class StudentsTest < ApplicationSystemTestCase click_link('Start this thesis') end + test 'Create a new thesis and add/remove a committee member' do + visit root_url + click_link('Gem Records') + click_link(@gem_record.studentname) + click_link('Create ETD Student Record') + page.accept_alert + click_link('Start this thesis') + select "EMBA", from: "thesis_degree_name" + select "Master's", from: "thesis_degree_level" + click_link('Add Committee Member') + click_link('Remove') + click_button('Create Thesis') + assert_selector '.alert-success', text: 'ETD record successfully created.' + # page.accept_alert + end + test 'Log in as Student and add a thesis' do @thesis = FactoryGirl.create(:thesis) login_as(@thesis.student) @@ -71,14 +87,14 @@ class StudentsTest < ApplicationSystemTestCase # Ensure Add Committee Members button is not present. assert_no_selector '.student-view .card .card-body a.btn.btn-success', text: 'Add committee member' - + # Ensure that the close links are not present within the #committee_members section refute_selector("#committee_members .btn-close") - + end ## Page 2 and 3 tests - should "upload primary file" do + should "upload primary file" do @thesis = FactoryGirl.create(:thesis) create(:loc_subject, name: "Accounting", category: "BUSINESS") create(:loc_subject, name: "Management", category: "BUSINESS") @@ -121,7 +137,7 @@ class StudentsTest < ApplicationSystemTestCase # Set Page size page.driver.browser.manage.window.resize_to(1920, 2500) - + ## Page 1 click_link("My ETD Submission") assert_selector "input#student_email_external" @@ -144,14 +160,14 @@ class StudentsTest < ApplicationSystemTestCase fill_in "thesis_keywords", with: "accounting-kw, management-kw" click_on("Continue") - ## Page 3 + ## Page 3 click_on("Upload Primary File") assert_selector "p", text: "Your primary file should be in PDF format.", visible: :all - + # assert_no_selector("p", text: "Smith_Jane_E_2014_PhD.pdf", visible: :all) assert_not(page.has_css?("p", text: "Smith_Jane_E_2014_PhD.pdf"), "Should not show 'example text' as per Spring 2024 requirements") - + attach_file("document_file", Rails.root.join('test/fixtures/files/Tony_Rich_E_2012_Phd.pdf')) click_button('Upload') @@ -159,11 +175,11 @@ class StudentsTest < ApplicationSystemTestCase click_on("Continue") - + ## Page 4 - + assert_text "LAC Supplementary Licence File Upload" - + # Initially, checkboxes should be disabled if not checked assert page.has_unchecked_field?('thesis_yorkspace_licence_agreement', disabled: true) assert page.has_unchecked_field?('thesis_etd_licence_agreement', disabled: true) @@ -180,16 +196,16 @@ class StudentsTest < ApplicationSystemTestCase # Ensure the checkbox is enabled # assert find('#thesis_yorkspace_licence_agreement').enabled? # assert_not find('#thesis_yorkspace_licence_agreement').disabled?, "ERROR: Yorkspace licence agreement checkbox is not enabled." - + checkbox = find('#thesis_yorkspace_licence_agreement') assert_not checkbox.disabled?, "ERROR: Yorkspace licence agreement checkbox is not enabled." - + # Check the checkbox checkbox.check - + # Verify that the checkbox is checked assert checkbox.checked?, "ERROR: Yorkspace licence agreement checkbox is not checked." - + end end @@ -198,6 +214,6 @@ class StudentsTest < ApplicationSystemTestCase # page.driver.browser.manage.window.resize_to(1920, 2500) # save_screenshot() ## HTML Save -# File.open("tmp/test-screenshots/error.html", "w") { |file| file.write(page.html) } +# File.open("tmp/test-screenshots/error.html", "w") { |file| file.write(page.html) } # save_page() -######################################## \ No newline at end of file +########################################