From 7b2f4725252499f7d8f9b51efb777c481c48684c Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 30 Jan 2024 14:02:14 +0100 Subject: [PATCH] Undo link rename --- test/system/annotations_test.rb | 104 ++++++++------------------------ test/system/questions_test.rb | 32 +++------- 2 files changed, 34 insertions(+), 102 deletions(-) diff --git a/test/system/annotations_test.rb b/test/system/annotations_test.rb index d94b92ea92..06a6db9285 100644 --- a/test/system/annotations_test.rb +++ b/test/system/annotations_test.rb @@ -42,9 +42,7 @@ 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 @@ -52,9 +50,7 @@ def new_submission 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| @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -192,20 +176,14 @@ 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 @@ -213,9 +191,7 @@ def new_submission 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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' @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/system/questions_test.rb b/test/system/questions_test.rb index 80632639df..0ded8625a7 100644 --- a/test/system/questions_test.rb +++ b/test/system/questions_test.rb @@ -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| @@ -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' @@ -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 @@ -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 @@ -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 @@ -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') @@ -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 @@ -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