@stablyai/playwright-test 0.1.0 → 0.1.2
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 +22 -0
- package/cli.js +2 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -4
- package/src/index.ts +0 -50
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -20
package/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Stably Playwright Test
|
2
|
+
This package extends Playwright to add new AI functionality
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
First ensure you remove any previous playwright/playwright-test installation
|
6
|
+
```shell
|
7
|
+
npm remove playwright @playwright/test
|
8
|
+
```
|
9
|
+
|
10
|
+
Afterwards you can install Stably
|
11
|
+
```shell
|
12
|
+
npm install @stablyai/playwright-test
|
13
|
+
```
|
14
|
+
|
15
|
+
## Setup
|
16
|
+
Make sure you also get your [api-key](https://auth.stably.ai/account/api_keys) to use the AI features.
|
17
|
+
Either set the `process.env.STABLY_API_KEY` variable or programtically call `setApiKey` from `"@stablyai/playwright-test"`
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
1. Replace "@playwright/test" with "@stablyai/playwright-test"
|
21
|
+
1. Ex: imports should look like: import { test, expect } from "@stablyai/playwright-test";
|
22
|
+
2. Simply run tests with `npx playwright test` as you would normally using Playwright
|
package/cli.js
ADDED
package/dist/index.d.mts
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
import "@stablyai/playwright-base";
|
2
2
|
import * as _stablyai_playwright_base from '@stablyai/playwright-base';
|
3
3
|
export { setApiKey } from '@stablyai/playwright-base';
|
4
|
-
import * as
|
5
|
-
import { test as test$1 } from '@playwright
|
6
|
-
export * from '@playwright
|
4
|
+
import * as _stablyai_internal_playwright_test from '@stablyai/internal-playwright-test';
|
5
|
+
import { test as test$1 } from '@stablyai/internal-playwright-test';
|
6
|
+
export * from '@stablyai/internal-playwright-test';
|
7
7
|
|
8
8
|
declare const test: typeof test$1;
|
9
|
-
declare const expect:
|
9
|
+
declare const expect: _stablyai_internal_playwright_test.Expect<{
|
10
10
|
readonly toMatchScreenshotPrompt: (this: {
|
11
11
|
isNot: boolean;
|
12
12
|
message?: () => string;
|
13
|
-
}, received:
|
13
|
+
}, received: _stablyai_internal_playwright_test.Page | _stablyai_internal_playwright_test.Locator, condition: string, options?: _stablyai_playwright_base.ScreenshotPromptOptions) => Promise<{
|
14
14
|
pass: boolean;
|
15
15
|
message: () => string;
|
16
16
|
}>;
|
17
17
|
}>;
|
18
18
|
|
19
|
-
declare module
|
20
|
-
type ScreenshotPromptOptions =
|
19
|
+
declare module "@stablyai/internal-playwright-test" {
|
20
|
+
type ScreenshotPromptOptions = _stablyai_internal_playwright_test.PageAssertionsToHaveScreenshotOptions;
|
21
21
|
interface LocatorAssertions {
|
22
22
|
toMatchScreenshotPrompt(condition: string, options?: ScreenshotPromptOptions): Promise<void>;
|
23
23
|
}
|
package/dist/index.d.ts
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
import "@stablyai/playwright-base";
|
2
2
|
import * as _stablyai_playwright_base from '@stablyai/playwright-base';
|
3
3
|
export { setApiKey } from '@stablyai/playwright-base';
|
4
|
-
import * as
|
5
|
-
import { test as test$1 } from '@playwright
|
6
|
-
export * from '@playwright
|
4
|
+
import * as _stablyai_internal_playwright_test from '@stablyai/internal-playwright-test';
|
5
|
+
import { test as test$1 } from '@stablyai/internal-playwright-test';
|
6
|
+
export * from '@stablyai/internal-playwright-test';
|
7
7
|
|
8
8
|
declare const test: typeof test$1;
|
9
|
-
declare const expect:
|
9
|
+
declare const expect: _stablyai_internal_playwright_test.Expect<{
|
10
10
|
readonly toMatchScreenshotPrompt: (this: {
|
11
11
|
isNot: boolean;
|
12
12
|
message?: () => string;
|
13
|
-
}, received:
|
13
|
+
}, received: _stablyai_internal_playwright_test.Page | _stablyai_internal_playwright_test.Locator, condition: string, options?: _stablyai_playwright_base.ScreenshotPromptOptions) => Promise<{
|
14
14
|
pass: boolean;
|
15
15
|
message: () => string;
|
16
16
|
}>;
|
17
17
|
}>;
|
18
18
|
|
19
|
-
declare module
|
20
|
-
type ScreenshotPromptOptions =
|
19
|
+
declare module "@stablyai/internal-playwright-test" {
|
20
|
+
type ScreenshotPromptOptions = _stablyai_internal_playwright_test.PageAssertionsToHaveScreenshotOptions;
|
21
21
|
interface LocatorAssertions {
|
22
22
|
toMatchScreenshotPrompt(condition: string, options?: ScreenshotPromptOptions): Promise<void>;
|
23
23
|
}
|
package/dist/index.js
CHANGED
@@ -27,11 +27,11 @@ __export(index_exports, {
|
|
27
27
|
});
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
29
29
|
var import_playwright_base = require("@stablyai/playwright-base");
|
30
|
-
var
|
30
|
+
var import_internal_playwright_test = require("@stablyai/internal-playwright-test");
|
31
31
|
var import_playwright_base2 = require("@stablyai/playwright-base");
|
32
32
|
var import_playwright_base3 = require("@stablyai/playwright-base");
|
33
|
-
__reExport(index_exports, require("@playwright
|
34
|
-
var test =
|
33
|
+
__reExport(index_exports, require("@stablyai/internal-playwright-test"), module.exports);
|
34
|
+
var test = import_internal_playwright_test.test.extend({
|
35
35
|
browser: async ({ browser }, use) => {
|
36
36
|
await use((0, import_playwright_base2.augmentBrowser)(browser));
|
37
37
|
},
|
@@ -42,12 +42,12 @@ var test = import_test.test.extend({
|
|
42
42
|
await use((0, import_playwright_base2.augmentPage)(page));
|
43
43
|
}
|
44
44
|
});
|
45
|
-
var expect =
|
45
|
+
var expect = import_internal_playwright_test.expect.extend(import_playwright_base2.stablyPlaywrightMatchers);
|
46
46
|
// Annotate the CommonJS export names for ESM import in node:
|
47
47
|
0 && (module.exports = {
|
48
48
|
expect,
|
49
49
|
setApiKey,
|
50
50
|
test,
|
51
|
-
...require("@playwright
|
51
|
+
...require("@stablyai/internal-playwright-test")
|
52
52
|
});
|
53
53
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"@stablyai/playwright-base\";\n\nimport {\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@stablyai/internal-playwright-test\";\n\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nexport { setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend({\n browser: async ({ browser }, use) => {\n await use(augmentBrowser(browser));\n },\n context: async ({ context }, use) => {\n await use(augmentBrowserContext(context));\n },\n page: async ({ page }, use) => {\n await use(augmentPage(page));\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@stablyai/internal-playwright-test\";\n\ndeclare module \"@stablyai/internal-playwright-test\" {\n export type ScreenshotPromptOptions =\n import(\"@stablyai/internal-playwright-test\").PageAssertionsToHaveScreenshotOptions;\n\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAO;AAEP,sCAGO;AAEP,IAAAA,0BAKO;AAEP,IAAAA,0BAA0B;AAgB1B,0BAAc,+CA9Bd;AAgBO,IAAM,OAA8B,gCAAAC,KAAe,OAAO;AAAA,EAC/D,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AACnC,UAAM,QAAI,wCAAe,OAAO,CAAC;AAAA,EACnC;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AACnC,UAAM,QAAI,+CAAsB,OAAO,CAAC;AAAA,EAC1C;AAAA,EACA,MAAM,OAAO,EAAE,KAAK,GAAG,QAAQ;AAC7B,UAAM,QAAI,qCAAY,IAAI,CAAC;AAAA,EAC7B;AACF,CAAC;AAEM,IAAM,SAAS,gCAAAC,OAAiB,OAAO,gDAAwB;","names":["import_playwright_base","playwrightTest","playwrightExpect"]}
|
package/dist/index.mjs
CHANGED
@@ -3,7 +3,7 @@ import "@stablyai/playwright-base";
|
|
3
3
|
import {
|
4
4
|
expect as playwrightExpect,
|
5
5
|
test as playwrightTest
|
6
|
-
} from "@playwright
|
6
|
+
} from "@stablyai/internal-playwright-test";
|
7
7
|
import {
|
8
8
|
augmentBrowser,
|
9
9
|
augmentBrowserContext,
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
stablyPlaywrightMatchers
|
12
12
|
} from "@stablyai/playwright-base";
|
13
13
|
import { setApiKey } from "@stablyai/playwright-base";
|
14
|
-
export * from "@playwright
|
14
|
+
export * from "@stablyai/internal-playwright-test";
|
15
15
|
var test = playwrightTest.extend({
|
16
16
|
browser: async ({ browser }, use) => {
|
17
17
|
await use(augmentBrowser(browser));
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import \"@stablyai/playwright-base\";\n\nimport {\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@stablyai/internal-playwright-test\";\n\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nexport { setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend({\n browser: async ({ browser }, use) => {\n await use(augmentBrowser(browser));\n },\n context: async ({ context }, use) => {\n await use(augmentBrowserContext(context));\n },\n page: async ({ page }, use) => {\n await use(augmentPage(page));\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@stablyai/internal-playwright-test\";\n\ndeclare module \"@stablyai/internal-playwright-test\" {\n export type ScreenshotPromptOptions =\n import(\"@stablyai/internal-playwright-test\").PageAssertionsToHaveScreenshotOptions;\n\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n}\n"],"mappings":";AAAA,OAAO;AAEP;AAAA,EACE,UAAU;AAAA,EACV,QAAQ;AAAA,OACH;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB;AAgB1B,cAAc;AAdP,IAAM,OAA8B,eAAe,OAAO;AAAA,EAC/D,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AACnC,UAAM,IAAI,eAAe,OAAO,CAAC;AAAA,EACnC;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AACnC,UAAM,IAAI,sBAAsB,OAAO,CAAC;AAAA,EAC1C;AAAA,EACA,MAAM,OAAO,EAAE,KAAK,GAAG,QAAQ;AAC7B,UAAM,IAAI,YAAY,IAAI,CAAC;AAAA,EAC7B;AACF,CAAC;AAEM,IAAM,SAAS,iBAAiB,OAAO,wBAAwB;","names":[]}
|
package/package.json
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@stablyai/playwright-test",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.2",
|
4
4
|
"description": "Playwright Test wrapper with Stably AI matchers",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
7
|
+
"bin": {
|
8
|
+
"playwright": "cli.js"
|
9
|
+
},
|
10
|
+
"files": [
|
11
|
+
"dist",
|
12
|
+
"cli.js"
|
13
|
+
],
|
7
14
|
"dependencies": {
|
15
|
+
"@stablyai/internal-playwright-test": "^0.1.1",
|
8
16
|
"@stablyai/playwright": "^0.1.0",
|
9
17
|
"@stablyai/playwright-base": "^0.1.0"
|
10
18
|
},
|
@@ -12,9 +20,7 @@
|
|
12
20
|
"tsup": "^8.5.0"
|
13
21
|
},
|
14
22
|
"peerDependencies": {
|
15
|
-
"
|
16
|
-
"playwright": "^1.44.0",
|
17
|
-
"zod": "^3.0.0"
|
23
|
+
"zod": "^3.25.0 || ^4.0.0"
|
18
24
|
},
|
19
25
|
"scripts": {
|
20
26
|
"build": "tsup --config tsup.config.ts"
|
package/src/index.ts
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
import '@stablyai/playwright-base';
|
2
|
-
|
3
|
-
import {
|
4
|
-
expect as playwrightExpect,
|
5
|
-
test as playwrightTest,
|
6
|
-
} from '@playwright/test';
|
7
|
-
|
8
|
-
import {
|
9
|
-
augmentBrowser,
|
10
|
-
augmentBrowserContext,
|
11
|
-
augmentPage,
|
12
|
-
stablyPlaywrightMatchers,
|
13
|
-
} from '@stablyai/playwright-base';
|
14
|
-
|
15
|
-
export { setApiKey } from '@stablyai/playwright-base';
|
16
|
-
|
17
|
-
export const test: typeof playwrightTest = playwrightTest.extend({
|
18
|
-
browser: async ({ browser }, use) => {
|
19
|
-
await use(augmentBrowser(browser));
|
20
|
-
},
|
21
|
-
context: async ({ context }, use) => {
|
22
|
-
await use(augmentBrowserContext(context));
|
23
|
-
},
|
24
|
-
page: async ({ page }, use) => {
|
25
|
-
await use(augmentPage(page));
|
26
|
-
},
|
27
|
-
});
|
28
|
-
|
29
|
-
export const expect = playwrightExpect.extend(stablyPlaywrightMatchers);
|
30
|
-
|
31
|
-
export * from '@playwright/test';
|
32
|
-
|
33
|
-
declare module '@playwright/test' {
|
34
|
-
export type ScreenshotPromptOptions =
|
35
|
-
import('@playwright/test').PageAssertionsToHaveScreenshotOptions;
|
36
|
-
|
37
|
-
interface LocatorAssertions {
|
38
|
-
toMatchScreenshotPrompt(
|
39
|
-
condition: string,
|
40
|
-
options?: ScreenshotPromptOptions,
|
41
|
-
): Promise<void>;
|
42
|
-
}
|
43
|
-
|
44
|
-
interface PageAssertions {
|
45
|
-
toMatchScreenshotPrompt(
|
46
|
-
condition: string,
|
47
|
-
options?: ScreenshotPromptOptions,
|
48
|
-
): Promise<void>;
|
49
|
-
}
|
50
|
-
}
|
package/tsconfig.json
DELETED
package/tsup.config.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { defineConfig } from 'tsup';
|
2
|
-
|
3
|
-
export default defineConfig({
|
4
|
-
entry: ['src/index.ts'],
|
5
|
-
format: ['cjs', 'esm'],
|
6
|
-
splitting: false,
|
7
|
-
sourcemap: true,
|
8
|
-
clean: true,
|
9
|
-
dts: {
|
10
|
-
banner: 'import "@stablyai/playwright-base";',
|
11
|
-
},
|
12
|
-
target: 'es2019',
|
13
|
-
outDir: 'dist',
|
14
|
-
platform: 'node',
|
15
|
-
external: [
|
16
|
-
'@playwright/test',
|
17
|
-
'@stablyai/playwright',
|
18
|
-
'@stablyai/playwright-base',
|
19
|
-
],
|
20
|
-
});
|