Files
flights_web_raw/e2e/cypress/support/commands.ts
T
gnezim e0c989755e Fix code quality issues in E2E Cypress infrastructure
- Fix specPattern in cypress.config.ts: change from '*.cy.ts' to '*.spec.ts' to match actual test file naming convention
- Fix forbidGeolocation command: use callsFake() instead of rejects() which is not a valid Cypress stub method
- Remove redundant localStorage cleanup: keep only afterEach hook, remove beforeEach hook to avoid duplication
- Remove unused @cypress/schematic dependency from e2e/package.json
- Add comprehensive README.md with E2E testing documentation covering test structure, setup, running tests, custom commands, and best practices
2026-04-05 19:09:43 +03:00

27 lines
621 B
TypeScript

/// <reference types="cypress" />
Cypress.Commands.add('getByTestId', (id: string, timeout = 8000) => {
return cy.get(`[data-testid="${id}"]`, { timeout })
})
Cypress.Commands.add('forbidGeolocation', () => {
cy.window().then(win => {
cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake(
(success, error) => {
error(new GeolocationPositionError())
}
)
})
})
declare global {
namespace Cypress {
interface Chainable {
getByTestId(id: string, timeout?: number): Chainable<JQuery<HTMLElement>>
forbidGeolocation(): Chainable<void>
}
}
}
export {}