60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
431 lines
12 KiB
TypeScript
431 lines
12 KiB
TypeScript
import { uiHelpers } from '../../support/helpers/ui-helpers'
|
|
import { apiHelpers } from '../../support/helpers/api-helpers'
|
|
import { dataHelpers } from '../../support/helpers/data-helpers'
|
|
|
|
describe('Flight Details - Passenger Information', () => {
|
|
beforeEach(() => {
|
|
cy.visit('http://localhost:3001/flight-details/SU123')
|
|
cy.intercept('GET', '**/api/flights/SU123**', {
|
|
statusCode: 200,
|
|
body: { id: 'SU123', number: 'SU123' },
|
|
}).as('flightDetails')
|
|
cy.wait('@flightDetails')
|
|
})
|
|
|
|
describe('Passenger Count Display', () => {
|
|
it('should display total passenger count', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-count-display').should('be.visible')
|
|
})
|
|
|
|
it('should show breakdown by passenger type', () => {
|
|
// Assert
|
|
cy.getByTestId('adult-passenger-count').should('be.visible')
|
|
cy.getByTestId('child-passenger-count').should('be.visible')
|
|
})
|
|
|
|
it('should display passenger count in header', () => {
|
|
// Assert
|
|
cy.getByTestId('header-passenger-info').should('contain', 'Passenger')
|
|
})
|
|
})
|
|
|
|
describe('Passenger List', () => {
|
|
it('should display list of passengers', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-list').should('be.visible')
|
|
cy.getByTestId('passenger-item').should('have.length.greaterThan', 0)
|
|
})
|
|
|
|
it('should show passenger name', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('passenger-name').should('be.visible')
|
|
})
|
|
})
|
|
|
|
it('should show passenger type badge', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('passenger-type-badge').should('be.visible')
|
|
})
|
|
})
|
|
|
|
it('should show passenger seat assignment', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('passenger-seat').should('be.visible')
|
|
})
|
|
})
|
|
|
|
it('should show passenger document info', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('passenger-document').should('be.visible')
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('Passenger Details', () => {
|
|
it('should expand passenger details on click', () => {
|
|
// Act
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-details-expanded').should('be.visible')
|
|
})
|
|
|
|
it('should show full name', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-full-name').should('be.visible')
|
|
})
|
|
|
|
it('should show date of birth', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-dob').should('be.visible')
|
|
})
|
|
|
|
it('should show nationality', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-nationality').should('be.visible')
|
|
})
|
|
|
|
it('should show contact information', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-email').should('be.visible')
|
|
cy.getByTestId('passenger-phone').should('be.visible')
|
|
})
|
|
|
|
it('should show special needs', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('special-needs-info').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Passenger Seat Information', () => {
|
|
it('should display assigned seat', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('seat-number').should('be.visible')
|
|
})
|
|
})
|
|
|
|
it('should show seat class', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('seat-class').should('be.visible')
|
|
})
|
|
})
|
|
|
|
it('should show seat amenities', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('seat-amenities-list').should('be.visible')
|
|
})
|
|
|
|
it('should allow seat change', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Act
|
|
cy.getByTestId('change-seat-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('seat-map-modal').should('be.visible')
|
|
})
|
|
|
|
it('should show extra legroom availability', () => {
|
|
// Assert
|
|
cy.getByTestId('extra-legroom-badge').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Passenger Services & Baggage', () => {
|
|
it('should display included baggage', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('included-baggage').should('be.visible')
|
|
})
|
|
|
|
it('should show option to add extra baggage', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Act
|
|
cy.getByTestId('add-baggage-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('baggage-options').should('be.visible')
|
|
})
|
|
|
|
it('should display seat services', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('seat-services-list').should('be.visible')
|
|
})
|
|
|
|
it('should allow meal selection', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Act
|
|
cy.getByTestId('select-meal-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('meal-options').should('be.visible')
|
|
})
|
|
|
|
it('should show insurance options', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('insurance-options').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Frequent Flyer Information', () => {
|
|
it('should display frequent flyer number', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('frequent-flyer-number').should('be.visible')
|
|
})
|
|
|
|
it('should show points balance', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('ff-points-balance').should('be.visible')
|
|
})
|
|
|
|
it('should show elite status', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('elite-status-badge').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Special Requirements', () => {
|
|
it('should display special needs information', () => {
|
|
// Assert
|
|
cy.getByTestId('special-requirements-section').should('be.visible')
|
|
})
|
|
|
|
it('should show mobility assistance options', () => {
|
|
// Assert
|
|
cy.getByTestId('mobility-assistance-checkbox').should('be.visible')
|
|
})
|
|
|
|
it('should show unaccompanied minor info', () => {
|
|
// Assert
|
|
cy.getByTestId('unaccompanied-minor-badge').should('be.visible')
|
|
})
|
|
|
|
it('should allow adding special requests', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Act
|
|
cy.getByTestId('add-special-request-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('special-request-input').should('be.visible')
|
|
})
|
|
|
|
it('should display dietary requirements', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('dietary-requirements').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Document Information', () => {
|
|
it('should display document type', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('document-type').should('be.visible')
|
|
})
|
|
|
|
it('should show document number', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('document-number').should('be.visible')
|
|
})
|
|
|
|
it('should show document expiry', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('document-expiry').should('be.visible')
|
|
})
|
|
|
|
it('should show issuing country', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('document-issuing-country').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Passenger List Actions', () => {
|
|
it('should allow adding new passenger', () => {
|
|
// Act
|
|
cy.getByTestId('add-passenger-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('add-passenger-form').should('be.visible')
|
|
})
|
|
|
|
it('should allow removing passenger', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('remove-passenger-button').should('be.visible')
|
|
})
|
|
|
|
// Act
|
|
cy.getByTestId('passenger-item').first().within(() => {
|
|
cy.getByTestId('remove-passenger-button').click()
|
|
})
|
|
|
|
// Assert
|
|
cy.getByTestId('confirm-removal-modal').should('be.visible')
|
|
})
|
|
|
|
it('should allow editing passenger info', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Act
|
|
cy.getByTestId('edit-passenger-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('edit-passenger-form').should('be.visible')
|
|
})
|
|
|
|
it('should show passenger contact info', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-email').should('be.visible')
|
|
cy.getByTestId('passenger-phone').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Passenger Summary', () => {
|
|
it('should display passenger summary section', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-summary').should('be.visible')
|
|
})
|
|
|
|
it('should show total passengers', () => {
|
|
// Assert
|
|
cy.getByTestId('summary-total-passengers').should('be.visible')
|
|
})
|
|
|
|
it('should show adults count', () => {
|
|
// Assert
|
|
cy.getByTestId('summary-adults-count').should('be.visible')
|
|
})
|
|
|
|
it('should show children count', () => {
|
|
// Assert
|
|
cy.getByTestId('summary-children-count').should('be.visible')
|
|
})
|
|
|
|
it('should show infants count', () => {
|
|
// Assert
|
|
cy.getByTestId('summary-infants-count').should('be.visible')
|
|
})
|
|
|
|
it('should calculate total fees for passengers', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-fees-total').should('be.visible')
|
|
})
|
|
})
|
|
|
|
describe('Accessibility', () => {
|
|
it('should have proper list structure', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-list').should('have.attr', 'role', 'list')
|
|
cy.getByTestId('passenger-item').each($item => {
|
|
cy.wrap($item).should('have.attr', 'role', 'listitem')
|
|
})
|
|
})
|
|
|
|
it('should support keyboard navigation', () => {
|
|
// Act
|
|
cy.getByTestId('passenger-item').first().focus()
|
|
cy.getByTestId('passenger-item').first().type('{enter}')
|
|
|
|
// Assert
|
|
cy.getByTestId('passenger-details-expanded').should('be.visible')
|
|
})
|
|
|
|
it('should announce passenger information', () => {
|
|
// Assert
|
|
cy.getByTestId('passenger-list').should('have.attr', 'aria-label')
|
|
})
|
|
})
|
|
|
|
describe('Error Handling', () => {
|
|
it('should handle missing passenger data', () => {
|
|
// Arrange
|
|
cy.intercept('GET', '**/api/passengers/**', {
|
|
statusCode: 500,
|
|
body: { error: 'Failed to load passenger data' },
|
|
}).as('passengerError')
|
|
|
|
// Assert
|
|
cy.getByTestId('error-message').should('be.visible')
|
|
})
|
|
|
|
it('should show validation error on save', () => {
|
|
// Arrange
|
|
cy.getByTestId('passenger-item').first().click()
|
|
cy.getByTestId('edit-passenger-button').click()
|
|
|
|
// Act
|
|
cy.getByTestId('passenger-name-input').clear()
|
|
cy.getByTestId('save-passenger-button').click()
|
|
|
|
// Assert
|
|
cy.getByTestId('validation-error').should('be.visible')
|
|
})
|
|
})
|
|
})
|