Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cypress/e2e/desktop/siteInfo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For each resource type, test each site detail permutation and confirm only the expected number of taps appear.
describe('site info', () => {
beforeEach(() => {
cy.mockGeolocationToCityHall();
cy.visit('/');
});

Expand Down Expand Up @@ -34,7 +35,17 @@ describe('site info', () => {
});

it('should successfully display a foraging site', () => {
// TODO
// Switch to foraging view
cy.get('[data-cy=button-resource-type-menu]').click()
cy.get('[data-cy=button-FORAGE-data-selector]').click()
cy.get('[data-cy=button-resource-type-menu]').click()

// Wait for specific foraging marker to be visible
cy.get('[title^="data-cy-"]').should('be.visible').first().click();

// Verify that the info window appears with location name
cy.get('[data-cy=tap-organization-name]').should('exist');
cy.get('[data-cy=tap-organization-name]').invoke('text').should('not.be.empty');
});

it('should successfully display a bathroom site', () => {
Expand Down
16 changes: 16 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

// Mock geolocation to Philadelphia City Hall coordinates
// Ensures consistent test behavior regardless of tester's actual location
Cypress.Commands.add('mockGeolocationToCityHall', () => {
cy.window().then((win) => {
cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake((success) => {
success({
coords: {
latitude: 39.952744,
longitude: -75.1635,
accuracy: 10
}
});
});
});
});
60 changes: 60 additions & 0 deletions public/testData.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,5 +486,65 @@
},
"version": 1,
"zip_code": "19149"
},
{
"address": "4400 Haverford Avenue",
"city": "Philadelphia",
"creator": "phlask",
"date_created": "2024-03-31T00:22:50.797447+00:00",
"description": "Community garden with seasonal fruits and herbs",
"entry_type": "UNSURE",
"last_modified": "2024-03-31T00:22:57.797447+00:00",
"last_modifier": "phlask",
"latitude": 39.95322480084546,
"longitude": -75.1646224595513,
"name": "Test Organization",
"resource_type": "FORAGE",
"source": {
"type": "MIGRATION"
},
"state": "PA",
"status": "OPERATIONAL",
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"forage": {
"forage_type": ["FRUIT", "LEAVES"],
"tags": ["IN_SEASON", "COMMUNITY_GARDEN"]
},
"zip_code": "19104"
},
{
"address": "4401 Haverford Avenue",
"city": "Philadelphia",
"creator": "phlask",
"date_created": "2024-03-31T00:22:51.797447+00:00",
"description": "Wild nut trees and medicinal plants",
"entry_type": "UNSURE",
"last_modified": "2024-03-31T00:22:57.797447+00:00",
"last_modifier": "phlask",
"latitude": 39.95307591197137,
"longitude": -75.16292738387706,
"name": "Test Foraging Site",
"resource_type": "FORAGE",
"source": {
"type": "MIGRATION"
},
"state": "PA",
"status": "OPERATIONAL",
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"forage": {
"forage_type": ["NUT", "BARK", "FLOWERS"],
"tags": ["MEDICINAL"]
},
"zip_code": "19104"
}
]