@constructive-io/playwright-test 3.0.3 → 3.1.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/esm/get-connections.js +4 -4
- package/esm/server.js +3 -3
- package/get-connections.d.ts +1 -1
- package/get-connections.js +4 -4
- package/package.json +10 -10
- package/server.d.ts +2 -2
- package/server.js +2 -2
package/esm/get-connections.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
|
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
|
package/get-connections.d.ts
CHANGED
|
@@ -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,
|
|
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
|
*
|
package/get-connections.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
3
|
+
"version": "3.1.0",
|
|
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.
|
|
39
|
-
"@constructive-io/graphql-server": "^5.0
|
|
40
|
-
"@constructive-io/graphql-test": "^5.0.
|
|
41
|
-
"@constructive-io/graphql-types": "^3.
|
|
42
|
-
"@pgpmjs/types": "^2.
|
|
38
|
+
"@constructive-io/graphql-env": "^3.17.0",
|
|
39
|
+
"@constructive-io/graphql-server": "^5.1.0",
|
|
40
|
+
"@constructive-io/graphql-test": "^5.0.5",
|
|
41
|
+
"@constructive-io/graphql-types": "^3.16.0",
|
|
42
|
+
"@pgpmjs/types": "^2.36.0",
|
|
43
43
|
"express": "^5.2.1",
|
|
44
|
-
"graphile-test": "^5.0.
|
|
44
|
+
"graphile-test": "^5.0.5",
|
|
45
45
|
"pg": "^8.21.0",
|
|
46
|
-
"pg-cache": "^3.15.
|
|
47
|
-
"pgsql-test": "^5.0.
|
|
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": "
|
|
58
|
+
"gitHead": "39db6d576bce7bc1de8123849f237b1695779d88"
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
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
|