@probolabs/playwright 1.2.1 → 1.4.0-rc.1
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/bin/probo.js +44 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli.js +1893 -0
- package/dist/cli.js.map +1 -0
- package/dist/fixtures.cjs +10 -3
- package/dist/fixtures.cjs.map +1 -1
- package/dist/fixtures.js +10 -3
- package/dist/fixtures.js.map +1 -1
- package/dist/index.cjs +1859 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +155 -4
- package/dist/index.js +1837 -18
- package/dist/index.js.map +1 -1
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/codegen-api.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/replay-utils.d.ts.map +1 -1
- package/dist/types/test-suite-runner.d.ts.map +1 -0
- package/package.json +9 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locator, Page } from 'playwright';
|
|
2
|
-
import { SmartSelector, ElementTag, ProboLogLevel, PlaywrightTimeoutConfig, PlaywrightAction, TotpConfig, AIModel, InitialPageState, FindCandidateInput, ServerResponse } from '@probolabs/probo-shared';
|
|
3
|
-
export { AIModel, ElementInfo, ElementTag, PlaywrightAction, ProboLogLevel } from '@probolabs/probo-shared';
|
|
2
|
+
import { SmartSelector, ElementTag, ProboLogLevel, PlaywrightTimeoutConfig, PlaywrightAction, TotpConfig, RecorderSettings, AIModel, InitialPageState, FindCandidateInput, ServerResponse } from '@probolabs/probo-shared';
|
|
3
|
+
export { AIModel, CodeGeneratorOptions, ElementInfo, ElementTag, PlaywrightAction, ProboLogLevel, createUrlSlug, extractRequiredEnvVars, generateCode, getRequiredEnvVars } from '@probolabs/probo-shared';
|
|
4
4
|
import { Page as Page$1 } from '@playwright/test';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -93,6 +93,11 @@ declare class Highlighter {
|
|
|
93
93
|
getMatchingCandidateCached(page: Page): Promise<any>;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
interface ScreenshotUrls {
|
|
97
|
+
base_screenshot_url?: string | null;
|
|
98
|
+
candidates_screenshot_url?: string | null;
|
|
99
|
+
actual_interaction_screenshot_url?: string | null;
|
|
100
|
+
}
|
|
96
101
|
interface RunStepParams extends Partial<PlaywrightTimeoutConfig> {
|
|
97
102
|
iframeSelector?: string;
|
|
98
103
|
elementSelector?: string;
|
|
@@ -104,6 +109,9 @@ interface RunStepParams extends Partial<PlaywrightTimeoutConfig> {
|
|
|
104
109
|
pollingInterval?: number;
|
|
105
110
|
timeout?: number;
|
|
106
111
|
totpConfig?: TotpConfig;
|
|
112
|
+
onScreenshots?: (urls: ScreenshotUrls) => void;
|
|
113
|
+
takeScreenshot?: (page: Page$1, type?: 'base' | 'candidates' | 'actual') => Promise<string>;
|
|
114
|
+
isApplyAIContext?: boolean;
|
|
107
115
|
}
|
|
108
116
|
interface ProboPlaywrightConfig {
|
|
109
117
|
timeoutConfig?: Partial<PlaywrightTimeoutConfig>;
|
|
@@ -117,6 +125,7 @@ declare class ProboPlaywright {
|
|
|
117
125
|
private page;
|
|
118
126
|
private params;
|
|
119
127
|
private isCanceled;
|
|
128
|
+
private highlighter;
|
|
120
129
|
constructor({ enableSmartSelectors, timeoutConfig, debugLevel, isCanceled }: ProboPlaywrightConfig, page?: Page$1 | null);
|
|
121
130
|
/**
|
|
122
131
|
* Sets the Playwright page instance for this ProboPlaywright instance.
|
|
@@ -372,6 +381,148 @@ declare class OTP {
|
|
|
372
381
|
private static parseTimestamp;
|
|
373
382
|
}
|
|
374
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Options for code generation
|
|
386
|
+
*/
|
|
387
|
+
interface CodeGenOptions {
|
|
388
|
+
useDefaultSettings?: boolean;
|
|
389
|
+
recorderSettings?: RecorderSettings;
|
|
390
|
+
viewPort?: {
|
|
391
|
+
width: number;
|
|
392
|
+
height: number;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Result of generating code for a test suite
|
|
397
|
+
*/
|
|
398
|
+
interface TestSuiteCodeGenResult {
|
|
399
|
+
testSuiteId: number;
|
|
400
|
+
testSuiteName: string;
|
|
401
|
+
scenarios: Array<{
|
|
402
|
+
scenarioId: number;
|
|
403
|
+
scenarioName: string;
|
|
404
|
+
code: string;
|
|
405
|
+
}>;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* ProboCodeGenerator - Handles fetching test suite/scenario data and generating Playwright code
|
|
409
|
+
*/
|
|
410
|
+
declare class ProboCodeGenerator {
|
|
411
|
+
/**
|
|
412
|
+
* Normalize API URL by removing trailing slash
|
|
413
|
+
*/
|
|
414
|
+
private static normalizeApiUrl;
|
|
415
|
+
private static readResponseErrorText;
|
|
416
|
+
/**
|
|
417
|
+
* Fetch scenario data from the backend API
|
|
418
|
+
*/
|
|
419
|
+
private static fetchScenarioData;
|
|
420
|
+
/**
|
|
421
|
+
* Fetch test suite data from the backend API
|
|
422
|
+
*/
|
|
423
|
+
private static fetchTestSuiteData;
|
|
424
|
+
/**
|
|
425
|
+
* Convert backend interaction format to Interaction[] format
|
|
426
|
+
*/
|
|
427
|
+
private static convertBackendInteractionsToInteractionFormat;
|
|
428
|
+
/**
|
|
429
|
+
* Get default recorder settings for code generation
|
|
430
|
+
*/
|
|
431
|
+
private static getDefaultRecorderSettings;
|
|
432
|
+
/**
|
|
433
|
+
* Get default viewport dimensions
|
|
434
|
+
*/
|
|
435
|
+
private static getDefaultViewPort;
|
|
436
|
+
/**
|
|
437
|
+
* Generate code for a single scenario
|
|
438
|
+
* Fetches scenario data, converts to Interaction[], generates code
|
|
439
|
+
*/
|
|
440
|
+
static generateCodeForScenario(scenarioId: number, apiToken: string, apiUrl: string, options?: CodeGenOptions): Promise<string>;
|
|
441
|
+
/**
|
|
442
|
+
* Generate code for all scenarios in a test suite
|
|
443
|
+
* Returns map of scenario names to generated code
|
|
444
|
+
*/
|
|
445
|
+
static generateCodeForTestSuite(testSuiteId: number, apiToken: string, apiUrl: string, options?: CodeGenOptions): Promise<TestSuiteCodeGenResult>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Result of running a test suite
|
|
450
|
+
*/
|
|
451
|
+
interface TestSuiteRunResult {
|
|
452
|
+
success: boolean;
|
|
453
|
+
exitCode: number;
|
|
454
|
+
stdout: string;
|
|
455
|
+
stderr: string;
|
|
456
|
+
error?: string;
|
|
457
|
+
runId?: number;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Test statistics parsed from Playwright output
|
|
461
|
+
*/
|
|
462
|
+
interface TestStatistics {
|
|
463
|
+
passed: number;
|
|
464
|
+
failed: number;
|
|
465
|
+
skipped: number;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Options for running a test suite
|
|
469
|
+
*/
|
|
470
|
+
interface TestSuiteRunOptions {
|
|
471
|
+
outputDir?: string;
|
|
472
|
+
includeReporter?: boolean;
|
|
473
|
+
onStatusUpdate?: (updates: Partial<{
|
|
474
|
+
status: string;
|
|
475
|
+
exit_code: number;
|
|
476
|
+
error_message: string;
|
|
477
|
+
stdout: string;
|
|
478
|
+
stderr: string;
|
|
479
|
+
tests_total: number;
|
|
480
|
+
tests_passed: number;
|
|
481
|
+
tests_failed: number;
|
|
482
|
+
tests_skipped: number;
|
|
483
|
+
}>) => void | Promise<void>;
|
|
484
|
+
onStdout?: (chunk: string) => void | Promise<void>;
|
|
485
|
+
onStderr?: (chunk: string) => void | Promise<void>;
|
|
486
|
+
onReporterEvent?: (event: any) => void | Promise<void>;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* TestSuiteRunner - Handles test suite file generation and execution
|
|
490
|
+
*/
|
|
491
|
+
declare class TestSuiteRunner {
|
|
492
|
+
/**
|
|
493
|
+
* Lookup test suite ID by name and project
|
|
494
|
+
*/
|
|
495
|
+
static lookupTestSuiteByName(testSuiteName: string, projectName: string, apiToken: string, apiUrl: string): Promise<number>;
|
|
496
|
+
/**
|
|
497
|
+
* Generate all files for a test suite
|
|
498
|
+
*/
|
|
499
|
+
static generateTestSuiteFiles(testSuiteId: number, apiToken: string, apiUrl: string, outputDir?: string, testSuiteName?: string, includeReporter?: boolean, runId?: number): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* Generate package.json file
|
|
502
|
+
*/
|
|
503
|
+
static generatePackageJson(outputDir: string, codeGenResult: TestSuiteCodeGenResult): Promise<void>;
|
|
504
|
+
/**
|
|
505
|
+
* Generate playwright.config.ts file
|
|
506
|
+
*/
|
|
507
|
+
static generatePlaywrightConfig(outputDir: string, includeReporter?: boolean, runId?: number): Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* Generate Probo custom Playwright reporter (for live step/test events)
|
|
510
|
+
*/
|
|
511
|
+
static generateProboReporter(outputDir: string): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* Run a test suite
|
|
514
|
+
* Generates files, installs dependencies, and executes tests
|
|
515
|
+
*/
|
|
516
|
+
static runTestSuite(testSuiteId: number, apiToken: string, apiUrl: string, testSuiteName?: string, runId?: number, options?: TestSuiteRunOptions): Promise<TestSuiteRunResult>;
|
|
517
|
+
/**
|
|
518
|
+
* Upload artifacts for a test suite run
|
|
519
|
+
*
|
|
520
|
+
* NOTE: This method is preserved for potential future use but is currently disabled.
|
|
521
|
+
* Artifacts are now accessed locally via the trace viewer instead of being uploaded to the backend.
|
|
522
|
+
*/
|
|
523
|
+
static uploadArtifacts(runId: number, testSuiteId: number, testSuiteDir: string, apiToken: string, apiUrl: string): Promise<void>;
|
|
524
|
+
}
|
|
525
|
+
|
|
375
526
|
/**
|
|
376
527
|
* Configuration options for Probo client
|
|
377
528
|
*/
|
|
@@ -436,5 +587,5 @@ declare class Probo {
|
|
|
436
587
|
askAIHelper(page: Page, question: string, options: AskAIOptions, assertAnswer?: string): Promise<ServerResponse>;
|
|
437
588
|
}
|
|
438
589
|
|
|
439
|
-
export { Highlighter, NavTracker, OTP, Probo, ProboPlaywright, findClosestVisibleElement };
|
|
440
|
-
export type { AskAIOptions, ElementTagType, MailinatorMessage, RunStepOptions };
|
|
590
|
+
export { Highlighter, NavTracker, OTP, Probo, ProboCodeGenerator, ProboPlaywright, TestSuiteRunner, findClosestVisibleElement };
|
|
591
|
+
export type { AskAIOptions, CodeGenOptions, ElementTagType, MailinatorMessage, RunStepOptions, TestStatistics, TestSuiteCodeGenResult, TestSuiteRunOptions, TestSuiteRunResult };
|