@wopee-io/wopee.pw 4.23.1 → 4.24.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.
@@ -54,6 +54,7 @@ class Wopee {
54
54
  }
55
55
  startScenario(scenarioName, testInfo) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
+ var _a;
57
58
  if (this._config.screenshotValidation.screenshotValidationEnabled) {
58
59
  const scenario = yield this._screenshotValidation.createIntegrationScenario({ scenarioName });
59
60
  if (testInfo) {
@@ -61,6 +62,12 @@ class Wopee {
61
62
  contentType: 'text/plain',
62
63
  body: scenario === null || scenario === void 0 ? void 0 : scenario.uuid,
63
64
  });
65
+ if ((_a = this._screenshotValidation.suite) === null || _a === void 0 ? void 0 : _a.uuid) {
66
+ yield testInfo.attach('wopee-suite-uuid', {
67
+ contentType: 'text/plain',
68
+ body: this._screenshotValidation.suite.uuid,
69
+ });
70
+ }
64
71
  }
65
72
  }
66
73
  });
@@ -1 +1 @@
1
- {"version":3,"file":"wopee.js","sourceRoot":"","sources":["../../../../lib/core/services/wopeeService/wopee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+GAAyG;AACzG,uDAA8D;AAS9D,iDAUiC;AAOjC,MAAa,KAAK;IAQhB;QAPQ,YAAO,GAAiB,IAAI,CAAC;QAQnC,IAAA,6BAAkB,GAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,sCAAgB,EAAE,CAAC,UAAU,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,2BAA2B,EAAE,CAAC;YAClE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAChE,CAAC;IACH,CAAC;IAMO,yBAAyB;;QAC/B,MAAM,mBAAmB,GAAwB;YAC/C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM;YAChD,MAAM,EAAE,IAAI,CAAC,OAA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O,MAAM,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;KAAA;CACF;AAnOD,sBAmOC","sourcesContent":["import { EnvConfigAdapter } from '../../../infrastructure/adapters/envConfigAdapter/envConfigAdapter.js';\nimport { logVersionMetadata } from '../../../shared/index.js';\nimport { WopeeOptions } from '../../domain/configuration/config.interface.js';\nimport {\n TrackElementOptions,\n TrackFullPageOptions,\n TrackImageOptions,\n TrackViewportOptions,\n} from '../../domain/valueObjects/track.interface.js';\nimport { VisualAssertOptions } from '../../domain/valueObjects/visualAssert.interface.js';\nimport {\n ApolloAdapter,\n ApolloAdapterConfig,\n CreateIntegrationStepPayload,\n CreateIntegrationStepPayloadSchema,\n IntegrationStep,\n VisualAssert,\n VisualAssertPayload,\n VisualAssertPayloadSchema,\n createApolloTrackAdapter,\n} from '@autonomous-testing/sdk';\nimport { LocatorScreenshotOptions, PageScreenshotOptions, TestInfo } from '@playwright/test';\n\n/**\n * The Wopee class provides methods to configure and manage screenshot validation\n * for testing environments, leveraging external APIs and customized options.\n */\nexport class Wopee {\n private _config: WopeeOptions = null;\n private _screenshotValidation: ApolloAdapter;\n\n /**\n * Initializes the class by logging version metadata, parsing configuration,\n * and setting up instance options based on environmental variables or defaults.\n */\n constructor() {\n logVersionMetadata();\n this._config = new EnvConfigAdapter().loadConfig();\n\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n this._screenshotValidation = this._createApolloTrackAdapter();\n }\n }\n\n /**\n * Creates an ApolloTrackAdapter for tracking and validating screenshots.\n * @returns {ApolloTrackAdapter} The initialized tracking adapter.\n */\n private _createApolloTrackAdapter(): ApolloAdapter {\n const apolloAdapterConfig: ApolloAdapterConfig = {\n apiKey: this._config.screenshotValidation.apiKey,\n apiUrl: this._config.screenshotValidation.apiUrl,\n branchName: this._config.screenshotValidation?.branchName,\n enableSoftAssert: this._config.screenshotValidation?.enableSoftAssert,\n projectUuid: this._config.screenshotValidation.projectUuid,\n browser: this._config.screenshotValidation?.browser,\n comment: this._config.screenshotValidation?.comment,\n device: this._config.screenshotValidation?.device,\n os: this._config.screenshotValidation?.os,\n pixelToPixelDiffTolerance: this._config.screenshotValidation.pixelToPixelDiffTolerance,\n viewport: this._config.screenshotValidation?.viewport,\n customTags: this._config.screenshotValidation?.customTags,\n baselineBranchName: this._config.screenshotValidation?.baselineBranchName,\n suiteUuid: this._config.screenshotValidation?.suiteUuid,\n };\n return createApolloTrackAdapter({\n apolloAdapterConfig: apolloAdapterConfig,\n loggerOptions: { logger: 'ConsoleLogger' },\n });\n }\n\n /**\n * Starts the screenshot validation process, create/connect to Suite.\n */\n async startSuite(suiteName: string): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n await this._screenshotValidation.createIntegrationSuite({ suiteName });\n }\n }\n\n /**\n * Starts the screenshot validation process, create/connect to Suite.\n */\n async startScenario(scenarioName: string, testInfo?: TestInfo): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const scenario = await this._screenshotValidation.createIntegrationScenario({ scenarioName });\n if (testInfo) {\n await testInfo.attach('wopee-scenario-uuid', {\n contentType: 'text/plain',\n body: scenario?.uuid,\n });\n }\n }\n }\n\n /**\n * Stops the screenshot validation process.\n */\n async stopScenario(): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n await this._screenshotValidation.stopIntegrationScenario();\n }\n }\n\n async _trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep> {\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackImageOptions,\n });\n return await this._screenshotValidation.createIntegrationStep(payload);\n }\n\n /**\n * Submits a given image for tracking and validation.\n * @param trackImageOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackImage(trackImageOptions);\n }\n return null;\n }\n\n async _trackFullPage(trackFullPageOptions: TrackFullPageOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n let pageContentBase64 = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const pageScreenshotOptions: PageScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n fullPage: true,\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackFullPageOptions.page.screenshot(pageScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n if (this._config.screenshotValidation.collectPageContent) {\n const pageContent = await trackFullPageOptions.page.content();\n pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');\n }\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackFullPageOptions,\n imageBase64,\n pageContentBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a full page screenshot for validation.\n * @param trackFullPageOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackFullPage(trackFullPageOptions: TrackFullPageOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackFullPage(trackFullPageOptions);\n }\n return null;\n }\n\n async _trackElement(trackElementOptions: TrackElementOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const locatorScreenshotOptions: LocatorScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackElementOptions.locator.screenshot(locatorScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackElementOptions,\n imageBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a element screenshot for validation.\n * @param trackElementOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackElement(trackElementOptions: TrackElementOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackElement(trackElementOptions);\n }\n return null;\n }\n\n async _trackViewport(trackViewportOptions: TrackViewportOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n let pageContentBase64 = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const pageScreenshotOptions: PageScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n fullPage: false,\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackViewportOptions.page.screenshot(pageScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n if (this._config.screenshotValidation.collectPageContent) {\n const pageContent = await trackViewportOptions.page.content();\n pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');\n }\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackViewportOptions,\n imageBase64,\n pageContentBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a viewport screenshot for validation.\n * @param TrackViewportOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackViewport(trackViewportOptions: TrackViewportOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackViewport(trackViewportOptions);\n }\n return null;\n }\n\n /**\n * Visual assert based on provided context, prompt (question) against an image.\n * Provide either imageBase64 or page object to take a screenshot at the current state.\n * @param VisualAssertOptions Parameters for visual assertion.\n * @returns {VisualAssert} The result of the visual assertion operation.\n */\n async visualAssert(visualAssertOptions: VisualAssertOptions): Promise<VisualAssert> {\n let imageBase64 = null;\n if (visualAssertOptions.imageBase64) {\n imageBase64 = visualAssertOptions.imageBase64;\n } else if (visualAssertOptions.page) {\n const imageBuffer = await visualAssertOptions.page.screenshot();\n imageBase64 = imageBuffer.toString('base64');\n }\n const payload: VisualAssertPayload = VisualAssertPayloadSchema.parse({\n imageBase64,\n prompt: visualAssertOptions.prompt,\n context: visualAssertOptions.context,\n });\n return await this._screenshotValidation.visualAssert(payload);\n }\n}\n"]}
1
+ {"version":3,"file":"wopee.js","sourceRoot":"","sources":["../../../../lib/core/services/wopeeService/wopee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+GAAyG;AACzG,uDAA8D;AAS9D,iDAUiC;AAOjC,MAAa,KAAK;IAQhB;QAPQ,YAAO,GAAiB,IAAI,CAAC;QAQnC,IAAA,6BAAkB,GAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,sCAAgB,EAAE,CAAC,UAAU,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,2BAA2B,EAAE,CAAC;YAClE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAChE,CAAC;IACH,CAAC;IAMO,yBAAyB;;QAC/B,MAAM,mBAAmB,GAAwB;YAC/C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM;YAChD,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM;YAChD,UAAU,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,UAAU;YACzD,gBAAgB,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,gBAAgB;YACrE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,WAAW;YAC1D,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,OAAO;YACnD,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,OAAO;YACnD,MAAM,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,MAAM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AC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC3E,CAAC;gBACD,MAAM,OAAO,GAAiC,wCAAkC,CAAC,KAAK,iCACjF,oBAAoB,KACvB,WAAW;oBACX,iBAAiB,IACjB,CAAC;gBACH,iBAAiB,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YACtF,CAAC;YACD,OAAO,iBAAiB,CAAC;QAC3B,CAAC;KAAA;IAOK,aAAa,CAAC,oBAA0C;;YAC5D,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,2BAA2B,EAAE,CAAC;gBAClE,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAQK,YAAY,CAAC,mBAAwC;;YACzD,IAAI,WAAW,GAAG,IAAI,CAAC;YACvB,IAAI,mBAAmB,CAAC,WAAW,EAAE,CAAC;gBACpC,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC;YAChD,CAAC;iBAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE,CAAC;gBACpC,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChE,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC/C,CAAC;YACD,MAAM,OAAO,GAAwB,+BAAyB,CAAC,KAAK,CAAC;gBACnE,WAAW;gBACX,MAAM,EAAE,mBAAmB,CAAC,MAAM;gBAClC,OAAO,EAAE,mBAAmB,CAAC,OAAO;aACrC,CAAC,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;KAAA;CACF;AA1OD,sBA0OC","sourcesContent":["import { EnvConfigAdapter } from '../../../infrastructure/adapters/envConfigAdapter/envConfigAdapter.js';\nimport { logVersionMetadata } from '../../../shared/index.js';\nimport { WopeeOptions } from '../../domain/configuration/config.interface.js';\nimport {\n TrackElementOptions,\n TrackFullPageOptions,\n TrackImageOptions,\n TrackViewportOptions,\n} from '../../domain/valueObjects/track.interface.js';\nimport { VisualAssertOptions } from '../../domain/valueObjects/visualAssert.interface.js';\nimport {\n ApolloAdapter,\n ApolloAdapterConfig,\n CreateIntegrationStepPayload,\n CreateIntegrationStepPayloadSchema,\n IntegrationStep,\n VisualAssert,\n VisualAssertPayload,\n VisualAssertPayloadSchema,\n createApolloTrackAdapter,\n} from '@autonomous-testing/sdk';\nimport { LocatorScreenshotOptions, PageScreenshotOptions, TestInfo } from '@playwright/test';\n\n/**\n * The Wopee class provides methods to configure and manage screenshot validation\n * for testing environments, leveraging external APIs and customized options.\n */\nexport class Wopee {\n private _config: WopeeOptions = null;\n private _screenshotValidation: ApolloAdapter;\n\n /**\n * Initializes the class by logging version metadata, parsing configuration,\n * and setting up instance options based on environmental variables or defaults.\n */\n constructor() {\n logVersionMetadata();\n this._config = new EnvConfigAdapter().loadConfig();\n\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n this._screenshotValidation = this._createApolloTrackAdapter();\n }\n }\n\n /**\n * Creates an ApolloTrackAdapter for tracking and validating screenshots.\n * @returns {ApolloTrackAdapter} The initialized tracking adapter.\n */\n private _createApolloTrackAdapter(): ApolloAdapter {\n const apolloAdapterConfig: ApolloAdapterConfig = {\n apiKey: this._config.screenshotValidation.apiKey,\n apiUrl: this._config.screenshotValidation.apiUrl,\n branchName: this._config.screenshotValidation?.branchName,\n enableSoftAssert: this._config.screenshotValidation?.enableSoftAssert,\n projectUuid: this._config.screenshotValidation.projectUuid,\n browser: this._config.screenshotValidation?.browser,\n comment: this._config.screenshotValidation?.comment,\n device: this._config.screenshotValidation?.device,\n os: this._config.screenshotValidation?.os,\n pixelToPixelDiffTolerance: this._config.screenshotValidation.pixelToPixelDiffTolerance,\n viewport: this._config.screenshotValidation?.viewport,\n customTags: this._config.screenshotValidation?.customTags,\n baselineBranchName: this._config.screenshotValidation?.baselineBranchName,\n suiteUuid: this._config.screenshotValidation?.suiteUuid,\n };\n return createApolloTrackAdapter({\n apolloAdapterConfig: apolloAdapterConfig,\n loggerOptions: { logger: 'ConsoleLogger' },\n });\n }\n\n /**\n * Starts the screenshot validation process, create/connect to Suite.\n */\n async startSuite(suiteName: string): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n await this._screenshotValidation.createIntegrationSuite({ suiteName });\n }\n }\n\n /**\n * Starts the screenshot validation process, create/connect to Suite.\n */\n async startScenario(scenarioName: string, testInfo?: TestInfo): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const scenario = await this._screenshotValidation.createIntegrationScenario({ scenarioName });\n if (testInfo) {\n await testInfo.attach('wopee-scenario-uuid', {\n contentType: 'text/plain',\n body: scenario?.uuid,\n });\n // Lets the wopee reporter stop the suite at the end of the run (worker → reporter channel).\n if (this._screenshotValidation.suite?.uuid) {\n await testInfo.attach('wopee-suite-uuid', {\n contentType: 'text/plain',\n body: this._screenshotValidation.suite.uuid,\n });\n }\n }\n }\n }\n\n /**\n * Stops the screenshot validation process.\n */\n async stopScenario(): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n await this._screenshotValidation.stopIntegrationScenario();\n }\n }\n\n async _trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep> {\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackImageOptions,\n });\n return await this._screenshotValidation.createIntegrationStep(payload);\n }\n\n /**\n * Submits a given image for tracking and validation.\n * @param trackImageOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackImage(trackImageOptions);\n }\n return null;\n }\n\n async _trackFullPage(trackFullPageOptions: TrackFullPageOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n let pageContentBase64 = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const pageScreenshotOptions: PageScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n fullPage: true,\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackFullPageOptions.page.screenshot(pageScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n if (this._config.screenshotValidation.collectPageContent) {\n const pageContent = await trackFullPageOptions.page.content();\n pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');\n }\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackFullPageOptions,\n imageBase64,\n pageContentBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a full page screenshot for validation.\n * @param trackFullPageOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackFullPage(trackFullPageOptions: TrackFullPageOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackFullPage(trackFullPageOptions);\n }\n return null;\n }\n\n async _trackElement(trackElementOptions: TrackElementOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const locatorScreenshotOptions: LocatorScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackElementOptions.locator.screenshot(locatorScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackElementOptions,\n imageBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a element screenshot for validation.\n * @param trackElementOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackElement(trackElementOptions: TrackElementOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackElement(trackElementOptions);\n }\n return null;\n }\n\n async _trackViewport(trackViewportOptions: TrackViewportOptions): Promise<IntegrationStep> {\n let apolloTrackResult: IntegrationStep = null;\n let pageContentBase64 = null;\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n const pageScreenshotOptions: PageScreenshotOptions = {\n animations: 'disabled',\n caret: 'initial',\n fullPage: false,\n scale: 'css',\n type: 'png',\n };\n const imageBuffer = await trackViewportOptions.page.screenshot(pageScreenshotOptions);\n const imageBase64 = imageBuffer.toString('base64');\n if (this._config.screenshotValidation.collectPageContent) {\n const pageContent = await trackViewportOptions.page.content();\n pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');\n }\n const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackViewportOptions,\n imageBase64,\n pageContentBase64,\n });\n apolloTrackResult = await this._screenshotValidation.createIntegrationStep(payload);\n }\n return apolloTrackResult;\n }\n\n /**\n * Captures and tracks a viewport screenshot for validation.\n * @param TrackViewportOptions Parameters for image tracking.\n * @returns {ApolloTrackResult} The result of the tracking operation.\n */\n async trackViewport(trackViewportOptions: TrackViewportOptions): Promise<IntegrationStep> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n return await this._trackViewport(trackViewportOptions);\n }\n return null;\n }\n\n /**\n * Visual assert based on provided context, prompt (question) against an image.\n * Provide either imageBase64 or page object to take a screenshot at the current state.\n * @param VisualAssertOptions Parameters for visual assertion.\n * @returns {VisualAssert} The result of the visual assertion operation.\n */\n async visualAssert(visualAssertOptions: VisualAssertOptions): Promise<VisualAssert> {\n let imageBase64 = null;\n if (visualAssertOptions.imageBase64) {\n imageBase64 = visualAssertOptions.imageBase64;\n } else if (visualAssertOptions.page) {\n const imageBuffer = await visualAssertOptions.page.screenshot();\n imageBase64 = imageBuffer.toString('base64');\n }\n const payload: VisualAssertPayload = VisualAssertPayloadSchema.parse({\n imageBase64,\n prompt: visualAssertOptions.prompt,\n context: visualAssertOptions.context,\n });\n return await this._screenshotValidation.visualAssert(payload);\n }\n}\n"]}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logVersionMetadata = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const logVersionMetadata = () => {
6
- let version = "4.23.1"
7
- let hash = "a6738eeb512dd35e98c310822f57e54b9f44d388"
6
+ let version = "4.24.1"
7
+ let hash = "6a947e32ebe5ad9c11c3cb5f04bd5d70472c5083"
8
8
  if (version === '__LOCAL__') {
9
9
  version = process.env.npm_package_version || '__LOCAL__';
10
10
  }
@@ -4,26 +4,36 @@ declare const ExtendIntegrationScenarioPayloadSchema: z.ZodObject<{
4
4
  projectUuid: z.ZodString;
5
5
  scenarioUuid: z.ZodString;
6
6
  pwSteps: z.ZodString;
7
+ githubRunId: z.ZodOptional<z.ZodString>;
8
+ githubRunAttempt: z.ZodOptional<z.ZodNumber>;
7
9
  }, "strip", z.ZodTypeAny, {
8
10
  projectUuid?: string;
9
11
  scenarioUuid?: string;
10
12
  pwSteps?: string;
13
+ githubRunId?: string;
14
+ githubRunAttempt?: number;
11
15
  }, {
12
16
  projectUuid?: string;
13
17
  scenarioUuid?: string;
14
18
  pwSteps?: string;
19
+ githubRunId?: string;
20
+ githubRunAttempt?: number;
15
21
  }>;
16
22
  }, "strip", z.ZodTypeAny, {
17
23
  input?: {
18
24
  projectUuid?: string;
19
25
  scenarioUuid?: string;
20
26
  pwSteps?: string;
27
+ githubRunId?: string;
28
+ githubRunAttempt?: number;
21
29
  };
22
30
  }, {
23
31
  input?: {
24
32
  projectUuid?: string;
25
33
  scenarioUuid?: string;
26
34
  pwSteps?: string;
35
+ githubRunId?: string;
36
+ githubRunAttempt?: number;
27
37
  };
28
38
  }>;
29
39
  type ExtendIntegrationScenarioPayload = z.infer<typeof ExtendIntegrationScenarioPayloadSchema>;
@@ -11,6 +11,8 @@ const ExtendIntegrationScenarioPayloadSchema = zod_1.z.object({
11
11
  required_error: 'Scenario UUID is required, please propagate "testInfo" as second argument in "test.beforeEach" hook and pass it to "wopee.startScenario("scenarioTitle", testInfo)" method as second argument if you want to use features of Wopee reporter',
12
12
  }),
13
13
  pwSteps: zod_1.z.string(),
14
+ githubRunId: zod_1.z.string().optional(),
15
+ githubRunAttempt: zod_1.z.number().optional(),
14
16
  }),
