feat: add @constructive-io/playwright-test package #603
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.
Summary
This PR adds a new
@constructive-io/playwright-testpackage that extends@constructive-io/graphql-testto provide an actual HTTP server for Playwright and other E2E testing frameworks. The package creates isolated test databases and starts a GraphQL server configured withenableServicesApi: falseto bypass domain/subdomain routing.Key exports:
getConnectionsWithServer()- Creates DB connections and HTTP server, returns server URL for PlaywrightgetConnectionsWithServerObject()- Object-based query API variantgetConnectionsWithServerUnwrapped()- Throws on GraphQL errors instead of returning themcreateTestServer()- Low-level server creation utilityAlso exports middleware functions from
@constructive-io/graphql-serverfor use in testing packages.Updates since last revision
opts.graphileproperties using optional chaining (prevents "Cannot read properties of undefined" errors when graphile options aren't provided)??fallbacks ingetEnvOptionscall - now only passesanonRole/roleNamewhenauthRoleis explicitly providedReview & Testing Checklist for Human
{ __typename }). Data queries (e.g.,allUsers) were not tested because they returned errors during development. Verify that actual table queries work correctly with your schemas.graphql/server/src/middleware/graphile.tsadds optional chaining foropts.graphile?.appendPlugins,opts.graphile?.graphileBuildOptions, andopts.graphile?.overrideSettings. Ensure this doesn't break existing consumers that rely on these being defined.teardown()properly stops the HTTP server and cleans up the database without leaving orphaned connectionsRecommended test plan:
Notes
Requested by: Dan Lynch (@pyramation)
Devin session: https://app.devin.ai/sessions/a583a9da700a4feca3985c559d33e51f