test: add initial Cypress e2e test infrastructure
Smoke tests for verifying Cypress runs, plus basic API tests for health and sessions endpoints.
This commit is contained in:
30
cypress/e2e/api/health.cy.js
Normal file
30
cypress/e2e/api/health.cy.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/// <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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
58
cypress/e2e/smoke.cy.js
Normal file
58
cypress/e2e/smoke.cy.js
Normal file
@@ -0,0 +1,58 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
/**
|
||||
* Smoke test to verify that the Cypress test infrastructure is
|
||||
* correctly installed and configured. These tests do NOT require
|
||||
* the lovdata-chat stack to be running.
|
||||
*/
|
||||
describe('Cypress Infrastructure Smoke Test', () => {
|
||||
it('should execute a basic assertion', () => {
|
||||
expect(true).to.be.true;
|
||||
});
|
||||
|
||||
it('should handle arrays and objects', () => {
|
||||
const session = {
|
||||
id: 'test-session-001',
|
||||
status: 'running',
|
||||
model: 'opencode/kimi-k2.5-free',
|
||||
};
|
||||
|
||||
expect(session).to.have.property('id');
|
||||
expect(session.status).to.eq('running');
|
||||
expect(session.model).to.include('kimi');
|
||||
});
|
||||
|
||||
it('should validate the allowed models whitelist structure', () => {
|
||||
const allowedModels = [
|
||||
{
|
||||
id: 'opencode/kimi-k2.5-free',
|
||||
display_name: 'Kimi K2.5',
|
||||
provider: 'zen',
|
||||
is_reasoning: false,
|
||||
is_default: true,
|
||||
},
|
||||
{
|
||||
id: 'anthropic/claude-sonnet-4-thinking',
|
||||
display_name: 'Claude Sonnet 4 (Thinking)',
|
||||
provider: 'zen',
|
||||
is_reasoning: true,
|
||||
thinking_budget_default: 10000,
|
||||
thinking_budget_max: 50000,
|
||||
},
|
||||
];
|
||||
|
||||
expect(allowedModels).to.have.length(2);
|
||||
|
||||
const defaultModel = allowedModels.find((m) => m.is_default);
|
||||
expect(defaultModel).to.exist;
|
||||
expect(defaultModel.id).to.eq('opencode/kimi-k2.5-free');
|
||||
|
||||
const reasoningModels = allowedModels.filter((m) => m.is_reasoning);
|
||||
expect(reasoningModels).to.have.length(1);
|
||||
expect(reasoningModels[0]).to.have.property('thinking_budget_default');
|
||||
expect(reasoningModels[0]).to.have.property('thinking_budget_max');
|
||||
expect(reasoningModels[0].thinking_budget_max).to.be.greaterThan(
|
||||
reasoningModels[0].thinking_budget_default
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user