b7f52be4c9
CI / Run CI (push) Blocked by required conditions
Copilot Setup Steps / copilot-setup-steps (push) Waiting to run
CI / check-backend (push) Has started running
CI / check-frontend (push) Has started running
CI / tests (push) Has started running
CI / e2e-tests (push) Has started running
79 lines
1.8 KiB
TypeScript
79 lines
1.8 KiB
TypeScript
import { defineConfig } from 'cypress';
|
|
import cypressSplit from 'cypress-split';
|
|
import fkill from 'fkill';
|
|
|
|
import { runChainlit } from './cypress/support/run';
|
|
|
|
export const CHAINLIT_APP_PORT = 8000;
|
|
|
|
async function killChainlit() {
|
|
await fkill(`:${CHAINLIT_APP_PORT}`, {
|
|
force: true,
|
|
silent: true
|
|
});
|
|
}
|
|
|
|
['SIGTERM', 'SIGINT', 'SIGHUP', 'SIGBREAK'].forEach((signal) => {
|
|
process.on(signal, () => {
|
|
(async () => {
|
|
await killChainlit(); // Ensure Chainlit is killed on exit
|
|
|
|
const signalMap = { SIGTERM: 15, SIGINT: 2, SIGHUP: 1, SIGBREAK: 21 };
|
|
process.exit(128 + (signalMap[signal] || 0));
|
|
})();
|
|
});
|
|
});
|
|
|
|
export default defineConfig({
|
|
projectId: 'ij1tyk',
|
|
|
|
retries: 3,
|
|
|
|
viewportWidth: 1200,
|
|
|
|
e2e: {
|
|
defaultCommandTimeout: 30000,
|
|
baseUrl: `http://127.0.0.1:${CHAINLIT_APP_PORT}`,
|
|
experimentalInteractiveRunEvents: true,
|
|
async setupNodeEvents(on, config) {
|
|
cypressSplit(on, config);
|
|
|
|
await killChainlit(); // Fallback to ensure no previous instance is running
|
|
await runChainlit(); // Start Chainlit before running tests as Cypress require
|
|
|
|
on('before:spec', async (spec) => {
|
|
await killChainlit();
|
|
await runChainlit(spec);
|
|
});
|
|
|
|
on('after:spec', async () => {
|
|
await killChainlit();
|
|
});
|
|
|
|
on('after:run', async () => {
|
|
await killChainlit();
|
|
});
|
|
|
|
on('task', {
|
|
log(message) {
|
|
console.log(message);
|
|
return null;
|
|
},
|
|
restartChainlit(spec: Cypress.Spec) {
|
|
return new Promise((resolve) => {
|
|
killChainlit().then(() => {
|
|
runChainlit(spec).then(() => {
|
|
setTimeout(() => {
|
|
resolve(null);
|
|
}, 1000);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
return config;
|
|
}
|
|
}
|
|
});
|