Skip to content

Commit

Permalink
Partial test for nearby activity
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Jan 11, 2025
1 parent fde07e5 commit 4e2c982
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,8 @@ input.single_hide {
}

#nearby_activity_button {
background: var(--red);
color: var(--white);
top: 140px;
}

Expand Down
28 changes: 28 additions & 0 deletions spec/features/maps_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,33 @@
expect(find('#search_results')).to_not have_content('Clark')
expect(find('#search_results')).to_not have_content('Renee')
end

it 'nearby activity button should return the nearby activity' do
@location = FactoryBot.create(:location, lat: '45.6008356', lon: '-122.760606', city: 'Portland', zip: '97203', name: "Clark's Depot")
@distant_location = FactoryBot.create(:location, lat: '12.6008356', lon: '-12.760606', city: 'Hillsboro', zip: '97005', name: "Ripley's Hut")

FactoryBot.create(:user_submission, created_at: '2025-01-02', location: @location, location_name: @location.name, user_name: 'ssw', machine_name: 'Sassy Madness', submission_type: UserSubmission::NEW_LMX_TYPE)
FactoryBot.create(:user_submission, created_at: '2025-01-03', location: @distant_location, location_name: @distant_location.name, user_name: 'ssw', machine_name: 'Pizza Attack', submission_type: UserSubmission::REMOVE_MACHINE_TYPE)

visit '/map'

fill_in('address', with: '97203')

click_on 'location_search_button'

sleep 1

expect(page).to have_content('Nearby activity')

# Placeholder: map.getCenter() doesn't work in tests because the map doesn't load

# find('#nearby_activity_button').click

# sleep 0.5

# expect(page).to have_content('1 recent map edits in the nearby area')
# expect(page).to have_content("added to Clark's Depot")
# expect(page).to_not have_content("removed from Ripley's Hut")
end
end
end

0 comments on commit 4e2c982

Please sign in to comment.