From f745cae93be59e1adf57c52af3285ca3beba07ca Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 13 Jan 2025 13:27:15 +0300 Subject: [PATCH] Test that encouragement appears after 10 anonymous notes --- test/system/create_note_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/system/create_note_test.rb b/test/system/create_note_test.rb index 5688ec376..04f895219 100644 --- a/test/system/create_note_test.rb +++ b/test/system/create_note_test.rb @@ -78,4 +78,27 @@ class CreateNoteTest < ApplicationSystemTestCase end end end + + test "encouragement to contribute appears after 10 created notes" do + encouragement_threshold = 10 + + encouragement_threshold.times do |n| + visit new_note_path(:anchor => "map=16/0/#{0.001 * n}") + + within_sidebar do + assert_no_content(/already posted at least \d+ anonymous note/) + + fill_in "text", :with => "new note ##{n + 1}" + click_on "Add Note" + + assert_content "new note ##{n + 1}" + end + end + + visit new_note_path(:anchor => "map=16/0/#{0.001 * encouragement_threshold}") + + within_sidebar do + assert_content(/already posted at least #{encouragement_threshold} anonymous note/) + end + end end -- 2.39.5