@empiricalrun/playwright-utils 0.52.0 → 0.53.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/CHANGELOG.md +12 -0
- package/README.md +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -1
- package/dist/inbox-client.d.ts.map +1 -1
- package/dist/inbox-client.js +8 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/overlay-tests/cache.spec.js +2 -1
- package/dist/overlay-tests/click.spec.js +6 -3
- package/dist/reporter/attachment-cleanup-test-reporter.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup-test-reporter.js +2 -1
- package/dist/reporter/attachment-cleanup.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup.js +17 -8
- package/dist/reporter/blob-utils.d.ts.map +1 -1
- package/dist/reporter/blob-utils.js +4 -2
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +12 -6
- package/dist/reporter/harness.d.ts +9 -0
- package/dist/reporter/harness.d.ts.map +1 -1
- package/dist/reporter/harness.js +58 -5
- package/dist/reporter/ibr-utils.d.ts.map +1 -1
- package/dist/reporter/ibr-utils.js +4 -2
- package/dist/reporter/incremental-blob-reporter.d.ts.map +1 -1
- package/dist/reporter/incremental-blob-reporter.js +6 -3
- package/dist/reporter/lifecycle-events.d.ts.map +1 -1
- package/dist/reporter/lifecycle-events.js +2 -1
- package/dist/reporter/test-case-sync-reporter.d.ts +12 -0
- package/dist/reporter/test-case-sync-reporter.d.ts.map +1 -0
- package/dist/reporter/test-case-sync-reporter.js +28 -0
- package/dist/reporter/test-case-sync.d.ts +28 -0
- package/dist/reporter/test-case-sync.d.ts.map +1 -0
- package/dist/reporter/test-case-sync.js +134 -0
- package/dist/reporter/uploader.d.ts.map +1 -1
- package/dist/reporter/uploader.js +2 -1
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +12 -6
- package/dist/test/expect/visual.d.ts.map +1 -1
- package/dist/test/expect/visual.js +5 -3
- package/dist/test/expect/webhook.d.ts.map +1 -1
- package/dist/test/expect/webhook.js +2 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4 -7
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/utils.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/utils.js +2 -1
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +4 -2
- package/package.json +10 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/postgres.d.ts +0 -22
- package/dist/postgres.d.ts.map +0 -1
- package/dist/postgres.js +0 -146
- package/docs/postgres.md +0 -78
package/docs/postgres.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Postgres
|
|
2
|
-
|
|
3
|
-
A PostgreSQL client for creating and managing temporary Neon databases in tests.
|
|
4
|
-
|
|
5
|
-
## Fixture usage
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
test("example", async ({ page, postgres }) => {
|
|
9
|
-
// Get or create a database (cached via KV for 1 hour by default)
|
|
10
|
-
const { connectionUri } = await postgres.get("my-test-db");
|
|
11
|
-
|
|
12
|
-
// Run queries
|
|
13
|
-
const users = await postgres.query<{ id: number; name: string }>(
|
|
14
|
-
connectionUri,
|
|
15
|
-
"SELECT * FROM users",
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
// Execute multiple SQL statements
|
|
19
|
-
await postgres.execute(
|
|
20
|
-
connectionUri,
|
|
21
|
-
`
|
|
22
|
-
CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);
|
|
23
|
-
INSERT INTO users (name) VALUES ('Alice');
|
|
24
|
-
`,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
// Delete when done (optional - TTL will auto-expire)
|
|
28
|
-
await postgres.delete("my-test-db");
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Standalone usage
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
import { PostgresClient } from "@empiricalrun/playwright-utils";
|
|
36
|
-
|
|
37
|
-
const postgres = new PostgresClient();
|
|
38
|
-
|
|
39
|
-
// Get or create a database
|
|
40
|
-
const { projectId, connectionUri } = await postgres.get("my-db", {
|
|
41
|
-
pgVersion: 15,
|
|
42
|
-
ttl: 7200, // 2 hours
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Run a query
|
|
46
|
-
const rows = await postgres.query(connectionUri, "SELECT NOW()");
|
|
47
|
-
|
|
48
|
-
// Delete when done
|
|
49
|
-
await postgres.delete("my-db");
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## API
|
|
53
|
-
|
|
54
|
-
### `postgres.get(name, options?)`
|
|
55
|
-
|
|
56
|
-
Gets an existing database or creates a new one. Uses KV store to cache the connection.
|
|
57
|
-
|
|
58
|
-
- `name` - Unique identifier for the database
|
|
59
|
-
- `options.pgVersion` - PostgreSQL version (default: 15)
|
|
60
|
-
- `options.ttl` - Cache TTL in seconds (default: 3600)
|
|
61
|
-
|
|
62
|
-
Returns `{ projectId, connectionUri }`.
|
|
63
|
-
|
|
64
|
-
### `postgres.delete(name)`
|
|
65
|
-
|
|
66
|
-
Deletes the database and removes it from cache.
|
|
67
|
-
|
|
68
|
-
### `postgres.query(connectionUri, sql)`
|
|
69
|
-
|
|
70
|
-
Runs a SQL query and returns rows.
|
|
71
|
-
|
|
72
|
-
### `postgres.execute(connectionUri, sql)`
|
|
73
|
-
|
|
74
|
-
Executes multiple SQL statements separated by `;`.
|
|
75
|
-
|
|
76
|
-
## Requirements
|
|
77
|
-
|
|
78
|
-
- `EMPIRICALRUN_API_KEY` environment variable must be set
|