Füge Cypress Konfiguration und Testumgebung hinzu
- Fügt cypress.config.ts für E2E und Komponenten Tests hinzu - Fügt Cypress Testskripte und Docker-Compose Konfiguration hinzu - Ermöglicht automatische E2E-Tests mit separater Testumgebung 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
33
packages/reservation-platform/cypress/support/commands.ts
Normal file
33
packages/reservation-platform/cypress/support/commands.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
// -- This is a parent command --
|
||||
Cypress.Commands.add('login', () => {
|
||||
// Simulate logged in user without OAuth
|
||||
window.localStorage.setItem('myp:user', JSON.stringify({
|
||||
id: 'test-user-id',
|
||||
name: 'Test User',
|
||||
email: 'test@example.com',
|
||||
role: 'user'
|
||||
}))
|
||||
})
|
||||
|
||||
// -- This is a child command --
|
||||
Cypress.Commands.add('createPrintJob', (printerId, duration) => {
|
||||
cy.intercept('POST', `/api/printers/${printerId}/reserve`, {
|
||||
id: 'test-job-id',
|
||||
printerId,
|
||||
userId: 'test-user-id',
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + duration * 60000).toISOString(),
|
||||
status: 'active'
|
||||
}).as('createJob')
|
||||
|
||||
return cy.wrap('test-job-id')
|
||||
})
|
||||
|
||||
declare global {
|
||||
namespace Cypress {
|
||||
interface Chainable {
|
||||
login(): Chainable<void>
|
||||
createPrintJob(printerId: string, duration: number): Chainable<string>
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user