From a6ba1759a39bbf4332cb3b6e86fd376d413913a3 Mon Sep 17 00:00:00 2001 From: Tuan Nguyen Date: Mon, 21 Oct 2024 11:19:19 -0400 Subject: [PATCH 1/2] improve system tests and modal dialogs --- .github/workflows/rubyonrails.yml | 28 ++++++++++---- .../_committee_member.html.erb | 8 ++-- app/views/committee_members/_modal.html.erb | 2 +- app/views/committee_members/create.js.erb | 2 +- app/views/committee_members/new.js.erb | 2 +- ..._upload_modal.html.erb => _modal.html.erb} | 2 +- app/views/documents/edit.js.erb | 7 ++-- app/views/documents/new.js.erb | 7 ++-- test/application_system_test_case.rb | 2 +- test/system/students_test.rb | 12 +++--- test/system/theses_test.rb | 38 +++++++++++++++---- 11 files changed, 73 insertions(+), 37 deletions(-) rename app/views/documents/{_file_upload_modal.html.erb => _modal.html.erb} (77%) diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index cb1ba38..3318434 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -34,16 +34,28 @@ jobs: RAILS_ENV: test DATABASE_URL: sqlite3:db/test.sqlite3 run: | - bundle exec rake db:reset - bundle exec rake db:seed - bundle exec rake test TESTOPTS="-v" - bundle exec rake test:system TESTOPTS="-v" + bundle exec rails db:reset + bundle exec rails db:seed + bundle exec rails test -v + bundle exec rails test:system TESTOPTS="-v" + - name: Run tests with mysql env: RAILS_ENV: test DATABASE_URL: mysql2://test:test@127.0.0.1:3306/test run: | - bundle exec rake db:reset - bundle exec rake db:seed - bundle exec rake test TESTOPTS="-v" - bundle exec rake test:system TESTOPTS="-v" + bundle exec rails db:reset + bundle exec rails db:seed + bundle exec rails test -v + bundle exec rails test:system TESTOPTS="-v" + + - name: Create tar archive of screenshots + run: | + ( cd /home/runner/work/etd/etd/tmp && [ -d ./test-screenshots ] && tar cvf test-screenshots.tar ./test-screenshots ) || true + + - name: Upload screenshots + uses: actions/upload-artifact@v3 + if: always() + with: + name: test-screenshots + path: /home/runner/work/etd/etd/tmp/test-screenshots.tar diff --git a/app/views/committee_members/_committee_member.html.erb b/app/views/committee_members/_committee_member.html.erb index 3567ff8..1ff5a56 100644 --- a/app/views/committee_members/_committee_member.html.erb +++ b/app/views/committee_members/_committee_member.html.erb @@ -1,8 +1,10 @@
- - <%= hidden_field_tag "committee_member_ids[]", committee_member.id %> + <%= committee_member.name %> (<%= committee_member.role %>) <% 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, "data-delete": "#{committee_member.name} (#{committee_member.role})" do %> <% end %> + method: :delete, remote: true, class: "btn btn-close" do %> + Remove <%= "#{committee_member.name} (#{committee_member.role})" %> + <% end %> <% end %> + <%= hidden_field_tag "committee_member_ids[]", committee_member.id %>
diff --git a/app/views/committee_members/_modal.html.erb b/app/views/committee_members/_modal.html.erb index 72be84f..c1a043a 100644 --- a/app/views/committee_members/_modal.html.erb +++ b/app/views/committee_members/_modal.html.erb @@ -1,4 +1,4 @@ -