@stablyai/playwright-test 2.0.0 โ 2.0.4
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 +57 -10
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,22 +1,69 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://stably.ai">
|
|
3
|
+
<h3 align="center">Stably</h3>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Code. Ship. <s>Test.</s>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://docs.stably.ai/"><strong>Documentation</strong></a> ยท
|
|
13
|
+
<a href="https://stably.ai/"><strong>Homepage</strong></a>
|
|
14
|
+
</p>
|
|
15
|
+
<br/>
|
|
16
|
+
|
|
1
17
|
# Stably Playwright Test
|
|
2
|
-
|
|
18
|
+
|
|
19
|
+
This package extends Playwright to add new AI functionality.
|
|
20
|
+
To get started quickly, please see [AI-assisted setup guide](https://docs.stably.ai/getting-started/sdk-setup-guide). Otherwise continue to read below.
|
|
3
21
|
|
|
4
22
|
## Installation
|
|
5
|
-
First ensure you remove any previous playwright/playwright-test installation
|
|
6
|
-
```shell
|
|
7
|
-
npm remove playwright @playwright/test
|
|
8
|
-
```
|
|
9
23
|
|
|
10
|
-
|
|
24
|
+
We assume you already have Playwright installed. If so you can run:
|
|
25
|
+
|
|
11
26
|
```shell
|
|
12
27
|
npm install @stablyai/playwright-test
|
|
13
28
|
```
|
|
14
29
|
|
|
15
|
-
##
|
|
30
|
+
## SDK
|
|
31
|
+
|
|
32
|
+
### Setup
|
|
33
|
+
|
|
16
34
|
Make sure you also get your [api-key](https://auth.stably.ai/account/api_keys) to use the AI features.
|
|
17
|
-
Either set the `
|
|
35
|
+
Either set the `STABLY_API_KEY` environment variable or programtically call `setApiKey` from `"@stablyai/playwright-test"`
|
|
36
|
+
|
|
37
|
+
### Usage
|
|
18
38
|
|
|
19
|
-
## Usage
|
|
20
39
|
1. Replace "@playwright/test" with "@stablyai/playwright-test"
|
|
21
40
|
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
|
|
41
|
+
2. Simply run tests with `npx playwright test` as you would normally using Playwright
|
|
42
|
+
|
|
43
|
+
### New Methods
|
|
44
|
+
|
|
45
|
+
The SDK adds new methods with AI visual assertions, full agent mode, and text extraction. See our [docs](https://docs.stably.ai/stably-sdk/ai-assertions) for more information.
|
|
46
|
+
|
|
47
|
+
## Stably Playwright Reporter
|
|
48
|
+
|
|
49
|
+
The [Stably Playwright Reporter](https://docs.stably.ai/reports-analytics#reports-and-analytics) also comes bundled with this package. Most users will find value in using this reporter for recording test results and having AI diagnostics.
|
|
50
|
+
|
|
51
|
+
### Setup
|
|
52
|
+
|
|
53
|
+
First, ensure you have your `STABLY_API_KEY` (secret). If you don't have it, you can get it [here](https://auth.stably.ai/account/api_keys).
|
|
54
|
+
Second, ensure that you have your Stably project ID (not a secret). You can get this from your web-app dashboard under settings
|
|
55
|
+
|
|
56
|
+
In your `playwright.config.ts/js` file add:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { defineConfig } from '@playwright/test';
|
|
60
|
+
import { stablyReporter } from '@stablyai/playwright-test';
|
|
61
|
+
|
|
62
|
+
export default defineConfig({
|
|
63
|
+
..., // your other config options go here
|
|
64
|
+
reporter: [
|
|
65
|
+
..., // (optional) other reporters go here
|
|
66
|
+
stablyReporter({ apiKey: process.env.STABLY_API_KEY, projectId: 'abc123' }), // ๐ Stably Reporter
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
|
24
24
|
Agent: () => import_playwright_base3.Agent,
|
|
25
|
+
defineConfig: () => defineConfig,
|
|
25
26
|
expect: () => expect,
|
|
26
27
|
setApiKey: () => import_playwright_base3.setApiKey,
|
|
27
28
|
stablyReporter: () => import_playwright_reporter.stablyReporter,
|
|
@@ -50,9 +51,11 @@ var test = import_test.test.extend({
|
|
|
50
51
|
}
|
|
51
52
|
});
|
|
52
53
|
var expect = import_test.expect.extend(import_playwright_base2.stablyPlaywrightMatchers);
|
|
54
|
+
var defineConfig = import_test.defineConfig;
|
|
53
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
56
|
0 && (module.exports = {
|
|
55
57
|
Agent,
|
|
58
|
+
defineConfig,
|
|
56
59
|
expect,
|
|
57
60
|
setApiKey,
|
|
58
61
|
stablyReporter,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { BrowserContext } from \"@playwright/test\";\nimport {\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@playwright/test\";\nimport \"@stablyai/playwright-base\";\n\nimport type { Agent } from \"@stablyai/playwright-base\";\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nexport { stablyReporter } from \"@stablyai/playwright-reporter\";\nexport { Agent, setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend<{\n agent: Agent;\n}>({\n agent: async (\n { context }: { context: BrowserContext },\n use: (agent: Agent) => Promise<void>,\n ) => {\n // Create a default agent from the default context\n const agent = context.newAgent();\n await use(agent);\n },\n browser: async ({ browser }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowser(browser as any) as any);\n },\n context: async ({ context }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowserContext(context as any) as any);\n },\n page: async ({ page }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentPage(page as any) as any);\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@playwright/test\";\n\ndeclare module \"@playwright/test\" {\n export type ScreenshotPromptOptions =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n import(\"@playwright/test\").PageAssertionsToHaveScreenshotOptions;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // Add agent fixture to test args\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PlaywrightTestArgs {\n agent: Agent;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { BrowserContext } from \"@playwright/test\";\nimport {\n defineConfig as playwrightDefineConfig,\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@playwright/test\";\nimport \"@stablyai/playwright-base\";\n\nimport type { Agent } from \"@stablyai/playwright-base\";\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nimport type { StablyNotificationConfig } from \"@stablyai/playwright-reporter\";\n\nexport { stablyReporter } from \"@stablyai/playwright-reporter\";\nexport type {\n StablyReporterOptions,\n ProjectNotificationConfig,\n NotificationResultPolicy,\n StablyEmailNotificationConfig,\n StablySlackNotificationConfig,\n StablyNotificationConfig,\n} from \"@stablyai/playwright-reporter\";\nexport { Agent, setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend<{\n agent: Agent;\n}>({\n agent: async (\n { context }: { context: BrowserContext },\n use: (agent: Agent) => Promise<void>,\n ) => {\n // Create a default agent from the default context\n const agent = context.newAgent();\n await use(agent);\n },\n browser: async ({ browser }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowser(browser as any) as any);\n },\n context: async ({ context }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowserContext(context as any) as any);\n },\n page: async ({ page }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentPage(page as any) as any);\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@playwright/test\";\n\nexport type StablyProjectConfig = {\n notifications?: StablyNotificationConfig;\n};\n\n/**\n * Stably-enhanced defineConfig with typed support for stably notification configuration in projects.\n * The `stably` property on projects is available via module augmentation of `@playwright/test`.\n *\n * @example\n * ```ts\n * import { defineConfig, stablyReporter } from \"@stablyai/playwright-test\";\n *\n * export default defineConfig({\n * reporter: [stablyReporter({ apiKey: \"...\" })],\n * projects: [\n * {\n * name: \"smoke\",\n * stably: {\n * notifications: {\n * slack: { channelName: \"#alerts\", notifyOnResult: \"failures-only\" },\n * },\n * },\n * },\n * ],\n * });\n * ```\n */\nexport const defineConfig = playwrightDefineConfig;\n\ndeclare module \"@playwright/test\" {\n export type ScreenshotPromptOptions =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n import(\"@playwright/test\").PageAssertionsToHaveScreenshotOptions;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // Add agent fixture to test args\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PlaywrightTestArgs {\n agent: Agent;\n }\n\n // Add stably config to project configuration\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface Project {\n stably?: StablyProjectConfig;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAIO;AACP,6BAAO;AAGP,IAAAA,0BAKO;AAIP,iCAA+B;AAS/B,IAAAA,0BAAiC;AA6BjC,wBAAc,6BAxDd;AA6BO,IAAM,OAA8B,YAAAC,KAAe,OAEvD;AAAA,EACD,OAAO,OACL,EAAE,QAAQ,GACV,QACG;AAEH,UAAM,QAAQ,QAAQ,SAAS;AAC/B,UAAM,IAAI,KAAK;AAAA,EACjB;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAEnC,UAAM,QAAI,wCAAe,OAAc,CAAQ;AAAA,EACjD;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAEnC,UAAM,QAAI,+CAAsB,OAAc,CAAQ;AAAA,EACxD;AAAA,EACA,MAAM,OAAO,EAAE,KAAK,GAAG,QAAQ;AAE7B,UAAM,QAAI,qCAAY,IAAW,CAAQ;AAAA,EAC3C;AACF,CAAC;AAEM,IAAM,SAAS,YAAAC,OAAiB,OAAO,gDAAwB;AA+B/D,IAAM,eAAe,YAAAC;","names":["import_playwright_base","playwrightTest","playwrightExpect","playwrightDefineConfig"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -3,9 +3,10 @@ import * as _stablyai_playwright_base from '@stablyai/playwright-base';
|
|
|
3
3
|
import { Agent } from '@stablyai/playwright-base';
|
|
4
4
|
export { Agent, setApiKey } from '@stablyai/playwright-base';
|
|
5
5
|
import * as _playwright_test from '@playwright/test';
|
|
6
|
-
import { test as test$1 } from '@playwright/test';
|
|
6
|
+
import { test as test$1, defineConfig as defineConfig$1 } from '@playwright/test';
|
|
7
7
|
export * from '@playwright/test';
|
|
8
|
-
|
|
8
|
+
import { StablyNotificationConfig } from '@stablyai/playwright-reporter';
|
|
9
|
+
export { NotificationResultPolicy, ProjectNotificationConfig, StablyEmailNotificationConfig, StablyNotificationConfig, StablyReporterOptions, StablySlackNotificationConfig, stablyReporter } from '@stablyai/playwright-reporter';
|
|
9
10
|
|
|
10
11
|
declare const test: typeof test$1;
|
|
11
12
|
declare const expect: _playwright_test.Expect<{
|
|
@@ -15,6 +16,33 @@ declare const expect: _playwright_test.Expect<{
|
|
|
15
16
|
}, received: _playwright_test.Page | _playwright_test.Locator, condition: string, options?: _stablyai_playwright_base.ScreenshotPromptOptions) => Promise<_playwright_test.MatcherReturnType>;
|
|
16
17
|
}>;
|
|
17
18
|
|
|
19
|
+
type StablyProjectConfig = {
|
|
20
|
+
notifications?: StablyNotificationConfig;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Stably-enhanced defineConfig with typed support for stably notification configuration in projects.
|
|
24
|
+
* The `stably` property on projects is available via module augmentation of `@playwright/test`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { defineConfig, stablyReporter } from "@stablyai/playwright-test";
|
|
29
|
+
*
|
|
30
|
+
* export default defineConfig({
|
|
31
|
+
* reporter: [stablyReporter({ apiKey: "..." })],
|
|
32
|
+
* projects: [
|
|
33
|
+
* {
|
|
34
|
+
* name: "smoke",
|
|
35
|
+
* stably: {
|
|
36
|
+
* notifications: {
|
|
37
|
+
* slack: { channelName: "#alerts", notifyOnResult: "failures-only" },
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* },
|
|
41
|
+
* ],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const defineConfig: typeof defineConfig$1;
|
|
18
46
|
declare module "@playwright/test" {
|
|
19
47
|
type ScreenshotPromptOptions = _playwright_test.PageAssertionsToHaveScreenshotOptions;
|
|
20
48
|
interface LocatorAssertions {
|
|
@@ -26,6 +54,9 @@ declare module "@playwright/test" {
|
|
|
26
54
|
interface PlaywrightTestArgs {
|
|
27
55
|
agent: Agent;
|
|
28
56
|
}
|
|
57
|
+
interface Project {
|
|
58
|
+
stably?: StablyProjectConfig;
|
|
59
|
+
}
|
|
29
60
|
}
|
|
30
61
|
|
|
31
|
-
export { expect, test };
|
|
62
|
+
export { type StablyProjectConfig, defineConfig, expect, test };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import * as _stablyai_playwright_base from '@stablyai/playwright-base';
|
|
|
3
3
|
import { Agent } from '@stablyai/playwright-base';
|
|
4
4
|
export { Agent, setApiKey } from '@stablyai/playwright-base';
|
|
5
5
|
import * as _playwright_test from '@playwright/test';
|
|
6
|
-
import { test as test$1 } from '@playwright/test';
|
|
6
|
+
import { test as test$1, defineConfig as defineConfig$1 } from '@playwright/test';
|
|
7
7
|
export * from '@playwright/test';
|
|
8
|
-
|
|
8
|
+
import { StablyNotificationConfig } from '@stablyai/playwright-reporter';
|
|
9
|
+
export { NotificationResultPolicy, ProjectNotificationConfig, StablyEmailNotificationConfig, StablyNotificationConfig, StablyReporterOptions, StablySlackNotificationConfig, stablyReporter } from '@stablyai/playwright-reporter';
|
|
9
10
|
|
|
10
11
|
declare const test: typeof test$1;
|
|
11
12
|
declare const expect: _playwright_test.Expect<{
|
|
@@ -15,6 +16,33 @@ declare const expect: _playwright_test.Expect<{
|
|
|
15
16
|
}, received: _playwright_test.Page | _playwright_test.Locator, condition: string, options?: _stablyai_playwright_base.ScreenshotPromptOptions) => Promise<_playwright_test.MatcherReturnType>;
|
|
16
17
|
}>;
|
|
17
18
|
|
|
19
|
+
type StablyProjectConfig = {
|
|
20
|
+
notifications?: StablyNotificationConfig;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Stably-enhanced defineConfig with typed support for stably notification configuration in projects.
|
|
24
|
+
* The `stably` property on projects is available via module augmentation of `@playwright/test`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { defineConfig, stablyReporter } from "@stablyai/playwright-test";
|
|
29
|
+
*
|
|
30
|
+
* export default defineConfig({
|
|
31
|
+
* reporter: [stablyReporter({ apiKey: "..." })],
|
|
32
|
+
* projects: [
|
|
33
|
+
* {
|
|
34
|
+
* name: "smoke",
|
|
35
|
+
* stably: {
|
|
36
|
+
* notifications: {
|
|
37
|
+
* slack: { channelName: "#alerts", notifyOnResult: "failures-only" },
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* },
|
|
41
|
+
* ],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const defineConfig: typeof defineConfig$1;
|
|
18
46
|
declare module "@playwright/test" {
|
|
19
47
|
type ScreenshotPromptOptions = _playwright_test.PageAssertionsToHaveScreenshotOptions;
|
|
20
48
|
interface LocatorAssertions {
|
|
@@ -26,6 +54,9 @@ declare module "@playwright/test" {
|
|
|
26
54
|
interface PlaywrightTestArgs {
|
|
27
55
|
agent: Agent;
|
|
28
56
|
}
|
|
57
|
+
interface Project {
|
|
58
|
+
stably?: StablyProjectConfig;
|
|
59
|
+
}
|
|
29
60
|
}
|
|
30
61
|
|
|
31
|
-
export { expect, test };
|
|
62
|
+
export { type StablyProjectConfig, defineConfig, expect, test };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
+
defineConfig as playwrightDefineConfig,
|
|
3
4
|
expect as playwrightExpect,
|
|
4
5
|
test as playwrightTest
|
|
5
6
|
} from "@playwright/test";
|
|
@@ -29,8 +30,10 @@ var test = playwrightTest.extend({
|
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
32
|
var expect = playwrightExpect.extend(stablyPlaywrightMatchers);
|
|
33
|
+
var defineConfig = playwrightDefineConfig;
|
|
32
34
|
export {
|
|
33
35
|
Agent,
|
|
36
|
+
defineConfig,
|
|
34
37
|
expect,
|
|
35
38
|
setApiKey,
|
|
36
39
|
stablyReporter,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { BrowserContext } from \"@playwright/test\";\nimport {\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@playwright/test\";\nimport \"@stablyai/playwright-base\";\n\nimport type { Agent } from \"@stablyai/playwright-base\";\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nexport { stablyReporter } from \"@stablyai/playwright-reporter\";\nexport { Agent, setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend<{\n agent: Agent;\n}>({\n agent: async (\n { context }: { context: BrowserContext },\n use: (agent: Agent) => Promise<void>,\n ) => {\n // Create a default agent from the default context\n const agent = context.newAgent();\n await use(agent);\n },\n browser: async ({ browser }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowser(browser as any) as any);\n },\n context: async ({ context }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowserContext(context as any) as any);\n },\n page: async ({ page }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentPage(page as any) as any);\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@playwright/test\";\n\ndeclare module \"@playwright/test\" {\n export type ScreenshotPromptOptions =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n import(\"@playwright/test\").PageAssertionsToHaveScreenshotOptions;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // Add agent fixture to test args\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PlaywrightTestArgs {\n agent: Agent;\n }\n}\n"],"mappings":";AACA;AAAA,EACE,UAAU;AAAA,EACV,QAAQ;AAAA,OACH;AACP,OAAO;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { BrowserContext } from \"@playwright/test\";\nimport {\n defineConfig as playwrightDefineConfig,\n expect as playwrightExpect,\n test as playwrightTest,\n} from \"@playwright/test\";\nimport \"@stablyai/playwright-base\";\n\nimport type { Agent } from \"@stablyai/playwright-base\";\nimport {\n augmentBrowser,\n augmentBrowserContext,\n augmentPage,\n stablyPlaywrightMatchers,\n} from \"@stablyai/playwright-base\";\n\nimport type { StablyNotificationConfig } from \"@stablyai/playwright-reporter\";\n\nexport { stablyReporter } from \"@stablyai/playwright-reporter\";\nexport type {\n StablyReporterOptions,\n ProjectNotificationConfig,\n NotificationResultPolicy,\n StablyEmailNotificationConfig,\n StablySlackNotificationConfig,\n StablyNotificationConfig,\n} from \"@stablyai/playwright-reporter\";\nexport { Agent, setApiKey } from \"@stablyai/playwright-base\";\n\nexport const test: typeof playwrightTest = playwrightTest.extend<{\n agent: Agent;\n}>({\n agent: async (\n { context }: { context: BrowserContext },\n use: (agent: Agent) => Promise<void>,\n ) => {\n // Create a default agent from the default context\n const agent = context.newAgent();\n await use(agent);\n },\n browser: async ({ browser }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowser(browser as any) as any);\n },\n context: async ({ context }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentBrowserContext(context as any) as any);\n },\n page: async ({ page }, use) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await use(augmentPage(page as any) as any);\n },\n});\n\nexport const expect = playwrightExpect.extend(stablyPlaywrightMatchers);\n\nexport * from \"@playwright/test\";\n\nexport type StablyProjectConfig = {\n notifications?: StablyNotificationConfig;\n};\n\n/**\n * Stably-enhanced defineConfig with typed support for stably notification configuration in projects.\n * The `stably` property on projects is available via module augmentation of `@playwright/test`.\n *\n * @example\n * ```ts\n * import { defineConfig, stablyReporter } from \"@stablyai/playwright-test\";\n *\n * export default defineConfig({\n * reporter: [stablyReporter({ apiKey: \"...\" })],\n * projects: [\n * {\n * name: \"smoke\",\n * stably: {\n * notifications: {\n * slack: { channelName: \"#alerts\", notifyOnResult: \"failures-only\" },\n * },\n * },\n * },\n * ],\n * });\n * ```\n */\nexport const defineConfig = playwrightDefineConfig;\n\ndeclare module \"@playwright/test\" {\n export type ScreenshotPromptOptions =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n import(\"@playwright/test\").PageAssertionsToHaveScreenshotOptions;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface LocatorAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PageAssertions {\n toMatchScreenshotPrompt(\n condition: string,\n options?: ScreenshotPromptOptions,\n ): Promise<void>;\n }\n\n // Add agent fixture to test args\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface PlaywrightTestArgs {\n agent: Agent;\n }\n\n // Add stably config to project configuration\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface Project {\n stably?: StablyProjectConfig;\n }\n}\n"],"mappings":";AACA;AAAA,EACE,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,QAAQ;AAAA,OACH;AACP,OAAO;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAS/B,SAAS,OAAO,iBAAiB;AA6BjC,cAAc;AA3BP,IAAM,OAA8B,eAAe,OAEvD;AAAA,EACD,OAAO,OACL,EAAE,QAAQ,GACV,QACG;AAEH,UAAM,QAAQ,QAAQ,SAAS;AAC/B,UAAM,IAAI,KAAK;AAAA,EACjB;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAEnC,UAAM,IAAI,eAAe,OAAc,CAAQ;AAAA,EACjD;AAAA,EACA,SAAS,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAEnC,UAAM,IAAI,sBAAsB,OAAc,CAAQ;AAAA,EACxD;AAAA,EACA,MAAM,OAAO,EAAE,KAAK,GAAG,QAAQ;AAE7B,UAAM,IAAI,YAAY,IAAW,CAAQ;AAAA,EAC3C;AACF,CAAC;AAEM,IAAM,SAAS,iBAAiB,OAAO,wBAAwB;AA+B/D,IAAM,eAAe;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stablyai/playwright-test",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Playwright Test wrapper with Stably AI matchers",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@stablyai/playwright": "2.0.
|
|
25
|
-
"@stablyai/playwright-base": "2.0.
|
|
24
|
+
"@stablyai/playwright": "2.0.4",
|
|
25
|
+
"@stablyai/playwright-base": "2.0.4",
|
|
26
26
|
"@stablyai/playwright-reporter": "1.3.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|