- Add GitHub Actions CI workflow with lint, type-check, test, build, and e2e jobs - Configure Jest for unit and integration tests with coverage reporting - Create unit tests for BaseAgent, PlantLineageAgent, and AgentOrchestrator - Add blockchain PlantChain unit tests - Create API integration tests for plants endpoints - Configure Cypress for E2E testing with support files and custom commands - Add E2E tests for home, plant registration, transparency, and vertical farm pages - Set up Prettier for code formatting with configuration - Configure Husky pre-commit hooks with lint-staged - Add commitlint for conventional commit message enforcement - Update package.json with new scripts and dev dependencies This implements Agent 5 (Testing & CI/CD) from the deployment plan.
45 lines
1 KiB
TypeScript
45 lines
1 KiB
TypeScript
/**
|
|
* Cypress E2E Support File
|
|
* This file is processed and loaded automatically before test files.
|
|
*/
|
|
|
|
// Import commands
|
|
import './commands';
|
|
|
|
// Global hooks
|
|
beforeEach(() => {
|
|
// Clear local storage between tests
|
|
cy.clearLocalStorage();
|
|
});
|
|
|
|
// Handle uncaught exceptions
|
|
Cypress.on('uncaught:exception', (err, runnable) => {
|
|
// Returning false prevents Cypress from failing the test
|
|
// This is useful for third-party scripts that may throw errors
|
|
if (err.message.includes('ResizeObserver loop')) {
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
|
|
// Add custom assertions if needed
|
|
declare global {
|
|
namespace Cypress {
|
|
interface Chainable {
|
|
/**
|
|
* Custom command to wait for page load
|
|
*/
|
|
waitForPageLoad(): Chainable<void>;
|
|
|
|
/**
|
|
* Custom command to login (placeholder for auth tests)
|
|
*/
|
|
login(email: string, password: string): Chainable<void>;
|
|
|
|
/**
|
|
* Custom command to navigate to a plant page
|
|
*/
|
|
visitPlant(plantId: string): Chainable<void>;
|
|
}
|
|
}
|
|
}
|