15
17
  });
16
18
  exports.ExtendIntegrationScenarioPayloadSchema = ExtendIntegrationScenarioPayloadSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"wopeeReporter.interface.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/types/wopeeReporter.interface.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,sCAAsC,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACpB,cAAc,EAAE,0BAA0B;SAC3C,CAAC;QACF,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,cAAc,EACZ,6OAA6O;SAChP,CAAC;QACF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC;AAIM,wFAAsC","sourcesContent":["import { z } from 'zod';\n\nconst ExtendIntegrationScenarioPayloadSchema = z.object({\n input: z.object({\n projectUuid: z.string({\n required_error: 'Project UUID is required',\n }),\n scenarioUuid: z.string({\n required_error:\n 'Scenario UUID is required, please propagate \"testInfo\" as second argument in \"test.beforeEach\" hook and pass it to \"wopee.startScenario(\"scenarioTitle\", testInfo)\" method as second argument if you want to use features of Wopee reporter',\n }),\n pwSteps: z.string(),\n }),\n});\n\ntype ExtendIntegrationScenarioPayload = z.infer<typeof ExtendIntegrationScenarioPayloadSchema>;\n\nexport { ExtendIntegrationScenarioPayloadSchema, ExtendIntegrationScenarioPayload };\n"]}
1
+ {"version":3,"file":"wopeeReporter.interface.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/types/wopeeReporter.interface.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,sCAAsC,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACpB,cAAc,EAAE,0BAA0B;SAC3C,CAAC;QACF,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,cAAc,EACZ,6OAA6O;SAChP,CAAC;QACF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;QAGnB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACxC,CAAC;CACH,CAAC,CAAC;AAIM,wFAAsC","sourcesContent":["import { z } from 'zod';\n\nconst ExtendIntegrationScenarioPayloadSchema = z.object({\n input: z.object({\n projectUuid: z.string({\n required_error: 'Project UUID is required',\n }),\n scenarioUuid: z.string({\n required_error:\n 'Scenario UUID is required, please propagate \"testInfo\" as second argument in \"test.beforeEach\" hook and pass it to \"wopee.startScenario(\"scenarioTitle\", testInfo)\" method as second argument if you want to use features of Wopee reporter',\n }),\n pwSteps: z.string(),\n // Set automatically inside GitHub Actions; lets the backend link this\n // execution to its workflow run so the raw Actions log can be fetched later.\n githubRunId: z.string().optional(),\n githubRunAttempt: z.number().optional(),\n }),\n});\n\ntype ExtendIntegrationScenarioPayload = z.infer<typeof ExtendIntegrationScenarioPayloadSchema>;\n\nexport { ExtendIntegrationScenarioPayloadSchema, ExtendIntegrationScenarioPayload };\n"]}
@@ -2,8 +2,11 @@ import type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';
2
2
  import 'dotenv/config';
