@constructive-io/playwright-test 3.3.2 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/esm/get-connections.js +3 -3
- package/get-connections.js +3 -3
- package/package.json +8 -8
- package/types.d.ts +2 -2
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ Constructive Playwright Testing with HTTP server support for end-to-end testing.
|
|
|
16
16
|
|
|
17
17
|
This package extends `@constructive-io/graphql-test` to provide an actual HTTP server for Playwright and other E2E testing frameworks. It creates isolated test databases and starts a GraphQL server for your suite to hit over HTTP.
|
|
18
18
|
|
|
19
|
-
It can run either server, selected per-suite with `server.
|
|
19
|
+
It can run either server, selected per-suite with `server.useRouting`:
|
|
20
20
|
|
|
21
|
-
- `server.
|
|
22
|
-
- `server.
|
|
21
|
+
- `server.useRouting: false` (default) — the single-tenant `@constructive-io/graphql-dev-server` (pure PostGraphile). No host route resolution and no database id; the configured schemas are exposed directly. Best for UI/local suites.
|
|
22
|
+
- `server.useRouting: true` — the production `@constructive-io/graphql-server`. Every request is resolved through the scoped-routing plane (`constructive_routing_public.resolve_route()`), so the suite must seed real routing/database records and reach the api surface via its seeded host (`Host` header).
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -61,7 +61,7 @@ describe('E2E Tests', () => {
|
|
|
61
61
|
|
|
62
62
|
### Against the real (scoped-routing) server
|
|
63
63
|
|
|
64
|
-
Set `server.
|
|
64
|
+
Set `server.useRouting: true` to run the production `@constructive-io/graphql-server`. Seed real routing/database records and address the api surface by its seeded host:
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
import { test, expect } from '@playwright/test';
|
|
@@ -73,9 +73,9 @@ test('resolves through the scoped routing plane', async ({ request }) => {
|
|
|
73
73
|
schemas: ['simple-pets-public'],
|
|
74
74
|
authRole: 'anonymous',
|
|
75
75
|
server: {
|
|
76
|
-
|
|
76
|
+
useRouting: true,
|
|
77
77
|
api: {
|
|
78
|
-
|
|
78
|
+
routingSchema: 'constructive_routing_public',
|
|
79
79
|
isPublic: true,
|
|
80
80
|
metaSchemas: ['constructive_routing_public', 'metaschema_public']
|
|
81
81
|
}
|
|
@@ -166,8 +166,8 @@ Creates database connections and starts an HTTP server for testing.
|
|
|
166
166
|
- `input.authRole` - Default authentication role (e.g., 'anonymous', 'authenticated')
|
|
167
167
|
- `input.server.port` - Port to run the server on (defaults to random available port)
|
|
168
168
|
- `input.server.host` - Host to bind to (defaults to 'localhost')
|
|
169
|
-
- `input.server.
|
|
170
|
-
- `input.server.api` - API options forwarded to the production scoped server (e.g. `metaSchemas`, `isPublic`); only used when `
|
|
169
|
+
- `input.server.useRouting` - `false` (default) runs the dev server; `true` runs the production scoped-routing server
|
|
170
|
+
- `input.server.api` - API options forwarded to the production scoped server (e.g. `metaSchemas`, `isPublic`); only used when `useRouting` is `true`
|
|
171
171
|
- `input.graphile` - Optional Graphile configuration overrides
|
|
172
172
|
- `seedAdapters` - Optional array of seed adapters for database setup
|
|
173
173
|
|
|
@@ -197,19 +197,19 @@ Low-level function to create just the production `@constructive-io/graphql-serve
|
|
|
197
197
|
## How It Works
|
|
198
198
|
|
|
199
199
|
1. Creates an isolated test database using `pgsql-test`
|
|
200
|
-
2. Starts either the dev server or the production scoped-routing server (see `server.
|
|
200
|
+
2. Starts either the dev server or the production scoped-routing server (see `server.useRouting`)
|
|
201
201
|
3. Exposes the GraphQL endpoint for your suite to hit over HTTP
|
|
202
202
|
4. Returns the server URL for Playwright to connect to
|
|
203
203
|
5. Provides a teardown function that stops the server and cleans up the database
|
|
204
204
|
|
|
205
205
|
## Configuration
|
|
206
206
|
|
|
207
|
-
By default (`
|
|
207
|
+
By default (`useRouting: false`) the server runs `@constructive-io/graphql-dev-server`, which means:
|
|
208
208
|
- No host route resolution (`resolve_route()`) is required and no database id is needed
|
|
209
209
|
- Schemas are exposed directly based on the `schemas` parameter
|
|
210
210
|
- Perfect for isolated testing without complex domain setup
|
|
211
211
|
|
|
212
|
-
With `
|
|
212
|
+
With `useRouting: true` the server runs the production `@constructive-io/graphql-server`:
|
|
213
213
|
- Every request is resolved through `constructive_routing_public.resolve_route()`
|
|
214
214
|
- The suite must seed real routing/database records and address the api surface by its seeded host
|
|
215
215
|
|
package/esm/get-connections.js
CHANGED
|
@@ -37,9 +37,9 @@ const createConnectionsWithServerBase = async (input, seedAdapters) => {
|
|
|
37
37
|
});
|
|
38
38
|
// Start the HTTP server. Suites default to the single-tenant dev server;
|
|
39
39
|
// suites exercising the real routing plane opt into the production
|
|
40
|
-
// scoped-routing server with `server.
|
|
41
|
-
const
|
|
42
|
-
const server =
|
|
40
|
+
// scoped-routing server with `server.useRouting: true`.
|
|
41
|
+
const useRouting = input.server?.useRouting ?? false;
|
|
42
|
+
const server = useRouting
|
|
43
43
|
? await createScopedTestServer(serverOpts, input.server)
|
|
44
44
|
: await createTestServer(serverOpts, input.server);
|
|
45
45
|
// Combined teardown function
|
package/get-connections.js
CHANGED
|
@@ -40,9 +40,9 @@ const createConnectionsWithServerBase = async (input, seedAdapters) => {
|
|
|
40
40
|
});
|
|
41
41
|
// Start the HTTP server. Suites default to the single-tenant dev server;
|
|
42
42
|
// suites exercising the real routing plane opt into the production
|
|
43
|
-
// scoped-routing server with `server.
|
|
44
|
-
const
|
|
45
|
-
const server =
|
|
43
|
+
// scoped-routing server with `server.useRouting: true`.
|
|
44
|
+
const useRouting = input.server?.useRouting ?? false;
|
|
45
|
+
const server = useRouting
|
|
46
46
|
? await (0, server_1.createScopedTestServer)(serverOpts, input.server)
|
|
47
47
|
: await (0, server_1.createTestServer)(serverOpts, input.server);
|
|
48
48
|
// Combined teardown function
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/playwright-test",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive Playwright Testing with HTTP server support",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"makage": "^0.3.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@constructive-io/graphql-dev-server": "^3.
|
|
39
|
-
"@constructive-io/graphql-env": "^3.
|
|
40
|
-
"@constructive-io/graphql-server": "^5.
|
|
41
|
-
"@constructive-io/graphql-test": "^5.
|
|
42
|
-
"@constructive-io/graphql-types": "^3.
|
|
38
|
+
"@constructive-io/graphql-dev-server": "^3.4.0",
|
|
39
|
+
"@constructive-io/graphql-env": "^3.20.0",
|
|
40
|
+
"@constructive-io/graphql-server": "^5.4.0",
|
|
41
|
+
"@constructive-io/graphql-test": "^5.2.0",
|
|
42
|
+
"@constructive-io/graphql-types": "^3.19.0",
|
|
43
43
|
"@pgpmjs/types": "^2.37.2",
|
|
44
44
|
"express": "^5.2.1",
|
|
45
|
-
"graphile-test": "^5.
|
|
45
|
+
"graphile-test": "^5.2.0",
|
|
46
46
|
"pg": "^8.21.0",
|
|
47
47
|
"pg-cache": "^3.16.2",
|
|
48
48
|
"pgsql-test": "^5.1.2"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"e2e",
|
|
57
57
|
"integration"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "518e7ab2270661c64875258436d90fdf76b4b336"
|
|
60
60
|
}
|
package/types.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ export interface PlaywrightServerOptions {
|
|
|
19
19
|
* every request through the scoped-routing plane. Suites must seed real
|
|
20
20
|
* routing/database records so `resolve_route()` returns a real database id.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
useRouting?: boolean;
|
|
23
23
|
/**
|
|
24
24
|
* API configuration forwarded to the production scoped server (e.g.
|
|
25
|
-
* `metaSchemas`, `isPublic`). Only used when `
|
|
25
|
+
* `metaSchemas`, `isPublic`). Only used when `useRouting` is `true`.
|
|
26
26
|
*/
|
|
27
27
|
api?: Partial<ApiOptions>;
|
|
28
28
|
}
|