@stablyai/playwright-test 2.0.9 → 2.0.11

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/dist/index.d.mts CHANGED
@@ -8,6 +8,31 @@ export * from '@playwright/test';
8
8
  import { StablyNotificationConfig } from '@stablyai/playwright-reporter';
9
9
  export { NotificationResultPolicy, ProjectNotificationConfig, StablyEmailNotificationConfig, StablyNotificationConfig, StablyReporterOptions, StablySlackNotificationConfig, stablyReporter } from '@stablyai/playwright-reporter';
10
10
 
11
+ /**
12
+ * Get the directory name from an import.meta.url.
13
+ * This is the ESM equivalent of __dirname.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { getDirname } from '@stablyai/playwright-test';
18
+ * const __dirname = getDirname(import.meta.url);
19
+ *
20
+ * // Use in tests for file paths
21
+ * await page.setInputFiles('input', path.join(__dirname, 'fixtures', 'file.pdf'));
22
+ * ```
23
+ */
24
+ declare function getDirname(importMetaUrl: string): string;
25
+ /**
26
+ * Get the filename from an import.meta.url.
27
+ * This is the ESM equivalent of __filename.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { getFilename } from '@stablyai/playwright-test';
32
+ * const __filename = getFilename(import.meta.url);
33
+ * ```
34
+ */
35
+ declare function getFilename(importMetaUrl: string): string;
11
36
  declare const test: typeof test$1;
12
37
  declare const expect: _playwright_test.Expect<{
13
38
  readonly toMatchScreenshotPrompt: (this: {
@@ -59,4 +84,4 @@ declare module "@playwright/test" {
59
84
  }
60
85
  }
61
86
 
62
- export { type StablyProjectConfig, defineConfig, expect, test };
87
+ export { type StablyProjectConfig, defineConfig, expect, getDirname, getFilename, test };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,31 @@ export * from '@playwright/test';
8
8
  import { StablyNotificationConfig } from '@stablyai/playwright-reporter';
9
9
  export { NotificationResultPolicy, ProjectNotificationConfig, StablyEmailNotificationConfig, StablyNotificationConfig, StablyReporterOptions, StablySlackNotificationConfig, stablyReporter } from '@stablyai/playwright-reporter';
10
10
 
11
+ /**
12
+ * Get the directory name from an import.meta.url.
13
+ * This is the ESM equivalent of __dirname.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { getDirname } from '@stablyai/playwright-test';
18
+ * const __dirname = getDirname(import.meta.url);
19
+ *
20
+ * // Use in tests for file paths
21
+ * await page.setInputFiles('input', path.join(__dirname, 'fixtures', 'file.pdf'));
22
+ * ```
23
+ */
24
+ declare function getDirname(importMetaUrl: string): string;
25
+ /**
26
+ * Get the filename from an import.meta.url.
27
+ * This is the ESM equivalent of __filename.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { getFilename } from '@stablyai/playwright-test';
32
+ * const __filename = getFilename(import.meta.url);
33
+ * ```
34
+ */
35
+ declare function getFilename(importMetaUrl: string): string;
11
36
  declare const test: typeof test$1;
12
37
  declare const expect: _playwright_test.Expect<{
13
38
  readonly toMatchScreenshotPrompt: (this: {
@@ -59,4 +84,4 @@ declare module "@playwright/test" {
59
84
  }
60
85
  }
61
86
 
62
- export { type StablyProjectConfig, defineConfig, expect, test };
87
+ export { type StablyProjectConfig, defineConfig, expect, getDirname, getFilename, test };
package/dist/index.mjs CHANGED
@@ -3769,6 +3769,8 @@ var require_websocket_server = __commonJS({
3769
3769
  });
3770
3770
 
3771
3771
  // src/index.ts
3772
+ import { dirname } from "path";
3773
+ import { fileURLToPath as fileURLToPath2 } from "url";
3772
3774
  import {
3773
3775
  defineConfig as playwrightDefineConfig,
3774
3776
  expect as playwrightExpect,
@@ -8297,6 +8299,12 @@ function vl(t2) {
8297
8299
  // src/index.ts
8298
8300
  import { Agent, setApiKey } from "@stablyai/playwright-base";
8299
8301
  export * from "@playwright/test";
8302
+ function getDirname(importMetaUrl) {
8303
+ return dirname(fileURLToPath2(importMetaUrl));
8304
+ }
8305
+ function getFilename(importMetaUrl) {
8306
+ return fileURLToPath2(importMetaUrl);
8307
+ }
8300
8308
  var test = playwrightTest.extend({
8301
8309
  agent: async ({ context }, use) => {
8302
8310
  const agent = context.newAgent();
@@ -8318,6 +8326,8 @@ export {
8318
8326
  Agent,
8319
8327
  defineConfig,
8320
8328
  expect,
8329
+ getDirname,
8330
+ getFilename,
8321
8331
  setApiKey,
8322
8332
  vl as stablyReporter,
8323
8333
  test