From 5afb5e918ec2863b8d2745f6bb7fac9749b00a14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 08:34:31 +0000 Subject: [PATCH 1/2] Bump the rubocop group with 3 updates Bumps the rubocop group with 3 updates: [rubocop-capybara](https://github.com/rubocop/rubocop-capybara), [rubocop-factory_bot](https://github.com/rubocop/rubocop-factory_bot) and [rubocop-minitest](https://github.com/rubocop/rubocop-minitest). Updates `rubocop-capybara` from 2.19.0 to 2.20.0 - [Release notes](https://github.com/rubocop/rubocop-capybara/releases) - [Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-capybara/compare/v2.19.0...v2.20.0) Updates `rubocop-factory_bot` from 2.24.0 to 2.25.1 - [Release notes](https://github.com/rubocop/rubocop-factory_bot/releases) - [Changelog](https://github.com/rubocop/rubocop-factory_bot/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-factory_bot/compare/v2.24.0...v2.25.1) Updates `rubocop-minitest` from 0.34.3 to 0.34.4 - [Release notes](https://github.com/rubocop/rubocop-minitest/releases) - [Changelog](https://github.com/rubocop/rubocop-minitest/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-minitest/compare/v0.34.3...v0.34.4) --- updated-dependencies: - dependency-name: rubocop-capybara dependency-type: direct:development update-type: version-update:semver-minor dependency-group: rubocop - dependency-name: rubocop-factory_bot dependency-type: direct:development update-type: version-update:semver-minor dependency-group: rubocop - dependency-name: rubocop-minitest dependency-type: direct:development update-type: version-update:semver-patch dependency-group: rubocop ... Signed-off-by: dependabot[bot] --- Gemfile | 6 +++--- Gemfile.lock | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index d82c42e69c..2250965d56 100644 --- a/Gemfile +++ b/Gemfile @@ -177,9 +177,9 @@ group :development do gem 'web-console', '~> 4.2.1' gem 'rb-readline', '~> 0.5.5' # require for irb - gem 'rubocop-capybara', '~> 2.19.0' - gem 'rubocop-factory_bot', '~> 2.24' - gem 'rubocop-minitest', '~> 0.34.3' + gem 'rubocop-capybara', '~> 2.20.0' + gem 'rubocop-factory_bot', '~> 2.25' + gem 'rubocop-minitest', '~> 0.34.4' gem 'rubocop-rails', '~> 2.23.1' # for opening letters diff --git a/Gemfile.lock b/Gemfile.lock index 7a29662863..3ef97c28d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -345,7 +345,7 @@ GEM webfinger (~> 2.0) orm_adapter (0.5.0) parallel (1.24.0) - parser (3.2.2.4) + parser (3.3.0.2) ast (~> 2.4.1) racc premailer (1.18.0) @@ -429,7 +429,7 @@ GEM rb-readline (0.5.5) rdoc (6.6.2) psych (>= 4.0.0) - regexp_parser (2.8.3) + regexp_parser (2.9.0) reline (0.4.2) io-console (~> 0.5) responders (3.1.1) @@ -450,11 +450,11 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) - rubocop (~> 1.33) - rubocop-minitest (0.34.3) + rubocop-factory_bot (2.25.1) + rubocop (~> 1.41) + rubocop-minitest (0.34.4) rubocop (>= 1.39, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) rubocop-rails (2.23.1) @@ -620,9 +620,9 @@ DEPENDENCIES rails-i18n (~> 7.0.8) rb-readline (~> 0.5.5) rouge (= 4.2.0) - rubocop-capybara (~> 2.19.0) - rubocop-factory_bot (~> 2.24) - rubocop-minitest (~> 0.34.3) + rubocop-capybara (~> 2.20.0) + rubocop-factory_bot (~> 2.25) + rubocop-minitest (~> 0.34.4) rubocop-rails (~> 2.23.1) ruby-saml (~> 1.16.0) rubyzip (~> 2.3.2) From d14ba2f45c384651b18ad2e0bf108330e17b9dd5 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 9 Jan 2024 09:46:56 +0100 Subject: [PATCH 2/2] Fix linting --- .rubocop.yml | 2 + test/system/annotations_test.rb | 78 ++++++++++++++-------------- test/system/courses_test.rb | 4 +- test/system/feedbacks_test.rb | 4 +- test/system/questions_test.rb | 28 +++++----- test/system/saved_annotation_test.rb | 12 ++--- test/system/search_test.rb | 4 +- 7 files changed, 67 insertions(+), 65 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index af09f01fd3..8e5ece231a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -90,6 +90,8 @@ Style/HashSyntax: FactoryBot/ConsistentParenthesesStyle: EnforcedStyle: omit_parentheses +FactoryBot/ExcessiveCreateList: + MaxAmount: 50 Minitest/MultipleAssertions: Enabled: false diff --git a/test/system/annotations_test.rb b/test/system/annotations_test.rb index ef212b6c6c..04f9d3cc8b 100644 --- a/test/system/annotations_test.rb +++ b/test/system/annotations_test.rb @@ -37,7 +37,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Navigate to code tab' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within '.code-listing' do @code_lines.each { |code_line| assert_text code_line } end @@ -45,7 +45,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Submission annotation button is present for each code line' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within '.code-listing' do (1..@code_lines.length).each do |index| @@ -59,7 +59,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Click on submission annotation button' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -74,7 +74,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Enter annotation and send' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -82,7 +82,7 @@ class AnnotationsTest < ApplicationSystemTestCase initial = 'This is a single line comment' within 'form.annotation-submission' do find('textarea.annotation-submission-input').fill_in with: initial - click_button 'Comment' + click_on 'Comment' end within '.annotation' do @@ -94,7 +94,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Character counter updates when typing' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -111,12 +111,12 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Cancel annotation form' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click within 'form.annotation-submission' do - click_button 'Cancel' + click_on 'Cancel' end assert_no_css '.annotation' @@ -127,7 +127,7 @@ class AnnotationsTest < ApplicationSystemTestCase annot = create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within '.annotation' do assert_text annot.annotation_text @@ -141,7 +141,7 @@ class AnnotationsTest < ApplicationSystemTestCase within 'form.annotation-submission' do find('textarea.annotation-submission-input').fill_in with: replacement - click_button 'Update' + click_on 'Update' end within '.annotation' do @@ -154,7 +154,7 @@ class AnnotationsTest < ApplicationSystemTestCase annot = create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within '.annotation' do assert_text annot.annotation_text @@ -171,22 +171,22 @@ class AnnotationsTest < ApplicationSystemTestCase test 'User moving back and forth over code and tests' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' - click_link 'Correctheid' - click_link 'Code' + click_on 'Correctheid' + click_on 'Code' annot = create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do assert_text annot.annotation_text end - click_link 'Correctheid' - click_link 'Code' + click_on 'Correctheid' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -197,7 +197,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Edit valid annotation -- Too large input text' do annot = create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -224,7 +224,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Edit valid annotation -- Zero length input text' do annot = create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -237,12 +237,12 @@ class AnnotationsTest < ApplicationSystemTestCase replacement = '' within 'form.annotation-submission' do find('textarea.annotation-submission-input').fill_in with: replacement - click_button 'Update' + click_on 'Update' end # Cancel the form within 'form.annotation-submission' do - click_button 'Cancel' + click_on 'Cancel' end # Check if the view is correct without reloading @@ -253,7 +253,7 @@ class AnnotationsTest < ApplicationSystemTestCase # After reload, make sure no replacing has taken place visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -265,7 +265,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Enter invalid annotation and send - No content' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -273,26 +273,26 @@ class AnnotationsTest < ApplicationSystemTestCase initial = '' within 'form.annotation-submission' do find('textarea.annotation-submission-input').fill_in with: initial - click_button 'Comment' + click_on 'Comment' # Assuming the update did not go trough # If the creation went trough, the cancel button would not exist anymore - click_button 'Cancel' + click_on 'Cancel' end assert_selector '.annotation', count: 0 # After reload, make sure no creation has taken place visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 0 end test 'Enter invalid annotation and send - Content too long' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -310,14 +310,14 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Enter global annotation' do visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' - click_button 'Add global comment' + click_on 'Add global comment' initial = Faker::Lorem.words(number: 128).join(' ') within 'd-annotation-form' do find('textarea.annotation-submission-input').fill_in with: initial - click_button 'Comment' + click_on 'Comment' end assert_selector '.annotation', count: 1 @@ -328,7 +328,7 @@ class AnnotationsTest < ApplicationSystemTestCase # After reload, make sure creation has taken place visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -340,7 +340,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Edit global annotation' do annot = create :annotation, submission: @instance, user: @zeus, line_nr: nil visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -354,7 +354,7 @@ class AnnotationsTest < ApplicationSystemTestCase replacement = Faker::Lorem.words(number: 32).join(' ') within 'form.annotation-submission' do find('textarea.annotation-submission-input').fill_in with: replacement - click_button 'Update' + click_on 'Update' end within '.annotation' do assert_no_text old_text @@ -363,7 +363,7 @@ class AnnotationsTest < ApplicationSystemTestCase # After reload, make sure creation has taken place visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' assert_selector '.annotation', count: 1 within '.annotation' do @@ -375,7 +375,7 @@ class AnnotationsTest < ApplicationSystemTestCase test 'Can reply to an annotation' do create :annotation, submission: @instance, user: @zeus visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') within thread do @@ -388,7 +388,7 @@ class AnnotationsTest < ApplicationSystemTestCase answer_field = find('textarea') answer_field.fill_in with: answer - click_button 'Reply' + click_on 'Reply' assert_selector '.annotation', count: 2 end @@ -398,7 +398,7 @@ class AnnotationsTest < ApplicationSystemTestCase annot = create :annotation, submission: @instance, user: @zeus create :annotation, submission: @instance, user: @zeus, thread_root: annot visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within 'd-thread' do assert_selector '.annotation', count: 2 @@ -415,7 +415,7 @@ class AnnotationsTest < ApplicationSystemTestCase annot = create :annotation, submission: @instance, user: @zeus create :annotation, submission: @instance, user: @zeus, thread_root: annot visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within 'd-thread' do assert_selector '.annotation', count: 2 @@ -440,7 +440,7 @@ class AnnotationsTest < ApplicationSystemTestCase create :annotation, submission: @instance, user: @zeus, thread_root: annot create :annotation, submission: @instance, user: @zeus, thread_root: annot visit(submission_path(id: @instance.id)) - click_link 'Code' + click_on 'Code' within 'd-thread' do assert_selector '.annotation', count: 3 diff --git a/test/system/courses_test.rb b/test/system/courses_test.rb index 1ae53a6657..2634335f51 100644 --- a/test/system/courses_test.rb +++ b/test/system/courses_test.rb @@ -25,11 +25,11 @@ class CoursesTest < ApplicationSystemTestCase assert_selector 'd-filter-tabs li:first-child a.active' assert_selector '#courses-table-wrapper tbody tr', count: 2 - find('d-filter-tabs').click_link 'All courses' + find('d-filter-tabs').click_on 'All courses' assert_selector 'd-filter-tabs li:nth-of-type(3) a.active' assert_selector '#courses-table-wrapper tbody tr', count: 4 - find('d-filter-tabs').click_link 'My courses' + find('d-filter-tabs').click_on 'My courses' assert_selector 'd-filter-tabs li:nth-of-type(4) a.active' assert_selector '#courses-table-wrapper tbody tr', count: 1 diff --git a/test/system/feedbacks_test.rb b/test/system/feedbacks_test.rb index 87ebdf9b52..a8e0f2ea06 100644 --- a/test/system/feedbacks_test.rb +++ b/test/system/feedbacks_test.rb @@ -116,7 +116,7 @@ class FeedbacksTest < ApplicationSystemTestCase test 'all zero works' do visit(feedback_path(id: @feedback.id)) - click_button(id: 'zero-button') + click_on(id: 'zero-button') first_input = find(id: "#{@score_item_first.id}-score-form-wrapper").find('.score-input:not(.in-progress)') second_input = find(id: "#{@score_item_second.id}-score-form-wrapper").find('.score-input:not(.in-progress)') @@ -127,7 +127,7 @@ class FeedbacksTest < ApplicationSystemTestCase test 'all max works' do visit(feedback_path(id: @feedback.id)) - click_button(id: 'max-button') + click_on(id: 'max-button') first_input = find(id: "#{@score_item_first.id}-score-form-wrapper").find('.score-input:not(.in-progress)') second_input = find(id: "#{@score_item_second.id}-score-form-wrapper").find('.score-input:not(.in-progress)') diff --git a/test/system/questions_test.rb b/test/system/questions_test.rb index a6ab75629b..9a429eab26 100644 --- a/test/system/questions_test.rb +++ b/test/system/questions_test.rb @@ -27,7 +27,7 @@ class QuestionsTest < ApplicationSystemTestCase test 'Can ask question for each line of the available lines of code' do visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' within '.code-listing' do (1..@code_lines.length).each do |index| @@ -42,7 +42,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_css 'form.annotation-submission' # cancel form to limit page space taken within 'form.annotation-submission' do - click_button 'Cancel' + click_on 'Cancel' end end end @@ -51,10 +51,10 @@ class QuestionsTest < ApplicationSystemTestCase test 'Can ask global question about code' do visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' within '.code-table' do - click_button 'Ask a question about your code' + click_on 'Ask a question about your code' assert_css 'form.annotation-submission' end @@ -62,12 +62,12 @@ class QuestionsTest < ApplicationSystemTestCase test 'Can submit a question' do visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' question = Faker::Lorem.question within '.code-table' do - click_button 'Ask a question about your code' + click_on 'Ask a question about your code' form = find('form.annotation-submission') @@ -76,7 +76,7 @@ class QuestionsTest < ApplicationSystemTestCase text_area.fill_in with: question end - click_button 'Ask question' + click_on 'Ask question' assert_text question # Also acts as sleep until full ajax call is completed @@ -96,7 +96,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_predicate q, :unanswered?, 'Question should start as unanswered' visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') within thread do @@ -120,7 +120,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_predicate q, :unanswered?, 'Question should start as unanswered' visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') within thread do @@ -133,7 +133,7 @@ class QuestionsTest < ApplicationSystemTestCase answer_field = find('textarea') answer_field.fill_in with: answer - click_button 'Reply' + click_on 'Reply' assert_selector '.annotation', count: 2 end @@ -150,7 +150,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_predicate q, :unanswered?, 'Question should start as unanswered' visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') @@ -166,7 +166,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_predicate q, :unanswered?, 'Question should start as unanswered' visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') within thread do @@ -186,7 +186,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_predicate q, :unanswered?, 'Question should start as unanswered' visit(submission_path(id: @submission.id)) - click_link 'Code' + click_on 'Code' thread = find('d-thread') within thread do @@ -197,7 +197,7 @@ class QuestionsTest < ApplicationSystemTestCase assert_selector '.mdi-comment-processing-outline' assert_predicate q.reload, :in_progress?, 'Question should have moved onto in progress status' - click_button 'Cancel' + click_on 'Cancel' assert_selector '.mdi-comment-question-outline' assert_predicate q.reload, :unanswered?, 'Question should have moved onto unanswered status' diff --git a/test/system/saved_annotation_test.rb b/test/system/saved_annotation_test.rb index 3de815612c..e59201e418 100644 --- a/test/system/saved_annotation_test.rb +++ b/test/system/saved_annotation_test.rb @@ -29,7 +29,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase test 'Staff can save an annotation' do sign_in @staff visit(submission_path(id: @first.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -46,7 +46,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase find_by_id('check-save-annotation').check assert_equal 'The first five words of', find_by_id('saved-annotation-title').value - click_button 'Comment' + click_on 'Comment' end within '.annotation' do @@ -60,7 +60,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase test 'Student cannot save an annotation' do sign_in @student visit(submission_path(id: @first.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -71,7 +71,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase find('textarea.annotation-submission-input').fill_in with: initial assert_no_css '#check-save-annotation' - click_button 'Ask question' + click_on 'Ask question' end within '.annotation' do @@ -87,7 +87,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase sa = create :saved_annotation, user: @staff, exercise: @first.exercise, course: @course visit(submission_path(id: @first.id)) - click_link 'Code' + click_on 'Code' find('tr#line-1').hover find('.annotation-button a').click @@ -100,7 +100,7 @@ class SavedAnnotationsTest < ApplicationSystemTestCase assert find_field('annotation-text', with: sa.annotation_text) assert_equal sa.annotation_text, find('textarea.annotation-submission-input').value - click_button 'Comment' + click_on 'Comment' end within '.annotation' do diff --git a/test/system/search_test.rb b/test/system/search_test.rb index 6060b9a2dc..f374e62cf4 100644 --- a/test/system/search_test.rb +++ b/test/system/search_test.rb @@ -56,8 +56,8 @@ def assert_path_with_query(path, **query_params) test 'Going to a page with search does not create an extra history entry' do sign_in create(:zeus) visit root_path - click_button 'Toggle drawer' - click_link 'Exercises' + click_on 'Toggle drawer' + click_on 'Exercises' page.assert_current_path activities_path page.go_back