Skip to content

Commit

Permalink
Undo link rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Jan 30, 2024
1 parent 95df238 commit 7b2f472
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 102 deletions.
104 changes: 26 additions & 78 deletions test/system/annotations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,15 @@ def new_submission

test 'Navigate to code tab' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
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))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within '.code-listing' do
(1..@code_lines.length).each do |index|
Expand All @@ -68,9 +64,7 @@ def new_submission

test 'Click on submission annotation button' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -85,9 +79,7 @@ def new_submission

test 'Enter annotation and send' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -107,9 +99,7 @@ def new_submission

test 'Character counter updates when typing' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -126,9 +116,7 @@ def new_submission

test 'Cancel annotation form' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -144,9 +132,7 @@ def new_submission
annot = create :annotation, submission: @instance, user: @zeus

visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within '.annotation' do
assert_text annot.annotation_text
Expand All @@ -173,9 +159,7 @@ def new_submission
annot = create :annotation, submission: @instance, user: @zeus

visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within '.annotation' do
assert_text annot.annotation_text
Expand All @@ -192,30 +176,22 @@ def new_submission

test 'User moving back and forth over code and tests' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

click_on 'Echo'
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

annot = create :annotation, submission: @instance, user: @zeus
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
assert_text annot.annotation_text
end

click_on 'Echo'
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -226,9 +202,7 @@ def new_submission
test 'Edit valid annotation -- Too large input text' do
annot = create :annotation, submission: @instance, user: @zeus
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -255,9 +229,7 @@ def new_submission
test 'Edit valid annotation -- Zero length input text' do
annot = create :annotation, submission: @instance, user: @zeus
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand Down Expand Up @@ -286,9 +258,7 @@ def new_submission

# After reload, make sure no replacing has taken place
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -300,9 +270,7 @@ def new_submission

test 'Enter invalid annotation and send - No content' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -322,18 +290,14 @@ def new_submission

# After reload, make sure no creation has taken place
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
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))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

find('tr#line-1').hover
find('.annotation-button a').click
Expand All @@ -351,9 +315,7 @@ def new_submission

test 'Enter global annotation' do
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

click_on 'Add global comment'

Expand All @@ -371,9 +333,7 @@ def new_submission

# After reload, make sure creation has taken place
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -385,9 +345,7 @@ def new_submission
test 'Edit global annotation' do
annot = create :annotation, submission: @instance, user: @zeus, line_nr: nil
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -410,9 +368,7 @@ def new_submission

# After reload, make sure creation has taken place
visit(submission_path(id: @instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

assert_selector '.annotation', count: 1
within '.annotation' do
Expand All @@ -425,9 +381,7 @@ def new_submission
instance = new_submission
create :annotation, submission: instance, user: @zeus
visit(submission_path(id: instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')
within thread do
Expand All @@ -451,9 +405,7 @@ def new_submission
annot = create :annotation, submission: instance, user: @zeus
create :annotation, submission: instance, user: @zeus, thread_root: annot
visit(submission_path(id: instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within 'd-thread' do
assert_selector '.annotation', count: 2
Expand All @@ -471,9 +423,7 @@ def new_submission
annot = create :annotation, submission: instance, user: @zeus
create :annotation, submission: instance, user: @zeus, thread_root: annot
visit(submission_path(id: instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within 'd-thread' do
assert_selector '.annotation', count: 2
Expand All @@ -499,9 +449,7 @@ def new_submission
create :annotation, submission: instance, user: @zeus, thread_root: annot
create :annotation, submission: instance, user: @zeus, thread_root: annot
visit(submission_path(id: instance.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within 'd-thread' do
assert_selector '.annotation', count: 3
Expand Down
32 changes: 8 additions & 24 deletions test/system/questions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def new_submission

test 'Can ask question for each line of the available lines of code' do
visit(submission_path(id: @submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within '.code-listing' do
(1..@code_lines.length).each do |index|
Expand All @@ -58,9 +56,7 @@ def new_submission

test 'Can ask global question about code' do
visit(submission_path(id: @submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

within '.code-table' do
click_on 'Ask a question about your code'
Expand All @@ -72,9 +68,7 @@ def new_submission
test 'Can submit a question' do
submission = new_submission
visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

question = Faker::Lorem.question

Expand Down Expand Up @@ -109,9 +103,7 @@ def new_submission
assert_predicate q, :unanswered?, 'Question should start as unanswered'

visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')
within thread do
Expand All @@ -136,9 +128,7 @@ def new_submission
assert_predicate q, :unanswered?, 'Question should start as unanswered'

visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')
within thread do
Expand Down Expand Up @@ -169,9 +159,7 @@ def new_submission
assert_predicate q, :unanswered?, 'Question should start as unanswered'

visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')

Expand All @@ -188,9 +176,7 @@ def new_submission
assert_predicate q, :unanswered?, 'Question should start as unanswered'

visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')
within thread do
Expand All @@ -211,9 +197,7 @@ def new_submission
assert_predicate q, :unanswered?, 'Question should start as unanswered'

visit(submission_path(id: submission.id))
find('body')
find_by_id('page-wrapper')
find_by_id('link-to-code-tab').click
click_on 'Code'

thread = find('d-thread')
within thread do
Expand Down

0 comments on commit 7b2f472

Please sign in to comment.