-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '20240716-system-tests' into develop
- Loading branch information
Showing
3 changed files
with
115 additions
and
18 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -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,35 @@ class StudentsTest < ApplicationSystemTestCase | |
click_link('Start this thesis') | ||
end | ||
|
||
test 'Starting a thesis' 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_button('Create Thesis') | ||
assert_selector "a", text: @gem_record.studentname | ||
end | ||
|
||
test 'Editing a student' do | ||
visit root_url | ||
click_link('Gem Records') | ||
click_link(@gem_record.studentname) | ||
click_link('Create ETD Student Record') | ||
page.accept_alert | ||
click_link('Make changes') | ||
|
||
fill_in('Email *', with: "[email protected]") | ||
fill_in('Name *', with: "#{@gem_record.studentname} (test)") | ||
click_button('Update Student') | ||
|
||
assert_selector 'p', text: "[email protected]", visible: true | ||
assert_selector 'h1', text: "#{@gem_record.studentname} (test)", visible: true | ||
end | ||
|
||
test 'Gem Record has committee members' do | ||
visit root_url | ||
click_link('Gem Records') | ||
|
@@ -31,7 +60,6 @@ class StudentsTest < ApplicationSystemTestCase | |
assert_selector "p", text: committee_member.full_name | ||
end | ||
end | ||
|
||
end | ||
|
||
test 'Log in as Student and add a thesis' do | ||
|
@@ -82,14 +110,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") | ||
|
@@ -132,7 +160,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" | ||
|
@@ -155,22 +183,22 @@ 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') | ||
|
||
assert_selector(".name", text: /Primary\.pdf/) | ||
|
||
click_on("Continue") | ||
|
||
|
||
## Page 4 | ||
|
||
# assert_text "LAC Supplementary Licence File Upload".upcase | ||
|
@@ -193,16 +221,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 | ||
|
||
|
@@ -211,6 +239,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() | ||
######################################## | ||
######################################## |
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