]> git.openstreetmap.org Git - rails.git/blob - test/system/manage_moderation_zones_test.rb
Merge remote-tracking branch 'upstream/pull/7318'
[rails.git] / test / system / manage_moderation_zones_test.rb
1 # frozen_string_literal: true
2
3 require "application_system_test_case"
4
5 class ManageModerationZones < ApplicationSystemTestCase
6   test "Create a moderation zone and fail to put an anonymous note within it" do
7     sign_in_as(create(:moderator_user))
8
9     visit moderation_zones_path
10     click_on "New Moderation Zone"
11
12     fill_in "Name", :with => "Test zone"
13     fill_in "Reason", :with => "He's a very naughty boy"
14
15     map = find_by_id("map")
16     map.click(:offset => :center, :x => -50, :y => -50)
17     map.click(:offset => :center, :x =>   0, :y => -50)
18     map.click(:offset => :center, :x =>   0, :y =>   0)
19     map.click(:offset => :center, :x => -50, :y =>   0)
20     map.click(:offset => :center, :x => -50, :y => -50)
21
22     select "1 week", :from => :moderation_zone_period
23     click_on "Create Moderation zone"
24     assert_content "Moderation zone created"
25
26     sign_out
27     visit new_note_path(:anchor => "map=18/7.15/-9.23")
28     within_sidebar do
29       fill_in "text", :with => "Hahaha! Nobody expects the Spanish anonymous notes!"
30       click_on "Add Note"
31
32       assert_content "There was an error when creating the note"
33     end
34   end
35 end