@wopee-io/wopee.pw 4.11.2 → 4.13.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/build/core/services/wopeeService/wopee.js +2 -1
- package/build/core/services/wopeeService/wopee.js.map +1 -1
- package/build/infrastructure/adapters/envConfigAdapter/envConfigAdapter.js +2 -1
- package/build/infrastructure/adapters/envConfigAdapter/envConfigAdapter.js.map +1 -1
- package/build/shared/metadata/versionMetadata.js +2 -2
- package/build/tools/wopee-reporter/helpers/index.d.ts +3 -1
- package/build/tools/wopee-reporter/helpers/index.js +5 -1
- package/build/tools/wopee-reporter/helpers/index.js.map +1 -1
- package/build/tools/wopee-reporter/helpers/parseNestedSteps.d.ts +12 -0
- package/build/tools/wopee-reporter/helpers/parseNestedSteps.js +20 -0
- package/build/tools/wopee-reporter/helpers/parseNestedSteps.js.map +1 -0
- package/build/tools/wopee-reporter/helpers/replacer.d.ts +1 -0
- package/build/tools/wopee-reporter/helpers/replacer.js +11 -0
- package/build/tools/wopee-reporter/helpers/replacer.js.map +1 -0
- package/build/tools/wopee-reporter/wopeeReporter.d.ts +2 -2
- package/build/tools/wopee-reporter/wopeeReporter.js +28 -8
- package/build/tools/wopee-reporter/wopeeReporter.js.map +1 -1
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/createIntegrationStepPayload.interface.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/entities/createIntegrationStepPayload.interface.js +1 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/factories.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.d.ts +9 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.js +2 -2
- package/node_modules/@autonomous-testing/sdk/package.json +1 -1
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@ class Wopee {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
_createApolloTrackAdapter() {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
27
27
|
const apolloAdapterConfig = {
|
|
28
28
|
apiKey: this._config.screenshotValidation.apiKey,
|
|
29
29
|
apiUrl: this._config.screenshotValidation.apiUrl,
|
|
@@ -37,6 +37,7 @@ class Wopee {
|
|
|
37
37
|
pixelToPixelDiffTolerance: this._config.screenshotValidation.pixelToPixelDiffTolerance,
|
|
38
38
|
viewport: (_g = this._config.screenshotValidation) === null || _g === void 0 ? void 0 : _g.viewport,
|
|
39
39
|
customTags: (_h = this._config.screenshotValidation) === null || _h === void 0 ? void 0 : _h.customTags,
|
|
40
|
+
baselineBranchName: (_j = this._config.screenshotValidation) === null || _j === void 0 ? void 0 : _j.baselineBranchName,
|
|
40
41
|
};
|
|
41
42
|
return (0, sdk_1.createApolloTrackAdapter)({
|
|
42
43
|
apolloAdapterConfig: apolloAdapterConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wopee.js","sourceRoot":"","sources":["../../../../lib/core/services/wopeeService/wopee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+GAAyG;AACzG,uDAA8D;AAQ9D,iDAOiC;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,MAA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AAW,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBAC9D,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,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;CACF;AA3MD,sBA2MC","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 {\n ApolloAdapter,\n ApolloAdapterConfig,\n CreateIntegrationStepPayload,\n CreateIntegrationStepPayloadSchema,\n IntegrationStep,\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 };\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"]}
|
|
1
|
+
{"version":3,"file":"wopee.js","sourceRoot":"","sources":["../../../../lib/core/services/wopeeService/wopee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+GAAyG;AACzG,uDAA8D;AAQ9D,iDAOiC;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;YACjD,EAAE,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAo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B,EAAE,CAAC;gBAClE,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AA5MD,sBA4MC","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 {\n ApolloAdapter,\n ApolloAdapterConfig,\n CreateIntegrationStepPayload,\n CreateIntegrationStepPayloadSchema,\n IntegrationStep,\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 };\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"]}
|
|
@@ -5,7 +5,7 @@ const configPort_js_1 = require("../../../core/ports/configPort/configPort.js");
|
|
|
5
5
|
require("dotenv/config");
|
|
6
6
|
class EnvConfigAdapter extends configPort_js_1.ConfigPort {
|
|
7
7
|
_loadConfig() {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
9
9
|
const screenshotValidationOptions = {
|
|
10
10
|
apiKey: (_a = process.env) === null || _a === void 0 ? void 0 : _a.WOPEE_API_KEY,
|
|
11
11
|
apiUrl: (_b = process.env) === null || _b === void 0 ? void 0 : _b.WOPEE_API_URL,
|
|
@@ -21,6 +21,7 @@ class EnvConfigAdapter extends configPort_js_1.ConfigPort {
|
|
|
21
21
|
screenshotValidationEnabled: (_m = process.env) === null || _m === void 0 ? void 0 : _m.WOPEE_SCREENSHOT_VALIDATION_ENABLED,
|
|
22
22
|
viewport: (_o = process.env) === null || _o === void 0 ? void 0 : _o.WOPEE_VIEWPORT,
|
|
23
23
|
collectPageContent: (_p = process.env) === null || _p === void 0 ? void 0 : _p.WOPEE_COLLECT_PAGE_CONTENT,
|
|
24
|
+
baselineBranchName: (_q = process.env) === null || _q === void 0 ? void 0 : _q.WOPEE_BASELINE_BRANCH_NAME,
|
|
24
25
|
};
|
|
25
26
|
return { screenshotValidation: screenshotValidationOptions };
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envConfigAdapter.js","sourceRoot":"","sources":["../../../../lib/infrastructure/adapters/envConfigAdapter/envConfigAdapter.ts"],"names":[],"mappings":";;;AACA,gFAA0E;AAC1E,yBAAuB;AAEvB,MAAa,gBAAiB,SAAQ,0BAAU;IAC9C,WAAW;;QACT,MAAM,2BAA2B,GAAG;YAClC,MAAM,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,aAAa;YAClC,MAAM,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,aAAa;YAClC,UAAU,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,iBAAiB;YAC1C,OAAO,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,aAAa;YACnC,OAAO,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,aAAa;YACnC,UAAU,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,iBAAiB;YAC1C,MAAM,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,YAAY;YACjC,gBAAgB,EAAE,MAAA,OAAO,CAAC,GAAG,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CAAE,mCAAmC;YAC3E,WAAW,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,kBAAkB;YAC5C,2BAA2B,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,mCAAmC;YAC7E,QAAQ,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,cAAc;YACrC,kBAAkB,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,0BAA0B;YAC3D,kBAAkB,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,0BAA0B;SAC5D,CAAC;QAEF,OAAO,EAAE,oBAAoB,EAAE,2BAAiE,EAAE,CAAC;IACrG,CAAC;CACF;AAtBD,4CAsBC","sourcesContent":["import { ScreenshotValidationOptions, WopeeOptions } from '../../../core/domain/configuration/config.interface.js';\nimport { ConfigPort } from '../../../core/ports/configPort/configPort.js';\nimport 'dotenv/config';\n\nexport class EnvConfigAdapter extends ConfigPort {\n _loadConfig(): WopeeOptions {\n const screenshotValidationOptions = {\n apiKey: process.env?.WOPEE_API_KEY,\n apiUrl: process.env?.WOPEE_API_URL,\n branchName: process.env?.WOPEE_BRANCH_NAME,\n browser: process.env?.WOPEE_BROWSER,\n comment: process.env?.WOPEE_COMMENT,\n customTags: process.env?.WOPEE_CUSTOM_TAGS,\n device: process.env?.WOPEE_DEVICE,\n enableSoftAssert: process.env?.WOPEE_ENABLE_SOFT_ASSERT,\n os: process.env?.WOPEE_OS,\n pixelToPixelDiffTolerance: process.env?.WOPEE_PIXEL_TO_PIXEL_DIFF_TOLERANCE,\n projectUuid: process.env?.WOPEE_PROJECT_UUID,\n screenshotValidationEnabled: process.env?.WOPEE_SCREENSHOT_VALIDATION_ENABLED,\n viewport: process.env?.WOPEE_VIEWPORT,\n collectPageContent: process.env?.WOPEE_COLLECT_PAGE_CONTENT,\n baselineBranchName: process.env?.WOPEE_BASELINE_BRANCH_NAME,\n };\n\n return { screenshotValidation: screenshotValidationOptions as any as ScreenshotValidationOptions };\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.
|
|
7
|
-
let hash = "
|
|
6
|
+
let version = "4.13.0"
|
|
7
|
+
let hash = "cfa0aa46cf4e9b6d3ee700a214d4ce907c2643d1"
|
|
8
8
|
if (version === '__LOCAL__') {
|
|
9
9
|
version = process.env.npm_package_version || '__LOCAL__';
|
|
10
10
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { generateTestRunId } from './generateTestRunId.js';
|
|
2
2
|
import { parseError } from './parseError.js';
|
|
3
|
-
|
|
3
|
+
import { parseNestedSteps } from './parseNestedSteps.js';
|
|
4
|
+
import { replacer } from './replacer.js';
|
|
5
|
+
export { generateTestRunId, parseError, replacer, parseNestedSteps };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseError = exports.generateTestRunId = void 0;
|
|
3
|
+
exports.parseNestedSteps = exports.replacer = exports.parseError = exports.generateTestRunId = void 0;
|
|
4
4
|
const generateTestRunId_js_1 = require("./generateTestRunId.js");
|
|
5
5
|
Object.defineProperty(exports, "generateTestRunId", { enumerable: true, get: function () { return generateTestRunId_js_1.generateTestRunId; } });
|
|
6
6
|
const parseError_js_1 = require("./parseError.js");
|
|
7
7
|
Object.defineProperty(exports, "parseError", { enumerable: true, get: function () { return parseError_js_1.parseError; } });
|
|
8
|
+
const parseNestedSteps_js_1 = require("./parseNestedSteps.js");
|
|
9
|
+
Object.defineProperty(exports, "parseNestedSteps", { enumerable: true, get: function () { return parseNestedSteps_js_1.parseNestedSteps; } });
|
|
10
|
+
const replacer_js_1 = require("./replacer.js");
|
|
11
|
+
Object.defineProperty(exports, "replacer", { enumerable: true, get: function () { return replacer_js_1.replacer; } });
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/index.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/index.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAKlD,kGALA,wCAAiB,OAKA;AAJ1B,mDAA6C;AAIjB,2FAJnB,0BAAU,OAImB;AAHtC,+DAAyD;AAGP,iGAHzC,sCAAgB,OAGyC;AAFlE,+CAAyC;AAED,yFAF/B,sBAAQ,OAE+B","sourcesContent":["import { generateTestRunId } from './generateTestRunId.js';\nimport { parseError } from './parseError.js';\nimport { parseNestedSteps } from './parseNestedSteps.js';\nimport { replacer } from './replacer.js';\n\nexport { generateTestRunId, parseError, replacer, parseNestedSteps };\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestResult, TestStep } from '@playwright/test/reporter';
|
|
2
|
+
type NestedStepT = {
|
|
3
|
+
number: number;
|
|
4
|
+
title: string;
|
|
5
|
+
status: 'passed' | 'failed';
|
|
6
|
+
error: TestStep['error'];
|
|
7
|
+
category: string;
|
|
8
|
+
location: TestStep['location'];
|
|
9
|
+
steps: NestedStepT[];
|
|
10
|
+
};
|
|
11
|
+
export declare function parseNestedSteps(steps: TestResult['steps']): NestedStepT[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseNestedSteps = void 0;
|
|
4
|
+
const parseError_1 = require("./parseError");
|
|
5
|
+
function parseNestedSteps(steps) {
|
|
6
|
+
if (!steps || steps.length === 0) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
return steps.map((step, index) => ({
|
|
10
|
+
number: index + 1,
|
|
11
|
+
title: step.title,
|
|
12
|
+
status: step.error ? 'failed' : 'passed',
|
|
13
|
+
error: step.error ? (0, parseError_1.parseError)(step.error) : step.error,
|
|
14
|
+
category: step.category,
|
|
15
|
+
location: step.location,
|
|
16
|
+
steps: parseNestedSteps(step.steps),
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
exports.parseNestedSteps = parseNestedSteps;
|
|
20
|
+
//# sourceMappingURL=parseNestedSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseNestedSteps.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/parseNestedSteps.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAa1C,SAAgB,gBAAgB,CAAC,KAA0B;IACzD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAc,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC;QACnD,MAAM,EAAE,KAAK,GAAG,CAAC;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;QACxC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,uBAAU,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;QACvD,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;KACpC,CAAC,CAAC,CAAC;AACN,CAAC;AAdD,4CAcC","sourcesContent":["import { parseError } from './parseError';\nimport { TestResult, TestStep } from '@playwright/test/reporter';\n\ntype NestedStepT = {\n number: number;\n title: string;\n status: 'passed' | 'failed';\n error: TestStep['error'];\n category: string;\n location: TestStep['location'];\n steps: NestedStepT[];\n};\n\nexport function parseNestedSteps(steps: TestResult['steps']): NestedStepT[] {\n if (!steps || steps.length === 0) {\n return [];\n }\n\n return steps.map((step: TestStep, index: number) => ({\n number: index + 1,\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 steps: parseNestedSteps(step.steps),\n }));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replacer: (key: string, value: any) => any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replacer = void 0;
|
|
4
|
+
const replacer = (key, value) => {
|
|
5
|
+
if (key === 'parent') {
|
|
6
|
+
return '[Circular]';
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
};
|
|
10
|
+
exports.replacer = replacer;
|
|
11
|
+
//# sourceMappingURL=replacer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replacer.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/replacer.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;IAClD,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QACrB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB","sourcesContent":["export const replacer = (key: string, value: any) => {\n if (key === 'parent') {\n return '[Circular]';\n }\n return value;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Reporter, TestCase } from '@playwright/test/reporter';
|
|
1
|
+
import type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
export declare class WopeeReporter implements Reporter {
|
|
4
|
-
onTestEnd(test: TestCase): Promise<void | import("axios").AxiosResponse<any, any>>;
|
|
4
|
+
onTestEnd(test: TestCase, result: TestResult): Promise<void | import("axios").AxiosResponse<any, any>>;
|
|
5
5
|
}
|
|
@@ -17,18 +17,36 @@ const helpers_1 = require("./helpers");
|
|
|
17
17
|
const wopeeReporter_interface_js_1 = require("./types/wopeeReporter.interface.js");
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
19
|
require("dotenv/config");
|
|
20
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
20
21
|
const { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;
|
|
21
22
|
class WopeeReporter {
|
|
22
|
-
onTestEnd(test) {
|
|
23
|
+
onTestEnd(test, result) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
var _a, _b, _c, _d
|
|
25
|
+
var _a, _b, _c, _d;
|
|
25
26
|
const testRunId = (0, helpers_1.generateTestRunId)();
|
|
26
|
-
const
|
|
27
|
-
|
|
27
|
+
const wopeeScenarioUuid = (_b = (_a = result.attachments
|
|
28
|
+
.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');
|
|
29
|
+
const failedStep = [...result.steps].reverse().find((step) => step.error);
|
|
30
|
+
let screenshotBase64 = null;
|
|
31
|
+
for (const attachment of result.attachments) {
|
|
32
|
+
if (attachment.name === 'screenshot' && attachment.contentType === 'image/png') {
|
|
33
|
+
const filePath = attachment.path;
|
|
34
|
+
if (filePath) {
|
|
35
|
+
try {
|
|
36
|
+
const imageBuffer = node_fs_1.default.readFileSync(filePath);
|
|
37
|
+
screenshotBase64 = imageBuffer.toString('base64');
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Error reading screenshot:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
28
46
|
if (!wopeeScenarioUuid) {
|
|
29
47
|
return console.error('[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');
|
|
30
48
|
}
|
|
31
|
-
const steps =
|
|
49
|
+
const steps = result.steps.map((step, index) => ({
|
|
32
50
|
testRunId,
|
|
33
51
|
number: index + 1,
|
|
34
52
|
testTitle: test.title,
|
|
@@ -37,6 +55,8 @@ class WopeeReporter {
|
|
|
37
55
|
error: step.error ? (0, helpers_1.parseError)(step.error) : step.error,
|
|
38
56
|
category: step.category,
|
|
39
57
|
location: step.location,
|
|
58
|
+
steps: (0, helpers_1.parseNestedSteps)(step.steps),
|
|
59
|
+
screenshotBase64: step === failedStep ? screenshotBase64 : null,
|
|
40
60
|
}));
|
|
41
61
|
const query = `
|
|
42
62
|
mutation ExtendIntegrationScenario($input: ExtendIntegrationScenarioInput!) {
|
|
@@ -46,7 +66,7 @@ class WopeeReporter {
|
|
|
46
66
|
input: {
|
|
47
67
|
projectUuid: WOPEE_PROJECT_UUID,
|
|
48
68
|
scenarioUuid: wopeeScenarioUuid,
|
|
49
|
-
pwSteps: JSON.stringify(steps),
|
|
69
|
+
pwSteps: JSON.stringify(steps, helpers_1.replacer),
|
|
50
70
|
},
|
|
51
71
|
};
|
|
52
72
|
const variables = wopeeReporter_interface_js_1.ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);
|
|
@@ -59,8 +79,8 @@ class WopeeReporter {
|
|
|
59
79
|
}
|
|
60
80
|
catch (error) {
|
|
61
81
|
if (axios_1.default.isAxiosError(error)) {
|
|
62
|
-
const status = (
|
|
63
|
-
const errorData = (
|
|
82
|
+
const status = (_c = error.response) === null || _c === void 0 ? void 0 : _c.status;
|
|
83
|
+
const errorData = (_d = error.response) === null || _d === void 0 ? void 0 : _d.data;
|
|
64
84
|
console.error('[WOPEE_REPORTER_ERROR]', errorData);
|
|
65
85
|
throw new Error(`API request failed with status code: ${status}.`);
|
|
66
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAsF;AACtF,mFAG4C;AAE5C,kDAA0B;AAC1B,yBAAuB;AACvB,sDAAyB;AAEzB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzE,MAAa,aAAa;IAClB,SAAS,CAAC,IAAc,EAAE,MAAkB;;;YAChD,MAAM,SAAS,GAAG,IAAA,2BAAiB,GAAE,CAAC;YAEtC,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAM,CAAC,WAAW;iBACzC,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;YAE5B,MAAM,UAAU,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE1E,IAAI,gBAAgB,GAAkB,IAAI,CAAC;YAC3C,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBAC5C,IAAI,UAAU,CAAC,IAAI,KAAK,YAAY,IAAI,UAAU,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;oBAC/E,MAAM,QA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AG;;;MAGZ,CAAC;YAEH,MAAM,gCAAgC,GAAqC;gBACzE,KAAK,EAAE;oBACL,WAAW,EAAE,kBAAkB;oBAC/B,YAAY,EAAE,iBAAiB;oBAC/B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,kBAAQ,CAAC;iBACzC;aACF,CAAC;YACF,MAAM,SAAS,GAAG,mEAAsC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAEjG,IAAI,CAAC;gBACH,OAAO,MAAM,eAAK,CAAC,IAAI,CACrB,aAAa,EACb,EAAE,KAAK,EAAE,SAAS,EAAE,EACpB;oBACE,OAAO,EAAE;wBACP,OAAO,EAAE,aAAa;qBACvB;iBACF,CACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC9B,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,CAAC;oBACtC,MAAM,SAAS,GAAG,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,CAAC;oBACvC,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;oBACnD,MAAM,IAAI,KAAK,CAAC,wCAAwC,MAAM,GAAG,CAAC,CAAC;gBACrE,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;KAAA;CACF;AA/ED,sCA+EC","sourcesContent":["import { generateTestRunId, parseError, parseNestedSteps, replacer } from './helpers';\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 async 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 let screenshotBase64: string | null = null;\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 break;\n } catch (error) {\n console.error('Error reading screenshot:', 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 steps: parseNestedSteps(step.steps),\n screenshotBase64: step === failedStep ? screenshotBase64 : 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 try {\n return await axios.post(\n WOPEE_API_URL,\n { query, variables },\n {\n headers: {\n api_key: WOPEE_API_KEY,\n },\n },\n );\n } catch (error) {\n if (axios.isAxiosError(error)) {\n const status = error.response?.status;\n const errorData = error.response?.data;\n console.error('[WOPEE_REPORTER_ERROR]', errorData);\n throw new Error(`API request failed with status code: ${status}.`);\n }\n throw new Error('Unexpected error occurred during API call.');\n }\n }\n}\n"]}
|
|
@@ -9,6 +9,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
9
9
|
suiteName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
10
|
viewport: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
11
|
pageContentBase64: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
baselineBranchName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
13
|
}, "strip", z.ZodTypeAny, {
|
|
13
14
|
imageBase64: string;
|
|
14
15
|
stepName: string;
|
|
@@ -19,6 +20,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
19
20
|
pixelToPixelDiffTolerance?: number | null | undefined;
|
|
20
21
|
viewport?: string | null | undefined;
|
|
21
22
|
pageContentBase64?: string | null | undefined;
|
|
23
|
+
baselineBranchName?: string | null | undefined;
|
|
22
24
|
}, {
|
|
23
25
|
imageBase64: string;
|
|
24
26
|
stepName: string;
|
|
@@ -29,6 +31,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
29
31
|
pixelToPixelDiffTolerance?: number | null | undefined;
|
|
30
32
|
viewport?: string | null | undefined;
|
|
31
33
|
pageContentBase64?: string | null | undefined;
|
|
34
|
+
baselineBranchName?: string | null | undefined;
|
|
32
35
|
}>;
|
|
33
36
|
type CreateIntegrationStepPayload = z.infer<typeof CreateIntegrationStepPayloadSchema>;
|
|
34
37
|
export { CreateIntegrationStepPayload, CreateIntegrationStepPayloadSchema };
|
|
@@ -12,6 +12,7 @@ const CreateIntegrationStepPayloadSchema = zod_1.z.object({
|
|
|
12
12
|
suiteName: zod_1.z.string().nullable().optional(),
|
|
13
13
|
viewport: zod_1.z.string().nullable().optional(),
|
|
14
14
|
pageContentBase64: zod_1.z.string().nullable().optional(),
|
|
15
|
+
baselineBranchName: zod_1.z.string().nullable().optional(),
|
|
15
16
|
});
|
|
16
17
|
exports.CreateIntegrationStepPayloadSchema = CreateIntegrationStepPayloadSchema;
|
|
17
18
|
//# sourceMappingURL=createIntegrationStepPayload.interface.js.map
|
|
@@ -100,12 +100,14 @@ function createIntegrationStepApolloPayloadFactory(config, integrationScenario,
|
|
|
100
100
|
os: config.os,
|
|
101
101
|
pixelToPixelDiffTolerance: config.pixelToPixelDiffTolerance,
|
|
102
102
|
viewport: config.viewport,
|
|
103
|
+
baselineBranchName: config.baselineBranchName,
|
|
103
104
|
});
|
|
104
105
|
const localConfigPayload = (0, shared_1.filterNoneValues)({
|
|
105
106
|
comment: createIntegrationStepPayload.comment,
|
|
106
107
|
customTags: createIntegrationStepPayload.customTags,
|
|
107
108
|
pixelToPixelDiffTolerance: createIntegrationStepPayload.pixelToPixelDiffTolerance,
|
|
108
109
|
viewport: createIntegrationStepPayload.viewport,
|
|
110
|
+
baselineBranchName: createIntegrationStepPayload.baselineBranchName,
|
|
109
111
|
});
|
|
110
112
|
const rawConfigPayload = (0, shared_1.mergeDicts)(globalConfigPayload, localConfigPayload);
|
|
111
113
|
const configPayload = interface_1.CreateIntegrationStepConfigApolloPayloadSchema.parse(rawConfigPayload);
|
|
@@ -121,6 +123,7 @@ function createIntegrationStepApolloPayloadFactory(config, integrationScenario,
|
|
|
121
123
|
trackName: `${integrationScenario.name}-${createIntegrationStepPayload.stepName}`,
|
|
122
124
|
viewport: configPayload.viewport,
|
|
123
125
|
pageContentBase64: createIntegrationStepPayload.pageContentBase64,
|
|
126
|
+
baselineBranchName: configPayload.baselineBranchName,
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
function integrationStepFactory(createIntegrationStepApolloResponse) {
|
|
@@ -12,6 +12,7 @@ declare const ApolloAdapterConfigSchema: z.ZodObject<{
|
|
|
12
12
|
pixelToPixelDiffTolerance: z.ZodOptional<z.ZodType<number, z.ZodTypeDef, number>>;
|
|
13
13
|
projectUuid: z.ZodString;
|
|
14
14
|
viewport: z.ZodOptional<z.ZodString>;
|
|
15
|
+
baselineBranchName: z.ZodOptional<z.ZodString>;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
16
17
|
apiKey: string;
|
|
17
18
|
apiUrl: string;
|
|
@@ -23,6 +24,7 @@ declare const ApolloAdapterConfigSchema: z.ZodObject<{
|
|
|
23
24
|
customTags?: string | undefined;
|
|
24
25
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
25
26
|
viewport?: string | undefined;
|
|
27
|
+
baselineBranchName?: string | undefined;
|
|
26
28
|
device?: string | undefined;
|
|
27
29
|
os?: string | undefined;
|
|
28
30
|
}, {
|
|
@@ -33,6 +35,7 @@ declare const ApolloAdapterConfigSchema: z.ZodObject<{
|
|
|
33
35
|
customTags?: string | undefined;
|
|
34
36
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
35
37
|
viewport?: string | undefined;
|
|
38
|
+
baselineBranchName?: string | undefined;
|
|
36
39
|
apiUrl?: string | undefined;
|
|
37
40
|
branchName?: string | undefined;
|
|
38
41
|
device?: string | undefined;
|
|
@@ -125,12 +128,14 @@ declare const CreateIntegrationStepConfigApolloPayloadSchema: z.ZodObject<{
|
|
|
125
128
|
os: z.ZodOptional<z.ZodString>;
|
|
126
129
|
pixelToPixelDiffTolerance: z.ZodOptional<z.ZodType<number, z.ZodTypeDef, number>>;
|
|
127
130
|
viewport: z.ZodOptional<z.ZodString>;
|
|
131
|
+
baselineBranchName: z.ZodOptional<z.ZodString>;
|
|
128
132
|
}, "strip", z.ZodTypeAny, {
|
|
129
133
|
browser?: string | undefined;
|
|
130
134
|
comment?: string | undefined;
|
|
131
135
|
customTags?: string | undefined;
|
|
132
136
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
133
137
|
viewport?: string | undefined;
|
|
138
|
+
baselineBranchName?: string | undefined;
|
|
134
139
|
device?: string | undefined;
|
|
135
140
|
os?: string | undefined;
|
|
136
141
|
}, {
|
|
@@ -139,6 +144,7 @@ declare const CreateIntegrationStepConfigApolloPayloadSchema: z.ZodObject<{
|
|
|
139
144
|
customTags?: string | undefined;
|
|
140
145
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
141
146
|
viewport?: string | undefined;
|
|
147
|
+
baselineBranchName?: string | undefined;
|
|
142
148
|
device?: string | undefined;
|
|
143
149
|
os?: string | undefined;
|
|
144
150
|
}>;
|
|
@@ -174,6 +180,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
174
180
|
trackName: z.ZodString;
|
|
175
181
|
viewport: z.ZodOptional<z.ZodString>;
|
|
176
182
|
pageContentBase64: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
baselineBranchName: z.ZodOptional<z.ZodString>;
|
|
177
184
|
}, "strip", z.ZodTypeAny, {
|
|
178
185
|
imageBase64: string;
|
|
179
186
|
stepName: string;
|
|
@@ -186,6 +193,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
186
193
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
187
194
|
viewport?: string | undefined;
|
|
188
195
|
pageContentBase64?: string | null | undefined;
|
|
196
|
+
baselineBranchName?: string | undefined;
|
|
189
197
|
ignoreAreas?: {
|
|
190
198
|
height: number;
|
|
191
199
|
width: number;
|
|
@@ -205,6 +213,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
205
213
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
206
214
|
viewport?: string | undefined;
|
|
207
215
|
pageContentBase64?: string | null | undefined;
|
|
216
|
+
baselineBranchName?: string | undefined;
|
|
208
217
|
ignoreAreas?: {
|
|
209
218
|
height: number;
|
|
210
219
|
width: number;
|
|
@@ -16,6 +16,7 @@ const ApolloAdapterConfigSchema = zod_1.z.object({
|
|
|
16
16
|
pixelToPixelDiffTolerance: shared_1.ZodHelper.parseStringToNumberSchema().optional(),
|
|
17
17
|
projectUuid: zod_1.z.string(),
|
|
18
18
|
viewport: zod_1.z.string().optional(),
|
|
19
|
+
baselineBranchName: zod_1.z.string().optional(),
|
|
19
20
|
});
|
|
20
21
|
exports.ApolloAdapterConfigSchema = ApolloAdapterConfigSchema;
|
|
21
22
|
const SuiteIntegrationConfigApolloPayloadSchema = zod_1.z.object({
|
|
@@ -55,6 +56,7 @@ const CreateIntegrationStepConfigApolloPayloadSchema = zod_1.z.object({
|
|
|
55
56
|
os: zod_1.z.string().optional(),
|
|
56
57
|
pixelToPixelDiffTolerance: shared_1.ZodHelper.parseStringToNumberSchema().optional(),
|
|
57
58
|
viewport: zod_1.z.string().optional(),
|
|
59
|
+
baselineBranchName: zod_1.z.string().optional(),
|
|
58
60
|
});
|
|
59
61
|
exports.CreateIntegrationStepConfigApolloPayloadSchema = CreateIntegrationStepConfigApolloPayloadSchema;
|
|
60
62
|
const CreateIntegrationStepApolloPayloadSchema = zod_1.z.object({
|
|
@@ -70,6 +72,7 @@ const CreateIntegrationStepApolloPayloadSchema = zod_1.z.object({
|
|
|
70
72
|
trackName: zod_1.z.string(),
|
|
71
73
|
viewport: zod_1.z.string().optional(),
|
|
72
74
|
pageContentBase64: zod_1.z.string().nullable().optional(),
|
|
75
|
+
baselineBranchName: zod_1.z.string().optional(),
|
|
73
76
|
});
|
|
74
77
|
exports.CreateIntegrationStepApolloPayloadSchema = CreateIntegrationStepApolloPayloadSchema;
|
|
75
78
|
const CreateIntegrationStepApolloResponseSchema = zod_1.z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hash = exports.version = void 0;
|
|
4
|
-
exports.version = "3.
|
|
5
|
-
exports.hash = "
|
|
4
|
+
exports.version = "3.4.0"
|
|
5
|
+
exports.hash = "81226f03e5b82edd07b38e69609887d0b49e7f05"
|
|
6
6
|
//# sourceMappingURL=versionMetadata.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wopee-io/wopee.pw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Wopee's Playwright integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visual testing",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"types": "./build/index.d.ts",
|
|
27
27
|
"type": "commonjs",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@autonomous-testing/sdk": "3.
|
|
29
|
+
"@autonomous-testing/sdk": "3.4.0",
|
|
30
30
|
"dotenv": "^16.4.7",
|
|
31
31
|
"lodash": "^4.17.21"
|
|
32
32
|
},
|