9356945d93
- 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
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
/**
|
|
* Test data helpers
|
|
*/
|
|
|
|
export const dataHelpers = {
|
|
/**
|
|
* Generate random flight number
|
|
*/
|
|
generateFlightNumber: () => {
|
|
return `SU${Math.floor(Math.random() * 9000 + 1000)}`
|
|
},
|
|
|
|
/**
|
|
* Generate test dates (today, tomorrow, in 7 days)
|
|
*/
|
|
getTestDates: () => {
|
|
const today = new Date()
|
|
const tomorrow = new Date(today)
|
|
tomorrow.setDate(tomorrow.getDate() + 1)
|
|
const weekLater = new Date(today)
|
|
weekLater.setDate(weekLater.getDate() + 7)
|
|
|
|
return {
|
|
today: today.toISOString().split('T')[0],
|
|
tomorrow: tomorrow.toISOString().split('T')[0],
|
|
weekLater: weekLater.toISOString().split('T')[0],
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Get major Russian cities for testing
|
|
*/
|
|
getMajorCities: () => [
|
|
{ code: 'SVO', name: 'Moscow (Sheremetyevo)' },
|
|
{ code: 'LED', name: 'St. Petersburg' },
|
|
{ code: 'AER', name: 'Sochi' },
|
|
{ code: 'VVO', name: 'Vladivostok' },
|
|
{ code: 'SVX', name: 'Ekaterinburg' },
|
|
],
|
|
|
|
/**
|
|
* Store test data in cy.wrap for later use
|
|
*/
|
|
storeData: (key: string, value: any) => {
|
|
cy.wrap({ [key]: value }).as(key)
|
|
},
|
|
}
|