Skip to content

Commit

Permalink
test for clearing out address field and searching again
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Jan 5, 2025
1 parent 287e59e commit 9b57c7f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/features/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
it 'lets you search by address and machine and respects if you change or clear out the machine search value' do
rip_city_location = FactoryBot.create(:location, region: nil, name: 'Rip City', zip: '97203', lat: 45.590502800000, lon: -122.754940100000)
no_way_location = FactoryBot.create(:location, region: nil, name: 'No Way', zip: '97203', lat: 45.593049200000, lon: -122.732620200000)
FactoryBot.create(:location, region: nil, name: 'Far Off', city: 'Seattle', state: 'WA', zip: '98121', lat: 47.61307324803172, lon: -122.34479886878611)
FactoryBot.create(:location_machine_xref, location: rip_city_location, machine: FactoryBot.create(:machine, name: 'Sass'))
FactoryBot.create(:location_machine_xref, location: no_way_location, machine: FactoryBot.create(:machine, name: 'Bawb'))

Expand Down Expand Up @@ -90,6 +91,26 @@

expect(page.body).to have_content('Rip City')
expect(page.body).to have_content('No Way')

fill_in('address', with: 'Seattle')
page.execute_script %{ $('#address').trigger('focus') }
page.execute_script %{ $('#address').trigger('keydown') }
find(:xpath, '//div[contains(text(), "Seattle, WA")]').click

click_on 'location_search_button'

sleep 0.5

expect(page.body).to have_content('Far Off')

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

click_on 'location_search_button'

sleep 1

expect(page.body).to have_content('Rip City')
expect(page.body).to have_content('No Way')
end

it 'lets you filter by location type and number of machines with address and machine name' do
Expand Down

0 comments on commit 9b57c7f

Please sign in to comment.