- 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.
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
/**
|
|
* Plant Registration E2E Tests
|
|
*/
|
|
|
|
describe('Plant Registration', () => {
|
|
beforeEach(() => {
|
|
cy.visit('/plants/register');
|
|
cy.waitForPageLoad();
|
|
});
|
|
|
|
it('should load the registration page', () => {
|
|
cy.url().should('include', '/plants/register');
|
|
});
|
|
|
|
it('should display registration form', () => {
|
|
cy.get('form').should('be.visible');
|
|
});
|
|
|
|
it('should have required form fields', () => {
|
|
// Check for common form fields
|
|
cy.get('input, select, textarea').should('have.length.at.least', 1);
|
|
});
|
|
|
|
it('should show validation errors for empty form submission', () => {
|
|
// Try to submit empty form
|
|
cy.get('form').within(() => {
|
|
cy.get('button[type="submit"]').click();
|
|
});
|
|
// Form should not navigate away without valid data
|
|
cy.url().should('include', '/plants/register');
|
|
});
|
|
|
|
describe('Form Validation', () => {
|
|
it('should require plant name', () => {
|
|
cy.get('input[name="name"]').should('exist');
|
|
});
|
|
|
|
it('should require plant species', () => {
|
|
cy.get('input[name="species"], select[name="species"]').should('exist');
|
|
});
|
|
});
|
|
|
|
describe('Anonymous Registration', () => {
|
|
it('should allow anonymous registration', () => {
|
|
cy.visit('/plants/register-anonymous');
|
|
cy.waitForPageLoad();
|
|
cy.url().should('include', '/plants/register-anonymous');
|
|
cy.get('form').should('be.visible');
|
|
});
|
|
});
|
|
});
|