Make/Model Data Loading

This commit is contained in:
Eric Gullickson
2025-11-07 13:51:47 -06:00
parent 060867e796
commit daf1f71e2c
11 changed files with 817 additions and 97 deletions

View File

@@ -16,6 +16,13 @@ describe('Gas Stations Feature', () => {
cy.visit('/stations');
});
const enterSampleAddress = () => {
cy.get('input[name="street"]').clear().type('123 Main St');
cy.get('input[name="city"]').clear().type('San Francisco');
cy.get('select[name="state"]').select('CA');
cy.get('input[name="zip"]').clear().type('94105');
};
describe('Search for Nearby Stations', () => {
it('should allow searching with current location', () => {
// Mock geolocation
@@ -42,10 +49,9 @@ describe('Gas Stations Feature', () => {
cy.contains('Shell').or('Chevron').or('76').or('Exxon').should('be.visible');
});
it('should allow searching with manual coordinates', () => {
// Enter manual coordinates
cy.get('input[name="latitude"]').clear().type('37.7749');
cy.get('input[name="longitude"]').clear().type('-122.4194');
it('should allow searching with a manual address', () => {
// Enter manual address fields
enterSampleAddress();
// Adjust radius
cy.get('[data-testid="radius-slider"]').click();
@@ -57,16 +63,12 @@ describe('Gas Stations Feature', () => {
cy.get('[data-testid="station-card"]').should('exist');
});
it('should handle search errors gracefully', () => {
// Enter invalid coordinates
cy.get('input[name="latitude"]').clear().type('999');
cy.get('input[name="longitude"]').clear().type('999');
// Search
it('should require address details when location is unavailable', () => {
// Attempt to search without address or geolocation
cy.contains('button', 'Search').click();
// Verify error message
cy.contains('error', { matchCase: false }).should('be.visible');
cy.contains('Enter Street, City, State, and ZIP', { matchCase: false }).should('be.visible');
});
it('should display loading state during search', () => {
@@ -85,8 +87,7 @@ describe('Gas Stations Feature', () => {
describe('View Stations on Map', () => {
beforeEach(() => {
// Perform a search first
cy.get('input[name="latitude"]').clear().type('37.7749');
cy.get('input[name="longitude"]').clear().type('-122.4194');
enterSampleAddress();
cy.contains('button', 'Search').click();
cy.wait(2000);
});
@@ -122,8 +123,7 @@ describe('Gas Stations Feature', () => {
describe('Save Station to Favorites', () => {
beforeEach(() => {
// Search first
cy.get('input[name="latitude"]').clear().type('37.7749');
cy.get('input[name="longitude"]').clear().type('-122.4194');
enterSampleAddress();
cy.contains('button', 'Search').click();
cy.wait(1000);
});