fair-playwright 1.1.0 → 1.2.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/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  <div align="center">
2
- <img src="resources/fair-playwright-logo.png" alt="fair-playwright" width="200" />
2
+ <img src="resources/fair-playwright-logo.png" alt="fair-playwright" width="500" />
3
3
 
4
- # fair-playwright
4
+ #
5
5
 
6
- > AI-optimized Playwright test reporter with progressive terminal output and hierarchical step management
6
+ AI-optimized Playwright test reporter with progressive terminal output and hierarchical step management
7
7
 
8
8
  [![npm version](https://img.shields.io/npm/v/fair-playwright.svg)](https://www.npmjs.com/package/fair-playwright)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -39,10 +39,29 @@ export default defineConfig({
39
39
 
40
40
  ### 2. Write Tests
41
41
 
42
+ **Quick Mode** (v1.1.0+) - Compact syntax:
43
+
42
44
  ```typescript
43
45
  import { test } from '@playwright/test';
44
46
  import { e2e } from 'fair-playwright';
45
47
 
48
+ test('user login', async ({ page }) => {
49
+ await e2e.quick('User login flow', [
50
+ ['Open login page', async () => {
51
+ await page.goto('/login');
52
+ }],
53
+ ['Submit credentials', async () => {
54
+ await page.getByLabel('Email').fill('user@example.com');
55
+ await page.getByLabel('Password').fill('password');
56
+ await page.getByRole('button', { name: 'Login' }).click();
57
+ }]
58
+ ]);
59
+ });
60
+ ```
61
+
62
+ **Declarative Mode** - Full control:
63
+
64
+ ```typescript
46
65
  test('user login', async ({ page }) => {
47
66
  await e2e.major('User login flow', {
48
67
  success: 'User logged in successfully',
package/dist/index.cjs CHANGED
@@ -925,6 +925,26 @@ var E2EHelperImpl = class {
925
925
  }
926
926
  });
927
927
  }
928
+ /**
929
+ * Execute a quick workflow with simplified tuple syntax (v1.1.0+)
930
+ * Converts compact syntax to declarative mode internally
931
+ */
932
+ async quick(title, steps, options) {
933
+ const stepDefinitions = steps.map((step) => {
934
+ const [stepTitle, action, stepOptions] = step;
935
+ return {
936
+ title: stepTitle,
937
+ action,
938
+ success: stepOptions?.success,
939
+ failure: stepOptions?.failure
940
+ };
941
+ });
942
+ return this.majorDeclarative(title, {
943
+ success: options?.success,
944
+ failure: options?.failure,
945
+ steps: stepDefinitions
946
+ });
947
+ }
928
948
  /**
929
949
  * Inline mode for major steps
930
950
  */
package/dist/index.d.cts CHANGED
@@ -287,6 +287,16 @@ interface MajorStepOptions {
287
287
  */
288
288
  steps?: StepDefinition[];
289
289
  }
290
+ /**
291
+ * Quick step definition - simplified tuple syntax
292
+ * [title, action] or [title, action, options]
293
+ */
294
+ type QuickStepDefinition = [string, () => Promise<void>] | [string, () => Promise<void>, StepOptions];
295
+ /**
296
+ * Options for quick mode execution
297
+ */
298
+ interface QuickModeOptions extends StepOptions {
299
+ }
290
300
  /**
291
301
  * E2E test helper interface
292
302
  */
@@ -303,6 +313,22 @@ interface E2EHelper {
303
313
  * Execute a minor step
304
314
  */
305
315
  minor(title: string, action: () => Promise<void>, options?: StepOptions): Promise<void>;
316
+ /**
317
+ * Execute a quick workflow with simplified syntax (v1.1.0+)
318
+ * Compact API for simple test cases
319
+ *
320
+ * @param title - Major step title
321
+ * @param steps - Array of [title, action] or [title, action, options] tuples
322
+ * @param options - Optional success/failure messages for major step
323
+ *
324
+ * @example
325
+ * await e2e.quick('User login', [
326
+ * ['Open page', async () => { await page.goto('/login') }],
327
+ * ['Fill form', async () => { await page.fill('#email', 'test@example.com') }],
328
+ * ['Submit', async () => { await page.click('button[type="submit"]') }]
329
+ * ])
330
+ */
331
+ quick(title: string, steps: QuickStepDefinition[], options?: QuickModeOptions): Promise<void>;
306
332
  }
307
333
 
308
334
  /**
package/dist/index.d.ts CHANGED
@@ -287,6 +287,16 @@ interface MajorStepOptions {
287
287
  */
288
288
  steps?: StepDefinition[];
289
289
  }
290
+ /**
291
+ * Quick step definition - simplified tuple syntax
292
+ * [title, action] or [title, action, options]
293
+ */
294
+ type QuickStepDefinition = [string, () => Promise<void>] | [string, () => Promise<void>, StepOptions];
295
+ /**
296
+ * Options for quick mode execution
297
+ */
298
+ interface QuickModeOptions extends StepOptions {
299
+ }
290
300
  /**
291
301
  * E2E test helper interface
292
302
  */
@@ -303,6 +313,22 @@ interface E2EHelper {
303
313
  * Execute a minor step
304
314
  */
305
315
  minor(title: string, action: () => Promise<void>, options?: StepOptions): Promise<void>;
316
+ /**
317
+ * Execute a quick workflow with simplified syntax (v1.1.0+)
318
+ * Compact API for simple test cases
319
+ *
320
+ * @param title - Major step title
321
+ * @param steps - Array of [title, action] or [title, action, options] tuples
322
+ * @param options - Optional success/failure messages for major step
323
+ *
324
+ * @example
325
+ * await e2e.quick('User login', [
326
+ * ['Open page', async () => { await page.goto('/login') }],
327
+ * ['Fill form', async () => { await page.fill('#email', 'test@example.com') }],
328
+ * ['Submit', async () => { await page.click('button[type="submit"]') }]
329
+ * ])
330
+ */
331
+ quick(title: string, steps: QuickStepDefinition[], options?: QuickModeOptions): Promise<void>;
306
332
  }
307
333
 
308
334
  /**
package/dist/index.js CHANGED
@@ -885,6 +885,26 @@ var E2EHelperImpl = class {
885
885
  }
886
886
  });
887
887
  }
888
+ /**
889
+ * Execute a quick workflow with simplified tuple syntax (v1.1.0+)
890
+ * Converts compact syntax to declarative mode internally
891
+ */
892
+ async quick(title, steps, options) {
893
+ const stepDefinitions = steps.map((step) => {
894
+ const [stepTitle, action, stepOptions] = step;
895
+ return {
896
+ title: stepTitle,
897
+ action,
898
+ success: stepOptions?.success,
899
+ failure: stepOptions?.failure
900
+ };
901
+ });
902
+ return this.majorDeclarative(title, {
903
+ success: options?.success,
904
+ failure: options?.failure,
905
+ steps: stepDefinitions
906
+ });
907
+ }
888
908
  /**
889
909
  * Inline mode for major steps
890
910
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fair-playwright",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "AI-optimized Playwright test reporter with progressive terminal output and hierarchical step management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
Binary file