@wopee-io/wopee.pw 4.11.2 → 4.12.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/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,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,M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AO,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,2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AM,WAAW,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;gBACtF,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACnD,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;oBACzD,MAAM,WAAW,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;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,0CAAE,wBAAwB;YACvD,EAAE,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,QAAQ;YACzB,yBAAyB,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,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;SAC5D,CAAC;QAEF,OAAO,EAAE,oBAAoB,EAAE,2BAAiE,EAAE,CAAC;IACrG,CAAC;CACF;
|
|
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,0CAAE,wBAAwB;YACvD,EAAE,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,QAAQ;YACzB,yBAAyB,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,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.12.0"
|
|
7
|
+
let hash = "90906d4e50929ac62a6054a66f1cdb72f0b88031"
|
|
8
8
|
if (version === '__LOCAL__') {
|
|
9
9
|
version = process.env.npm_package_version || '__LOCAL__';
|
|
10
10
|
}
|
|
@@ -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.12.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
|
},
|