3
3
  export declare class WopeeReporter implements Reporter {
4
4
  private uploadQueue;
5
+ private suiteUuids;
5
6
  constructor();
6
7
  onTestEnd(test: TestCase, result: TestResult): void;
7
8
  onExit(): Promise<void>;
9
+ private apiRequestConfig;
10
+ private stopSuites;
8
11
  printsToStdio(): boolean;
9
12
  }
@@ -23,12 +23,17 @@ const { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;
23
23
  class WopeeReporter {
24
24
  constructor() {
25
25
  this.uploadQueue = [];
26
+ this.suiteUuids = new Set();
26
27
  }
27
28
  onTestEnd(test, result) {
28
- var _a, _b;
29
+ var _a, _b, _c, _d;
29
30
  const testRunId = (0, helpers_1.generateTestRunId)();
30
- const wopeeScenarioUuid = (_b = (_a = result.attachments
31
- .find((a) => (a === null || a === void 0 ? void 0 : a.name) === 'wopee-scenario-uuid')) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.toString('utf-8');
31
+ const wopeeSuiteUuid = (_b = (_a = result.attachments.find((a) => (a === null || a === void 0 ? void 0 : a.name) === 'wopee-suite-uuid')) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.toString('utf-8');
32
+ if (wopeeSuiteUuid) {
33
+ this.suiteUuids.add(wopeeSuiteUuid);
34
+ }
35
+ const wopeeScenarioUuid = (_d = (_c = result.attachments
36
+ .find((a) => (a === null || a === void 0 ? void 0 : a.name) === 'wopee-scenario-uuid')) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.toString('utf-8');
32
37
  const failedStep = [...result.steps].reverse().find((step) => step.error);
33
38
  const createStepId = (step) => `${step.title}-${step.category}-${step.startTime}`;
34
39
  const failedStepId = failedStep ? createStepId(failedStep) : null;
@@ -86,21 +91,17 @@ class WopeeReporter {
86
91
  extendIntegrationScenario(input: $input)
87
92
  }`;
88
93
  const extendIntegrationScenarioPayload = {
89
- input: {
90
- projectUuid: WOPEE_PROJECT_UUID,
91
- scenarioUuid: wopeeScenarioUuid,
92
- pwSteps: JSON.stringify(steps, helpers_1.replacer),
93
- },
94
+ input: Object.assign(Object.assign({ projectUuid: WOPEE_PROJECT_UUID, scenarioUuid: wopeeScenarioUuid, pwSteps: JSON.stringify(steps, helpers_1.replacer) }, (process.env.GITHUB_RUN_ID && {
95
+ githubRunId: process.env.GITHUB_RUN_ID,
96
+ })), (process.env.GITHUB_RUN_ATTEMPT && {
97
+ githubRunAttempt: Number(process.env.GITHUB_RUN_ATTEMPT),
98
+ })),
94
99
  };
95
100
  const variables = wopeeReporter_interface_js_1.ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);
96
101
  const uploadPromise = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
97
102
  var _a, _b;
98
103
  try {
99
- const apiUrl = WOPEE_API_URL || 'https://api.wopee.io';
100
- const headers = {
101
- api_key: WOPEE_API_KEY,
102
- };
103
- const config = (0, axios_config_js_1.buildAxiosConfig)(apiUrl, headers);
104
+ const { apiUrl, config } = this.apiRequestConfig();
104
105
  const response = yield axios_1.default.post(apiUrl, { query, variables }, config);
105
106
  resolve(response);
106
107
  }
@@ -132,6 +133,40 @@ class WopeeReporter {
132
133
  this.uploadQueue = [];
133
134
  }
134
135
  }
136
+ yield this.stopSuites();
137
+ });
138
+ }
139
+ apiRequestConfig() {
140
+ const apiUrl = WOPEE_API_URL || 'https://api.wopee.io';
141
+ const headers = {
142
+ api_key: WOPEE_API_KEY,
143
+ };
144
+ return { apiUrl, config: (0, axios_config_js_1.buildAxiosConfig)(apiUrl, headers) };
145
+ }
146
+ stopSuites() {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ var _a, _b;
149
+ const query = `
150
+ mutation StopIntegrationSuite($suiteUuid: ID!) {
151
+ stopIntegrationSuite(suiteUuid: $suiteUuid) { uuid suiteRunningStatus }
152
+ }`;
153
+ for (const suiteUuid of this.suiteUuids) {
154
+ try {
155
+ const { apiUrl, config } = this.apiRequestConfig();
156
+ const response = yield axios_1.default.post(apiUrl, { query, variables: { suiteUuid } }, config);
157
+ const errors = (_a = response.data) === null || _a === void 0 ? void 0 : _a.errors;
158
+ if (errors === null || errors === void 0 ? void 0 : errors.length) {
159
+ console.error(`[WOPEE_REPORTER_ERROR] Failed to stop suite ${suiteUuid}:`, (_b = errors[0]) === null || _b === void 0 ? void 0 : _b.message);
160
+ }
161
+ else {
162
+ console.log(`Suite(uuid=${suiteUuid}) is stopped.`);
163
+ }
164
+ }
165
+ catch (error) {
166
+ console.error(`[WOPEE_REPORTER_ERROR] Failed to stop suite ${suiteUuid}: ${error === null || error === void 0 ? void 0 : error.message}`);
167
+ }
168
+ }
169
+ this.suiteUuids.clear();
135
170
  });
136
171
  }
137
172
  printsToStdio() {
@@ -1 +1 @@
1
- {"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAsF;AACtF,+DAA6D;AAC7D,mFAG4C;AAE5C,kDAA0B;AAC1B,yBAAuB;AACvB,sDAAyB;AAEzB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzE,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,SAAS,CAAC,IAAc,EAAE,MAAkB;;QAC1C,MAAM,SAAS,GAAG,IAAA,2BAAiB,GAAE,CAAC;QAEtC,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAM,CAAC,WAAW;aACzC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,MAAK,qBAAqB,CAAC,0CAC7C,IAAI,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE5B,MAAM,UAAU,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,C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qE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAC3G,CAAC;QACH,CAAC,CAAA,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC;IAEK,MAAM;;YACV,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,WAAW,CAAC,MAAM,4BAA4B,CAAC,CAAC;gBAC9E,IAAI,CAAC;oBACH,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACpC,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;gBACzD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;gBACxD,CAAC;wBAAS,CAAC;oBACT,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IAED,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAlID,sCAkIC","sourcesContent":["import { generateTestRunId, parseError, parseNestedSteps, replacer } from './helpers';\nimport { buildAxiosConfig } from './helpers/axios-config.js';\nimport {\n ExtendIntegrationScenarioPayload,\n ExtendIntegrationScenarioPayloadSchema,\n} from './types/wopeeReporter.interface.js';\nimport type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';\nimport axios from 'axios';\nimport 'dotenv/config';\nimport fs from 'node:fs';\n\nconst { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;\n\nexport class WopeeReporter implements Reporter {\n private uploadQueue: Promise<any>[];\n\n constructor() {\n this.uploadQueue = [];\n }\n\n onTestEnd(test: TestCase, result: TestResult) {\n const testRunId = generateTestRunId();\n\n const wopeeScenarioUuid = result.attachments\n .find((a) => a?.name === 'wopee-scenario-uuid')\n ?.body?.toString('utf-8');\n\n const failedStep = [...result.steps].reverse().find((step) => step.error);\n\n const createStepId = (step: any) => `${step.title}-${step.category}-${step.startTime}`;\n const failedStepId = failedStep ? createStepId(failedStep) : null;\n\n let screenshotBase64: string | null = null;\n let videoBase64: string | null = null;\n\n for (const attachment of result.attachments) {\n if (attachment.name === 'screenshot' && attachment.contentType === 'image/png') {\n const filePath = attachment.path;\n if (filePath) {\n try {\n const imageBuffer = fs.readFileSync(filePath);\n screenshotBase64 = imageBuffer.toString('base64');\n } catch (error) {\n console.error('Error reading screenshot:', error);\n }\n }\n }\n\n if (\n attachment.name === 'video' &&\n (attachment.contentType === 'video/webm' ||\n attachment.contentType === 'video/mp4' ||\n attachment.contentType === 'video/avi')\n ) {\n const filePath = attachment.path;\n if (filePath) {\n try {\n const videoBuffer = fs.readFileSync(filePath);\n videoBase64 = videoBuffer.toString('base64');\n } catch (error) {\n console.error('Error reading video:', error);\n }\n }\n }\n }\n\n if (!wopeeScenarioUuid) {\n return console.error(\n '[WOPEE_REPORTER_ERROR]: Scenario UUID is required, please propagate \"testInfo\" as second argument in \"test.beforeEach\" hook and pass it to \"wopee.startScenario(\"scenarioTitle\", testInfo)\" method as second argument if you want to use features of Wopee reporter',\n );\n }\n\n const steps = result.steps.map((step, index) => ({\n testRunId,\n number: index + 1,\n testTitle: test.title,\n title: step.title,\n status: step.error ? 'failed' : 'passed',\n error: step.error ? parseError(step.error) : step.error,\n category: step.category,\n location: step.location,\n duration: step.duration,\n startTime: step.startTime,\n steps: parseNestedSteps(step.steps),\n screenshotBase64: createStepId(step) === failedStepId ? screenshotBase64 : null,\n videoBase64: createStepId(step) === failedStepId ? videoBase64 : null,\n }));\n\n const query = `\n mutation ExtendIntegrationScenario($input: ExtendIntegrationScenarioInput!) {\n extendIntegrationScenario(input: $input)\n }`;\n\n const extendIntegrationScenarioPayload: ExtendIntegrationScenarioPayload = {\n input: {\n projectUuid: WOPEE_PROJECT_UUID,\n scenarioUuid: wopeeScenarioUuid,\n pwSteps: JSON.stringify(steps, replacer),\n },\n };\n const variables = ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);\n\n const uploadPromise = new Promise(async (resolve, reject) => {\n try {\n const apiUrl = WOPEE_API_URL || 'https://api.wopee.io';\n const headers = {\n api_key: WOPEE_API_KEY,\n };\n const config = buildAxiosConfig(apiUrl, headers);\n const response = await axios.post(apiUrl, { query, variables }, config);\n resolve(response);\n } catch (error) {\n if (axios.isAxiosError(error)) {\n const status = error.response?.status;\n const errorData = error.response?.data;\n const errorMessage = error.message;\n console.error('[WOPEE_REPORTER_ERROR]', errorMessage, errorData);\n reject(new Error(`API request failed with status code: ${status}.`));\n }\n reject(new Error(`[WOPEE_REPORTER_ERROR] Unexpected error occurred during API call: ${error?.message}`));\n }\n });\n\n this.uploadQueue.push(uploadPromise);\n }\n\n async onExit(): Promise<void> {\n if (this.uploadQueue.length > 0) {\n console.log(`Uploading ${this.uploadQueue.length} remaining test results...`);\n try {\n await Promise.all(this.uploadQueue);\n console.log('Successfully uploaded all test results.');\n } catch (error) {\n console.error('Error uploading test results:', error);\n } finally {\n this.uploadQueue = [];\n }\n }\n }\n\n printsToStdio(): boolean {\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAsF;AACtF,+DAA6D;AAC7D,mFAG4C;AAE5C,kDAA0B;AAC1B,yBAAuB;AACvB,sDAAyB;AAEzB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzE,MAAa,aAAa;IAIxB;QACE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,SA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CAAC,0CAAE,OAAO,CAAC,CAAC;oBACjG,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,GAAG,CAAC,cAAc,SAAS,eAAe,CAAC,CAAC;oBACtD,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBACpB,OAAO,CAAC,KAAK,CAAC,+CAA+C,SAAS,KAAK,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAAE,CAAC,CAAC;gBAC/F,CAAC;YACH,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;KAAA;IAED,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA9KD,sCA8KC","sourcesContent":["import { generateTestRunId, parseError, parseNestedSteps, replacer } from './helpers';\nimport { buildAxiosConfig } from './helpers/axios-config.js';\nimport {\n ExtendIntegrationScenarioPayload,\n ExtendIntegrationScenarioPayloadSchema,\n} from './types/wopeeReporter.interface.js';\nimport type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';\nimport axios from 'axios';\nimport 'dotenv/config';\nimport fs from 'node:fs';\n\nconst { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;\n\nexport class WopeeReporter implements Reporter {\n private uploadQueue: Promise<any>[];\n private suiteUuids: Set<string>;\n\n constructor() {\n this.uploadQueue = [];\n this.suiteUuids = new Set();\n }\n\n onTestEnd(test: TestCase, result: TestResult) {\n const testRunId = generateTestRunId();\n\n const wopeeSuiteUuid = result.attachments.find((a) => a?.name === 'wopee-suite-uuid')?.body?.toString('utf-8');\n if (wopeeSuiteUuid) {\n this.suiteUuids.add(wopeeSuiteUuid);\n }\n\n const wopeeScenarioUuid = result.attachments\n .find((a) => a?.name === 'wopee-scenario-uuid')\n ?.body?.toString('utf-8');\n\n const failedStep = [...result.steps].reverse().find((step) => step.error);\n\n const createStepId = (step: any) => `${step.title}-${step.category}-${step.startTime}`;\n const failedStepId = failedStep ? createStepId(failedStep) : null;\n\n let screenshotBase64: string | null = null;\n let videoBase64: string | null = null;\n\n for (const attachment of result.attachments) {\n if (attachment.name === 'screenshot' && attachment.contentType === 'image/png') {\n const filePath = attachment.path;\n if (filePath) {\n try {\n const imageBuffer = fs.readFileSync(filePath);\n screenshotBase64 = imageBuffer.toString('base64');\n } catch (error) {\n console.error('Error reading screenshot:', error);\n }\n }\n }\n\n if (\n attachment.name === 'video' &&\n (attachment.contentType === 'video/webm' ||\n attachment.contentType === 'video/mp4' ||\n attachment.contentType === 'video/avi')\n ) {\n const filePath = attachment.path;\n if (filePath) {\n try {\n const videoBuffer = fs.readFileSync(filePath);\n videoBase64 = videoBuffer.toString('base64');\n } catch (error) {\n console.error('Error reading video:', error);\n }\n }\n }\n }\n\n if (!wopeeScenarioUuid) {\n return console.error(\n '[WOPEE_REPORTER_ERROR]: Scenario UUID is required, please propagate \"testInfo\" as second argument in \"test.beforeEach\" hook and pass it to \"wopee.startScenario(\"scenarioTitle\", testInfo)\" method as second argument if you want to use features of Wopee reporter',\n );\n }\n\n const steps = result.steps.map((step, index) => ({\n testRunId,\n number: index + 1,\n testTitle: test.title,\n title: step.title,\n status: step.error ? 'failed' : 'passed',\n error: step.error ? parseError(step.error) : step.error,\n category: step.category,\n location: step.location,\n duration: step.duration,\n startTime: step.startTime,\n steps: parseNestedSteps(step.steps),\n screenshotBase64: createStepId(step) === failedStepId ? screenshotBase64 : null,\n videoBase64: createStepId(step) === failedStepId ? videoBase64 : null,\n }));\n\n const query = `\n mutation ExtendIntegrationScenario($input: ExtendIntegrationScenarioInput!) {\n extendIntegrationScenario(input: $input)\n }`;\n\n const extendIntegrationScenarioPayload: ExtendIntegrationScenarioPayload = {\n input: {\n projectUuid: WOPEE_PROJECT_UUID,\n scenarioUuid: wopeeScenarioUuid,\n pwSteps: JSON.stringify(steps, replacer),\n ...(process.env.GITHUB_RUN_ID && {\n githubRunId: process.env.GITHUB_RUN_ID,\n }),\n ...(process.env.GITHUB_RUN_ATTEMPT && {\n githubRunAttempt: Number(process.env.GITHUB_RUN_ATTEMPT),\n }),\n },\n };\n const variables = ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);\n\n const uploadPromise = new Promise(async (resolve, reject) => {\n try {\n const { apiUrl, config } = this.apiRequestConfig();\n const response = await axios.post(apiUrl, { query, variables }, config);\n resolve(response);\n } catch (error) {\n if (axios.isAxiosError(error)) {\n const status = error.response?.status;\n const errorData = error.response?.data;\n const errorMessage = error.message;\n console.error('[WOPEE_REPORTER_ERROR]', errorMessage, errorData);\n reject(new Error(`API request failed with status code: ${status}.`));\n }\n reject(new Error(`[WOPEE_REPORTER_ERROR] Unexpected error occurred during API call: ${error?.message}`));\n }\n });\n\n this.uploadQueue.push(uploadPromise);\n }\n\n async onExit(): Promise<void> {\n if (this.uploadQueue.length > 0) {\n console.log(`Uploading ${this.uploadQueue.length} remaining test results...`);\n try {\n await Promise.all(this.uploadQueue);\n console.log('Successfully uploaded all test results.');\n } catch (error) {\n console.error('Error uploading test results:', error);\n } finally {\n this.uploadQueue = [];\n }\n }\n\n await this.stopSuites();\n }\n\n private apiRequestConfig() {\n const apiUrl = WOPEE_API_URL || 'https://api.wopee.io';\n const headers = {\n api_key: WOPEE_API_KEY,\n };\n return { apiUrl, config: buildAxiosConfig(apiUrl, headers) };\n }\n\n // Teardown is best-effort: a failed stop must never fail the run — suites are also\n // finished lazily by the API when left IDLE.\n private async stopSuites(): Promise<void> {\n const query = `\n mutation StopIntegrationSuite($suiteUuid: ID!) {\n stopIntegrationSuite(suiteUuid: $suiteUuid) { uuid suiteRunningStatus }\n }`;\n\n for (const suiteUuid of this.suiteUuids) {\n try {\n const { apiUrl, config } = this.apiRequestConfig();\n const response = await axios.post(apiUrl, { query, variables: { suiteUuid } }, config);\n const errors = response.data?.errors;\n if (errors?.length) {\n console.error(`[WOPEE_REPORTER_ERROR] Failed to stop suite ${suiteUuid}:`, errors[0]?.message);\n } else {\n console.log(`Suite(uuid=${suiteUuid}) is stopped.`);\n }\n } catch (error: any) {\n console.error(`[WOPEE_REPORTER_ERROR] Failed to stop suite ${suiteUuid}: ${error?.message}`);\n }\n }\n this.suiteUuids.clear();\n }\n\n printsToStdio(): boolean {\n return false;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopee-io/wopee.pw",
3
- "version": "4.23.1",
3
+ "version": "4.24.1",
4
4
  "description": "Playwright visual testing plugin by Wopee.io — catch visual regressions with AI-powered autonomous test maintenance",
5
5
  "keywords": [
6
6
  "playwright",
@@ -17,7 +17,7 @@
17
17
  "ai testing"
18
18
  ],
19
19
  "scripts": {
20
- "build:win": "rm -rf ./build/ && npx tsc && node utils/addVersionToBuild.mjs"
20
+ "build:win": "rm -rf ./build/ && npx tsc -p tsconfig.build.json && node utils/addVersionToBuild.mjs"
21
21
  },
22
22
  "exports": {
23
23
  ".": "./build/index.js",
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["lib/**/*.test.ts"]
4
+ }
@@ -1,41 +0,0 @@
1
- name: Publish to NPM (public)
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- jobs:
7
- publish:
8
- runs-on: ubuntu-latest
9
- permissions:
10
- contents: read
11
- id-token: write
12
-
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v6
16
-
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v6
19
- with:
20
- node-version: '22'
21
- registry-url: 'https://registry.npmjs.org'
22
-
23
- - name: Install dependencies
24
- uses: ./.github/actions/npm_clean_install
25
- with:
26
- npm-token: ${{ github.token }}
27
-
28
- - name: Build
29
- run: make build
30
-
31
- - name: Rename to public scope
32
- env:
33
- WOPEE_ORG_NAME: '@wopee-io'
34
- run: |
35
- node utils/changeOrganizationName.mjs
36
- node -e "const p=JSON.parse(require('fs').readFileSync('package.json','utf8')); delete p.publishConfig; require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
37
-
38
- - name: Publish to NPM
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41
- run: npm publish --access public