]> git.openstreetmap.org Git - rails.git/commitdiff
Test that encouragement appears after 10 anonymous notes
authorAnton Khorev <tony29@yandex.ru>
Mon, 13 Jan 2025 10:27:15 +0000 (13:27 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 13 Jan 2025 12:03:58 +0000 (15:03 +0300)
test/system/create_note_test.rb

index 5688ec37601dc28ad3d6d3913142317ac8291c3c..04f895219bd4c5751e5eb906087748317d9edbe2 100644 (file)
@@ -78,4 +78,27 @@ class CreateNoteTest < ApplicationSystemTestCase
       end
     end
   end
       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
 end