@constructive-io/playwright-test 3.0.4 → 3.1.1

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 CHANGED
@@ -64,7 +64,7 @@ let connections: Awaited<ReturnType<typeof getConnectionsWithServer>>;
64
64
 
65
65
  test.beforeAll(async () => {
66
66
  connections = await getConnectionsWithServer({
67
- schemas: ['services_public', 'app_public'],
67
+ schemas: ['app_public'],
68
68
  authRole: 'anonymous',
69
69
  server: {
70
70
  port: 5555,
@@ -150,15 +150,15 @@ Low-level function to create just the HTTP server without database setup.
150
150
 
151
151
  1. Creates an isolated test database using `pgsql-test`
152
152
  2. Starts an Express server with Constructive GraphQL middleware
153
- 3. Configures `enableServicesApi: false` to bypass domain/subdomain routing
153
+ 3. Configures `enableScopedRouting: false` (static mode) to bypass host route resolution
154
154
  4. Exposes the specified schemas directly via the GraphQL endpoint
155
155
  5. Returns the server URL for Playwright to connect to
156
156
  6. Provides a teardown function that stops the server and cleans up the database
157
157
 
158
158
  ## Configuration
159
159
 
160
- The server is configured with `enableServicesApi: false`, which means:
161
- - No domain/subdomain routing is required
160
+ The server is configured with `enableScopedRouting: false`, which means:
161
+ - No host route resolution (`resolve_route()`) is required
162
162
  - Schemas are exposed directly based on the `schemas` parameter
163
163
  - Perfect for isolated testing without complex domain setup
164
164
 
@@ -1,6 +1,6 @@
1
- import { getConnections as getPgConnections } from 'pgsql-test';
2
1
  import { getEnvOptions } from '@constructive-io/graphql-env';
3
2
  import { GraphQLTest } from '@constructive-io/graphql-test';
3
+ import { getConnections as getPgConnections } from 'pgsql-test';
4
4
  import { createTestServer } from './server';
5
5
  /**
6
6
  * Core unwrapping utility - throws on GraphQL errors
@@ -24,15 +24,15 @@ const createConnectionsWithServerBase = async (input, seedAdapters) => {
24
24
  // Set up GraphQL test context for direct queries
25
25
  const gqlContext = GraphQLTest(input, conn);
26
26
  await gqlContext.setup();
27
- // Build options for the HTTP server with enableServicesApi: false
27
+ // Build options for the HTTP server in static mode (scoped routing off)
28
28
  const serverOpts = getEnvOptions({
29
29
  pg: pg.config,
30
30
  api: {
31
- enableServicesApi: false,
31
+ enableScopedRouting: false,
32
32
  exposedSchemas: input.schemas,
33
33
  defaultDatabaseId: 'test-database',
34
34
  ...(input.authRole && { anonRole: input.authRole, roleName: input.authRole })
35
- },
35
+ }
36
36
  });
37
37
  // Start the HTTP server
38
38
  const server = await createTestServer(serverOpts, input.server);
package/esm/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createApiMiddleware, createAuthenticateMiddleware, cors, graphile } from '@constructive-io/graphql-server';
1
+ import { cors, createApiMiddleware, createAuthenticateMiddleware, graphile } from '@constructive-io/graphql-server';
2
2
  import express from 'express';
3
3
  import { createServer } from 'http';
4
4
  import { getPgPool } from 'pg-cache';
@@ -27,14 +27,14 @@ const findAvailablePort = async (startPort) => {
27
27
  * Create a test server for Playwright testing
28
28
  *
29
29
  * This creates an Express server with the Constructive GraphQL middleware
30
- * configured with enableServicesApi: false to bypass domain routing.
30
+ * configured with enableScopedRouting: false (static mode) to bypass routing.
31
31
  */
32
32
  export const createTestServer = async (opts, serverOpts = {}) => {
33
33
  const host = serverOpts.host ?? 'localhost';
34
34
  const requestedPort = serverOpts.port ?? 0;
35
35
  const port = requestedPort === 0 ? await findAvailablePort(5555) : requestedPort;
36
36
  const app = express();
37
- // Create middleware with enableServicesApi: false to bypass domain routing
37
+ // Create middleware in static mode (enableScopedRouting: false) to bypass routing
38
38
  const api = createApiMiddleware(opts);
39
39
  const authenticate = createAuthenticateMiddleware(opts);
40
40
  // Basic middleware setup
@@ -1,6 +1,6 @@
1
1
  import type { GetConnectionOpts } from 'pgsql-test';
2
2
  import type { SeedAdapter } from 'pgsql-test/seed/types';
3
- import type { GetConnectionsWithServerInput, GetConnectionsWithServerResult, GetConnectionsWithServerObjectResult } from './types';
3
+ import type { GetConnectionsWithServerInput, GetConnectionsWithServerObjectResult, GetConnectionsWithServerResult } from './types';
4
4
  /**
5
5
  * Creates connections with an HTTP server for Playwright testing (positional API)
6
6
  *
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConnectionsWithServerUnwrapped = exports.getConnectionsWithServerObject = exports.getConnectionsWithServer = void 0;
4
- const pgsql_test_1 = require("pgsql-test");
5
4
  const graphql_env_1 = require("@constructive-io/graphql-env");
6
5
  const graphql_test_1 = require("@constructive-io/graphql-test");
6
+ const pgsql_test_1 = require("pgsql-test");
7
7
  const server_1 = require("./server");
8
8
  /**
9
9
  * Core unwrapping utility - throws on GraphQL errors
@@ -27,15 +27,15 @@ const createConnectionsWithServerBase = async (input, seedAdapters) => {
27
27
  // Set up GraphQL test context for direct queries
28
28
  const gqlContext = (0, graphql_test_1.GraphQLTest)(input, conn);
29
29
  await gqlContext.setup();
30
- // Build options for the HTTP server with enableServicesApi: false
30
+ // Build options for the HTTP server in static mode (scoped routing off)
31
31
  const serverOpts = (0, graphql_env_1.getEnvOptions)({
32
32
  pg: pg.config,
33
33
  api: {
34
- enableServicesApi: false,
34
+ enableScopedRouting: false,
35
35
  exposedSchemas: input.schemas,
36
36
  defaultDatabaseId: 'test-database',
37
37
  ...(input.authRole && { anonRole: input.authRole, roleName: input.authRole })
38
- },
38
+ }
39
39
  });
40
40
  // Start the HTTP server
41
41
  const server = await (0, server_1.createTestServer)(serverOpts, input.server);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/playwright-test",
3
- "version": "3.0.4",
3
+ "version": "3.1.1",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive Playwright Testing with HTTP server support",
6
6
  "main": "index.js",
@@ -35,16 +35,16 @@
35
35
  "makage": "^0.3.0"
36
36
  },
37
37
  "dependencies": {
38
- "@constructive-io/graphql-env": "^3.16.3",
39
- "@constructive-io/graphql-server": "^5.0.4",
40
- "@constructive-io/graphql-test": "^5.0.4",
41
- "@constructive-io/graphql-types": "^3.15.0",
42
- "@pgpmjs/types": "^2.35.1",
38
+ "@constructive-io/graphql-env": "^3.17.1",
39
+ "@constructive-io/graphql-server": "^5.1.1",
40
+ "@constructive-io/graphql-test": "^5.0.6",
41
+ "@constructive-io/graphql-types": "^3.16.1",
42
+ "@pgpmjs/types": "^2.36.0",
43
43
  "express": "^5.2.1",
44
- "graphile-test": "^5.0.4",
44
+ "graphile-test": "^5.0.6",
45
45
  "pg": "^8.21.0",
46
- "pg-cache": "^3.15.2",
47
- "pgsql-test": "^5.0.4"
46
+ "pg-cache": "^3.15.3",
47
+ "pgsql-test": "^5.0.5"
48
48
  },
49
49
  "keywords": [
50
50
  "testing",
@@ -55,5 +55,5 @@
55
55
  "e2e",
56
56
  "integration"
57
57
  ],
58
- "gitHead": "d48f39ebd4b7dcbab22df7c57438c06efd9e223d"
58
+ "gitHead": "ebba3f838664032e6f6adf6c9c6d2b6cdddd994a"
59
59
  }
package/server.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { ConstructiveOptions } from '@constructive-io/graphql-types';
2
2
  import { Pool } from 'pg';
3
- import type { ServerInfo, PlaywrightServerOptions } from './types';
3
+ import type { PlaywrightServerOptions, ServerInfo } from './types';
4
4
  /**
5
5
  * Create a test server for Playwright testing
6
6
  *
7
7
  * This creates an Express server with the Constructive GraphQL middleware
8
- * configured with enableServicesApi: false to bypass domain routing.
8
+ * configured with enableScopedRouting: false (static mode) to bypass routing.
9
9
  */
10
10
  export declare const createTestServer: (opts: ConstructiveOptions, serverOpts?: PlaywrightServerOptions) => Promise<ServerInfo>;
11
11
  /**
package/server.js CHANGED
@@ -33,14 +33,14 @@ const findAvailablePort = async (startPort) => {
33
33
  * Create a test server for Playwright testing
34
34
  *
35
35
  * This creates an Express server with the Constructive GraphQL middleware
36
- * configured with enableServicesApi: false to bypass domain routing.
36
+ * configured with enableScopedRouting: false (static mode) to bypass routing.
37
37
  */
38
38
  const createTestServer = async (opts, serverOpts = {}) => {
39
39
  const host = serverOpts.host ?? 'localhost';
40
40
  const requestedPort = serverOpts.port ?? 0;
41
41
  const port = requestedPort === 0 ? await findAvailablePort(5555) : requestedPort;
42
42
  const app = (0, express_1.default)();
43
- // Create middleware with enableServicesApi: false to bypass domain routing
43
+ // Create middleware in static mode (enableScopedRouting: false) to bypass routing
44
44
  const api = (0, graphql_server_1.createApiMiddleware)(opts);
45
45
  const authenticate = (0, graphql_server_1.createAuthenticateMiddleware)(opts);
46
46
  // Basic middleware setup