@wopee-io/wopee.pw 4.10.0 → 4.11.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/domain/configuration/config.interface.d.ts +1 -0
- package/build/core/domain/configuration/config.interface.js.map +1 -1
- package/build/core/services/wopeeService/wopee.js +14 -2
- 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 +1 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloAdapter/interface.js +1 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.js +2 -2
- package/node_modules/@autonomous-testing/sdk/package.json +4 -2
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApolloAdapterConfig } from '@autonomous-testing/sdk';
|
|
2
2
|
export interface ScreenshotValidationOptions extends ApolloAdapterConfig {
|
|
3
3
|
screenshotValidationEnabled?: boolean;
|
|
4
|
+
collectPageContent?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface WopeeOptions {
|
|
6
7
|
screenshotValidation?: ScreenshotValidationOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.interface.js","sourceRoot":"","sources":["../../../../lib/core/domain/configuration/config.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { ApolloAdapterConfig } from '@autonomous-testing/sdk';\n\nexport interface ScreenshotValidationOptions extends ApolloAdapterConfig {\n /*\n If true, screenshotValidation is enabled.\n */\n screenshotValidationEnabled?: boolean;\n}\n\nexport interface WopeeOptions {\n screenshotValidation?: ScreenshotValidationOptions;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.interface.js","sourceRoot":"","sources":["../../../../lib/core/domain/configuration/config.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { ApolloAdapterConfig } from '@autonomous-testing/sdk';\n\nexport interface ScreenshotValidationOptions extends ApolloAdapterConfig {\n /*\n If true, screenshotValidation is enabled.\n */\n screenshotValidationEnabled?: boolean;\n /*\n If true, will be collected through trackFullPage and trackViewport methods if screenshotValidationEnabled is also true.\n */\n collectPageContent?: boolean;\n}\n\nexport interface WopeeOptions {\n screenshotValidation?: ScreenshotValidationOptions;\n}\n"]}
|
|
@@ -87,6 +87,7 @@ class Wopee {
|
|
|
87
87
|
_trackFullPage(trackFullPageOptions) {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
89
|
let apolloTrackResult = null;
|
|
90
|
+
let pageContentBase64 = null;
|
|
90
91
|
if (this._config.screenshotValidation.screenshotValidationEnabled) {
|
|
91
92
|
const pageScreenshotOptions = {
|
|
92
93
|
animations: 'disabled',
|
|
@@ -97,7 +98,12 @@ class Wopee {
|
|
|
97
98
|
};
|
|
98
99
|
const imageBuffer = yield trackFullPageOptions.page.screenshot(pageScreenshotOptions);
|
|
99
100
|
const imageBase64 = imageBuffer.toString('base64');
|
|
100
|
-
|
|
101
|
+
if (this._config.screenshotValidation.collectPageContent) {
|
|
102
|
+
const pageContent = yield trackFullPageOptions.page.content();
|
|
103
|
+
pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');
|
|
104
|
+
}
|
|
105
|
+
const payload = sdk_1.CreateIntegrationStepPayloadSchema.parse(Object.assign(Object.assign({}, trackFullPageOptions), { imageBase64,
|
|
106
|
+
pageContentBase64 }));
|
|
101
107
|
apolloTrackResult = yield this._screenshotValidation.createIntegrationStep(payload);
|
|
102
108
|
}
|
|
103
109
|
return apolloTrackResult;
|
|
@@ -140,6 +146,7 @@ class Wopee {
|
|
|
140
146
|
_trackViewport(trackViewportOptions) {
|
|
141
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
148
|
let apolloTrackResult = null;
|
|
149
|
+
let pageContentBase64 = null;
|
|
143
150
|
if (this._config.screenshotValidation.screenshotValidationEnabled) {
|
|
144
151
|
const pageScreenshotOptions = {
|
|
145
152
|
animations: 'disabled',
|
|
@@ -150,7 +157,12 @@ class Wopee {
|
|
|
150
157
|
};
|
|
151
158
|
const imageBuffer = yield trackViewportOptions.page.screenshot(pageScreenshotOptions);
|
|
152
159
|
const imageBase64 = imageBuffer.toString('base64');
|
|
153
|
-
|
|
160
|
+
if (this._config.screenshotValidation.collectPageContent) {
|
|
161
|
+
const pageContent = yield trackViewportOptions.page.content();
|
|
162
|
+
pageContentBase64 = Buffer.from(pageContent, 'utf-8').toString('base64');
|
|
163
|
+
}
|
|
164
|
+
const payload = sdk_1.CreateIntegrationStepPayloadSchema.parse(Object.assign(Object.assign({}, trackViewportOptions), { imageBase64,
|
|
165
|
+
pageContentBase64 }));
|
|
154
166
|
apolloTrackResult = yield this._screenshotValidation.createIntegrationStep(payload);
|
|
155
167
|
}
|
|
156
168
|
return apolloTrackResult;
|
|
@@ -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,C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C,2BAA2B,EAAE,CAAC;gBAClE,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AA/LD,sBA+LC","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 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 const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackFullPageOptions,\n imageBase64,\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 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 const payload: CreateIntegrationStepPayload = CreateIntegrationStepPayloadSchema.parse({\n ...trackViewportOptions,\n imageBase64,\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,U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AO,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"]}
|
|
@@ -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;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
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,
|
|
@@ -20,6 +20,7 @@ class EnvConfigAdapter extends configPort_js_1.ConfigPort {
|
|
|
20
20
|
projectUuid: (_l = process.env) === null || _l === void 0 ? void 0 : _l.WOPEE_PROJECT_UUID,
|
|
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
|
+
collectPageContent: (_p = process.env) === null || _p === void 0 ? void 0 : _p.WOPEE_COLLECT_PAGE_CONTENT,
|
|
23
24
|
};
|
|
24
25
|
return { screenshotValidation: screenshotValidationOptions };
|
|
25
26
|
}
|
|
@@ -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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AAO,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;AArBD,4CAqBC","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 };\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.11.0"
|
|
7
|
+
let hash = "4d0ff63b6e3b1567d308fd11bc908995d712a8ef"
|
|
8
8
|
if (version === '__LOCAL__') {
|
|
9
9
|
version = process.env.npm_package_version || '__LOCAL__';
|
|
10
10
|
}
|
|
@@ -8,6 +8,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
8
8
|
scenarioName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
9
|
suiteName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
10
|
viewport: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
pageContentBase64: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
12
|
}, "strip", z.ZodTypeAny, {
|
|
12
13
|
imageBase64: string;
|
|
13
14
|
stepName: string;
|
|
@@ -17,6 +18,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
17
18
|
customTags?: string | null | undefined;
|
|
18
19
|
pixelToPixelDiffTolerance?: number | null | undefined;
|
|
19
20
|
viewport?: string | null | undefined;
|
|
21
|
+
pageContentBase64?: string | null | undefined;
|
|
20
22
|
}, {
|
|
21
23
|
imageBase64: string;
|
|
22
24
|
stepName: string;
|
|
@@ -26,6 +28,7 @@ declare const CreateIntegrationStepPayloadSchema: z.ZodObject<{
|
|
|
26
28
|
customTags?: string | null | undefined;
|
|
27
29
|
pixelToPixelDiffTolerance?: number | null | undefined;
|
|
28
30
|
viewport?: string | null | undefined;
|
|
31
|
+
pageContentBase64?: string | null | undefined;
|
|
29
32
|
}>;
|
|
30
33
|
type CreateIntegrationStepPayload = z.infer<typeof CreateIntegrationStepPayloadSchema>;
|
|
31
34
|
export { CreateIntegrationStepPayload, CreateIntegrationStepPayloadSchema };
|
|
@@ -11,6 +11,7 @@ const CreateIntegrationStepPayloadSchema = zod_1.z.object({
|
|
|
11
11
|
scenarioName: zod_1.z.string().nullable().optional(),
|
|
12
12
|
suiteName: zod_1.z.string().nullable().optional(),
|
|
13
13
|
viewport: zod_1.z.string().nullable().optional(),
|
|
14
|
+
pageContentBase64: zod_1.z.string().nullable().optional(),
|
|
14
15
|
});
|
|
15
16
|
exports.CreateIntegrationStepPayloadSchema = CreateIntegrationStepPayloadSchema;
|
|
16
17
|
//# sourceMappingURL=createIntegrationStepPayload.interface.js.map
|
|
@@ -120,6 +120,7 @@ function createIntegrationStepApolloPayloadFactory(config, integrationScenario,
|
|
|
120
120
|
stepName: createIntegrationStepPayload.stepName,
|
|
121
121
|
trackName: `${integrationScenario.name}-${createIntegrationStepPayload.stepName}`,
|
|
122
122
|
viewport: configPayload.viewport,
|
|
123
|
+
pageContentBase64: createIntegrationStepPayload.pageContentBase64,
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
126
|
function integrationStepFactory(createIntegrationStepApolloResponse) {
|
|
@@ -173,6 +173,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
173
173
|
stepName: z.ZodString;
|
|
174
174
|
trackName: z.ZodString;
|
|
175
175
|
viewport: z.ZodOptional<z.ZodString>;
|
|
176
|
+
pageContentBase64: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
176
177
|
}, "strip", z.ZodTypeAny, {
|
|
177
178
|
imageBase64: string;
|
|
178
179
|
stepName: string;
|
|
@@ -184,6 +185,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
184
185
|
customTags?: string | undefined;
|
|
185
186
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
186
187
|
viewport?: string | undefined;
|
|
188
|
+
pageContentBase64?: string | null | undefined;
|
|
187
189
|
ignoreAreas?: {
|
|
188
190
|
height: number;
|
|
189
191
|
width: number;
|
|
@@ -202,6 +204,7 @@ declare const CreateIntegrationStepApolloPayloadSchema: z.ZodObject<{
|
|
|
202
204
|
customTags?: string | undefined;
|
|
203
205
|
pixelToPixelDiffTolerance?: number | undefined;
|
|
204
206
|
viewport?: string | undefined;
|
|
207
|
+
pageContentBase64?: string | null | undefined;
|
|
205
208
|
ignoreAreas?: {
|
|
206
209
|
height: number;
|
|
207
210
|
width: number;
|
|
@@ -69,6 +69,7 @@ const CreateIntegrationStepApolloPayloadSchema = zod_1.z.object({
|
|
|
69
69
|
stepName: zod_1.z.string(),
|
|
70
70
|
trackName: zod_1.z.string(),
|
|
71
71
|
viewport: zod_1.z.string().optional(),
|
|
72
|
+
pageContentBase64: zod_1.z.string().nullable().optional(),
|
|
72
73
|
});
|
|
73
74
|
exports.CreateIntegrationStepApolloPayloadSchema = CreateIntegrationStepApolloPayloadSchema;
|
|
74
75
|
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.3.0"
|
|
5
|
+
exports.hash = "8d777022478ff450667626da2337fa0da61774b3"
|
|
6
6
|
//# sourceMappingURL=versionMetadata.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomous-testing/sdk",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"scripts": {
|
|
3
|
+
"version": "3.3.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build:win": "rm -rf ./build/ && npx tsc && node utils/addVersionToBuild.mjs"
|
|
6
|
+
},
|
|
5
7
|
"author": "Ondrej Winter <me@ondrejwinter.com>",
|
|
6
8
|
"license": "PROPRIETARY",
|
|
7
9
|
"repository": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wopee-io/wopee.pw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Wopee's Playwright integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visual testing",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"types": "./build/index.d.ts",
|
|
23
23
|
"type": "commonjs",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@autonomous-testing/sdk": "3.
|
|
25
|
+
"@autonomous-testing/sdk": "3.3.0",
|
|
26
26
|
"dotenv": "^16.4.7",
|
|
27
27
|
"lodash": "^4.17.21"
|
|
28
28
|
},
|