Add Cypress e2e workspace, harden Docker/MinIO setup, and share deterministic seed config#86
Draft
tomast1337 wants to merge 30 commits intodevelopfrom
Draft
Add Cypress e2e workspace, harden Docker/MinIO setup, and share deterministic seed config#86tomast1337 wants to merge 30 commits intodevelopfrom
tomast1337 wants to merge 30 commits intodevelopfrom
Conversation
…ure/zod-db-packages
…ator - Add env, Discord strategy, and song form schemas to @nbw/validation - Wire ConfigModule to validateEnv; parse user/song/query payloads with Zod - Replace DTO class helpers with mappers in song.util; re-export validation from @nbw/database for consumers - Frontend: import song form schemas from @nbw/validation; remove local SongForm.zod - Remove class-validator/class-transformer and global ValidationPipe from backend - Update specs; note bun test may need workspace resolution fixes for @nbw/config
- Introduce a new jsonStringField function to validate and parse JSON strings, ensuring invalid JSON surfaces as a Zod issue. - Update thumbnailData and customInstruments fields to utilize jsonStringField for improved validation.
…instructions - Change package name to @nbw/validation and clarify its role as the source of shared Zod schemas and TypeScript types. - Add detailed layout and script sections for building, developing, testing, linting, and cleaning the package. - Include instructions for consumers on how to import and use the package after building.
- Delete jest.config.js as part of the cleanup process for the validation package.
…TO names Remove common/types.ts and song/types.ts (PageQueryDTOType and *DtoType aliases). Add song/uploadMeta.ts for VisibilityType, CategoryType, LicenseType, TimespanType. Export SongsFolder from SongPage.dto.ts next to SongPageDto. Point SongPreview/SongView/UploadSongDto at uploadMeta; update package index exports. Rename frontend imports from *DtoType to the real DTO types (via @nbw/database).
…ckage dependencies - Introduced new UI components: Button, Input, Label, and Textarea for consistent styling and functionality across the application. - Added @radix-ui/react-label dependency to package.json for label component integration. - Updated existing components to utilize the new UI components for improved user experience. - Refactored ProfileBioEditor and ProfilePublicNameEditor to use the new Input and Button components.
- Changed the order field in PageQuery DTO from a union of boolean and string to an enum with 'asc' and 'desc' options for improved clarity and validation.
…ewSource type - Updated song retrieval logic to use a more specific type for the uploader field in the song model. - Introduced the SongPreviewSource type to standardize the structure of song preview data. - Refactored songPreviewFromSongDocumentWithUser function to accept the new type for improved type safety and clarity.
- Changed various imports across the frontend application to source DTOs and types from the new @nbw/validation package instead of @nbw/database. - This refactor aims to centralize validation logic and improve type safety throughout the application.
…e SongSearchParams - Updated the SearchSongPage component to utilize the new SongSearchParams type for improved type safety. - Refactored search logic to use constants from the SEARCH_SONGS configuration for pagination and placeholder counts. - Cleaned up unused interfaces and enums, streamlining the codebase for better maintainability. - Introduced a new SongSearchParams DTO to standardize search parameters across the application.
… from @nbw/config - Removed the config-shim.ts file and updated imports in various DTOs to directly source constants from @nbw/config. - This change simplifies the import structure and enhances clarity across the validation package.
…ring - Modified the UserController to return paginated user data filtered by email, ID, or username. - Updated the UserService to handle pagination and filtering logic, ensuring consistent query handling. - Adjusted tests to reflect the new functionality and ensure proper coverage for paginated user retrieval. - Removed deprecated lookup mode handling for a more streamlined approach to user queries.
- Removed unnecessary import of UserIndexQueryDto and updated the getUserIndex method to directly use UserIndexPageQueryInput. - Streamlined the user retrieval logic for improved clarity and maintainability.
…constraints - Introduced maximum length constraints for title, originalAuthor, and description fields in the Song entity using UPLOAD_CONSTANTS. - Simplified the songPreviewFromSongDocumentWithUser function to default the description to an empty string if not provided. - Updated the SongPreview DTO to reflect the new maximum length validations for title, originalAuthor, and description fields.
…pdate package dependencies" This reverts commit fb03997.
This reverts commit 99bc5e6.
- Updated import statements across multiple DTO files to remove the '.js' extension for consistency and clarity. - This change enhances maintainability and aligns with best practices for module imports.
- Removed the mongoose dependency from the validation package to streamline dependencies. - Updated import statements in SongSearchQuery.dto.ts to reference the correct path without the file extension, enhancing consistency and maintainability.
…data - Add SeedDevOptions (faker seed, user count clamp, fixed createdAt upper bound) and stable nbw-seed-* emails; document limits in seed.types. - Extend GET /seed/seed-dev with optional query params; await seeding; guard when NODE_ENV is not development. - Fix socialLinks seeding via a plain object; expand seed controller/service tests. - UserService.update now applies $set from toObject() and strips nested _id to avoid Mongoose circular-reference errors on findByIdAndUpdate.
- Add @nbw/e2e (Cypress, smoke spec, shared clock from @nbw/config); root cy:open / test:cy and apps/e2e postinstall for the Cypress binary. - Docker: minio-init profile + root docker:* scripts; disable flaky MailDev healthcheck so compose --wait can finish; document flow in CONTRIBUTING. - Backend: deterministic seed API, tests, UserService.update plain $set; move seed constants and SeedDevOptions into @nbw/config for reuse with Cypress.
- Introduced a new POST /e2e/session endpoint in AuthController for development use, allowing Cypress to obtain JWTs without UI login. - Added validation to ensure the endpoint is only accessible in development mode with a valid E2E_AUTH_SECRET. - Updated AuthService to issue session tokens for existing users based on email or userId. - Enhanced unit tests to cover the new e2eSession functionality and its edge cases. - Added E2E_AUTH_HEADER constant for consistent header usage across the application.
…nctionality - Added a new command `sessionViaApi` to facilitate authenticated sessions in Cypress tests. - Introduced a `cy:baseline` script for generating full-page PNG snapshots of public routes. - Updated Cypress configuration to include environment variables for API URL and authentication secret. - Modified screenshot handling to store baseline images separately and disabled failure screenshots. - Created a new test file for baseline snapshots of static and dynamic pages. - Updated `.gitignore` to exclude unnecessary screenshots directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an end-to-end test harness and improves the local stack so uploads and seeding work reliably.
Cypress (
@nbw/e2e)apps/e2eworkspace with Cypress, TypeScript, smoke spec, andbaseUrl/ env notes.cy:open,test:cy) without Bun filter log spam.Docker & docs
docker:minio-initand wired intodocker:up/docker:reset*).docker compose up --waitdoes not block MinIO init.docker compose, MinIO init, and recommendedbun run docker:up.Backend seeding
createdAtupper bound, stable emails, query params onGET /seed/seed-dev, tests).UserService.updateuses a plain$setpayload fromtoObject()to avoid Mongoose circular-reference errors.Shared config
SeedDevOptions, andSEED_E2E_BROWSER_CLOCK_MSlive in@nbw/configfor backend and Cypress.How to verify
bun installfrom repo root.bun run docker:up(ordocker:reset:fresh), then start backend + frontend.bun run test:cywith the app onhttp://localhost:3000.GET /v1/seed/seed-devwith query params in development and confirm uploads after MinIO init.