1 require "application_system_test_case"
3 class IndexTest < ApplicationSystemTestCase
4 test "should remove and add an overlay on share button click" do
7 assert_selector "#content.overlay-right-sidebar"
8 find(".icon.share").click
9 assert_no_selector "#content.overlay-right-sidebar"
10 find(".icon.share").click
11 assert_selector "#content.overlay-right-sidebar"
14 test "should add an overlay on close" do
17 find(".icon.share").click
18 assert_no_selector "#content.overlay-right-sidebar"
19 find(".share-ui .btn-close").click
20 assert_selector "#content.overlay-right-sidebar"
23 test "should not add overlay when not closing right menu popup" do
26 find(".icon.share").click
28 find(".icon.key").click
29 assert_no_selector "#content.overlay-right-sidebar"
30 find(".icon.layers").click
31 assert_no_selector "#content.overlay-right-sidebar"
32 find(".icon.key").click
33 assert_no_selector "#content.overlay-right-sidebar"
35 find(".icon.key").click
36 assert_selector "#content.overlay-right-sidebar"
39 test "node included in edit link" do
42 assert_selector "#editanchor[href*='?node=#{node.id}#']"
44 find("#sidebar .btn-close").click
45 assert_no_selector "#editanchor[href*='?node=#{node.id}#']"
48 test "note included in edit link" do
49 note = create(:note_with_comments)
51 assert_selector "#editanchor[href*='?note=#{note.id}#']"
53 find("#sidebar .btn-close").click
54 assert_no_selector "#editanchor[href*='?note=#{note.id}#']"
57 test "can navigate from hidden note to visible note" do
58 sign_in_as(create(:moderator_user))
59 hidden_note = create(:note, :status => "hidden")
60 create(:note_comment, :note => hidden_note, :body => "this-is-a-hidden-note")
61 position = (1.003 * GeoRecord::SCALE).to_i
62 visible_note = create(:note, :latitude => position, :longitude => position)
63 create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note")
65 visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during note_path(hidden_note)
66 visit note_path(hidden_note)
67 find(".leaflet-control.control-layers .control-button").click
68 find("#map-ui .overlay-layers .form-check-label", :text => "Map Notes").click
69 visible_note_marker = find(".leaflet-marker-icon[title=this-is-a-visible-note]")
70 assert_selector "#sidebar", :text => "this-is-a-hidden-note"
72 visible_note_marker.click
73 assert_selector "#sidebar", :text => "this-is-a-visible-note"