Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Jan 9, 2024
1 parent 5afb5e9 commit d14ba2f
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Style/HashSyntax:

FactoryBot/ConsistentParenthesesStyle:
EnforcedStyle: omit_parentheses
FactoryBot/ExcessiveCreateList:
MaxAmount: 50

Minitest/MultipleAssertions:
Enabled: false
78 changes: 39 additions & 39 deletions test/system/annotations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ 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
end

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|
Expand All @@ -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
Expand All @@ -74,15 +74,15 @@ 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

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
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -265,34 +265,34 @@ 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

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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/system/courses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/system/feedbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand All @@ -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)')
Expand Down
Loading

0 comments on commit d14ba2f

Please sign in to comment.