Files
flights_web_raw/e2e/cypress/integration/base.spec.ts
T
gnezim 9356945d93 Task 10: Create test helper files and base test templates
- Create helpers directory structure
- Add api-helpers.ts with authentication and API mocking functions
- Add ui-helpers.ts with common UI interaction utilities
- Add data-helpers.ts with test data generators
- Create base.spec.ts as reusable test template
- Update support/index.ts to import and expose helper modules globally
2026-04-05 19:19:49 +03:00

41 lines
1.0 KiB
TypeScript

/**
* Base test template for all feature tests
* Copy this file and modify for each feature area
*/
import { uiHelpers } from '../support/helpers/ui-helpers'
import { apiHelpers } from '../support/helpers/api-helpers'
import { dataHelpers } from '../support/helpers/data-helpers'
describe('Feature: [Feature Name]', () => {
beforeEach(() => {
// Navigate to app
cy.visit('http://localhost:3001')
// Mock API responses
apiHelpers.mockFlightSearch()
// Get test data
const dates = dataHelpers.getTestDates()
})
afterEach(() => {
// Clear localStorage (handled by support/index.ts)
})
describe('Scenario: User interaction', () => {
it('should perform action and verify result', () => {
// Arrange
// Setup is in beforeEach
// Act
uiHelpers.fillInput('test-input', 'test-value')
uiHelpers.clickAndWait('submit-button', 'flightSearch')
// Assert
uiHelpers.isVisible('results')
uiHelpers.hasText('results', 'expected-text')
})
})
})