Skip to content

Commit

Permalink
fix remove committee member test
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Oct 20, 2024
1 parent 428eef3 commit a0ce8e5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/views/committee_members/_committee_member.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= hidden_field_tag "committee_member_ids[]", committee_member.id %>
<% if @thesis.id && can?(:destroy, committee_member) && @thesis.status != Thesis::PUBLISHED %>
<%= link_to student_thesis_committee_member_path(@student, @thesis, committee_member),
method: :delete, class: "btn btn-close", remote: true, "title": "Remove #{committee_member.name} (#{committee_member.role})", "data-delete": "#{committee_member.name} (#{committee_member.role})" do %>
method: :delete, class: "btn btn-close", remote: true do %>
<span class="sr-only">Remove <%= "#{committee_member.name} (#{committee_member.role})" %></span>
<% end %>
<% end %>
Expand Down
6 changes: 0 additions & 6 deletions test/system/students_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ class StudentsTest < ApplicationSystemTestCase
login_as(@thesis.student)
visit root_url

# 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"
Expand Down Expand Up @@ -343,9 +340,6 @@ class StudentsTest < ApplicationSystemTestCase
login_as(@thesis.student)
visit root_url

# 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"
Expand Down
34 changes: 26 additions & 8 deletions test/system/theses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,37 @@ class ThesesTest < ApplicationSystemTestCase
visit root_url
click_link(@thesis_01.title)
click_on('Make Changes')

click_on('Add committee member')

fill_in('First Name', with: 'test1')
fill_in('Last Name', with: 'test2')
fill_in('First Name', with: 'f1')
fill_in('Last Name', with: 'l1')
choose('Committee Member')
click_on('Add')
assert_selector 'span', text: 'test2, test1'
assert_selector 'span', text: 'l1, f1'

assert_selector 'a[data-delete="test2, test1 (Committee Member)"]', visible: true

click_link('Remove test2, test1 (Committee Member)')
click_on('Add committee member')
fill_in('First Name', with: 'f2')
fill_in('Last Name', with: 'l2')
choose('Chair')
click_on('Add')
assert_selector 'span', text: 'l2, f2'

remove1 = 'Remove l1, f1 (Committee Member)'
remove2 = 'Remove l2, f2 (Chair)'

assert has_link?(remove1)
assert has_link?(remove2)

pp find_link(remove1).rect

click_link(remove1)

assert_no_selector 'span', text: 'l1, f1'
assert_no_link(remove1)

assert_selector 'span', text: 'l2, f2'

assert_no_selector 'span', text: 'test2, test1'
assert has_link?(remove2)
end

test 'Edit a thesis' do
Expand Down

0 comments on commit a0ce8e5

Please sign in to comment.