test: strengthen Cypress e2e tests with real API assertions

- Remove blanket uncaught:exception suppressor (API-only tests)
- Trim smoke test to single infra-verification assertion
- Rewrite health test with strict status/field assertions, no failOnStatusCode
- Add session CRUD tests (create, get, list, delete, 404 cases, cleanup)
- Use Cypress.env('API_URL') instead of baseUrl to avoid blocking smoke tests
- Remove unused main and type fields from package.json
This commit is contained in:
2026-02-15 23:57:48 +01:00
parent 991080ae2b
commit 217d41d680
5 changed files with 116 additions and 80 deletions

View File

@@ -1,30 +1,21 @@
/// <reference types="cypress" />
describe('Session Manager API', () => {
describe('Health Check', () => {
it('should respond to the health endpoint', () => {
cy.request({
method: 'GET',
url: '/api/health',
failOnStatusCode: false,
}).then((response) => {
// The endpoint should exist and return a response
expect(response.status).to.be.oneOf([200, 503]);
expect(response.body).to.be.an('object');
});
});
});
const api = () => Cypress.env('API_URL');
describe('Sessions API', () => {
it('should list sessions', () => {
cy.request({
method: 'GET',
url: '/api/sessions',
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.be.an('object');
});
describe('Health API', () => {
it('GET /api/health returns status and required fields', () => {
cy.request(`${api()}/api/health`).then((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.have.property('status');
expect(response.body.status).to.be.oneOf([
'healthy',
'degraded',
'unhealthy',
]);
expect(response.body).to.have.property('docker');
expect(response.body).to.have.property('active_sessions');
expect(response.body).to.have.property('timestamp');
expect(response.body).to.have.property('resource_limits');
});
});
});