@wopee-io/wopee.pw 4.8.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.d.ts +2 -1
- package/build/core/services/wopeeService/wopee.js +22 -4
- 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/index.d.ts +2 -0
- package/build/tools/wopee-reporter/index.js +5 -0
- package/build/tools/wopee-reporter/index.js.map +1 -0
- package/build/tools/wopee-reporter/types/wopeeReporter.interface.d.ts +30 -0
- package/build/tools/wopee-reporter/types/wopeeReporter.interface.js +17 -0
- package/build/tools/wopee-reporter/types/wopeeReporter.interface.js.map +1 -0
- package/build/tools/wopee-reporter/wopeeReporter.d.ts +5 -0
- package/build/tools/wopee-reporter/wopeeReporter.js +70 -0
- package/build/tools/wopee-reporter/wopeeReporter.js.map +1 -0
- 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 +6 -3
|
@@ -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"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { TrackElementOptions, TrackFullPageOptions, TrackImageOptions, TrackViewportOptions } from '../../domain/valueObjects/track.interface.js';
|
|
2
2
|
import { IntegrationStep } from '@autonomous-testing/sdk';
|
|
3
|
+
import { TestInfo } from '@playwright/test';
|
|
3
4
|
export declare class Wopee {
|
|
4
5
|
private _config;
|
|
5
6
|
private _screenshotValidation;
|
|
6
7
|
constructor();
|
|
7
8
|
private _createApolloTrackAdapter;
|
|
8
9
|
startSuite(suiteName: string): Promise<void>;
|
|
9
|
-
startScenario(scenarioName: string): Promise<void>;
|
|
10
|
+
startScenario(scenarioName: string, testInfo?: TestInfo): Promise<void>;
|
|
10
11
|
stopScenario(): Promise<void>;
|
|
11
12
|
_trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep>;
|
|
12
13
|
trackImage(trackImageOptions: TrackImageOptions): Promise<IntegrationStep>;
|
|
@@ -50,10 +50,16 @@ class Wopee {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
startScenario(scenarioName) {
|
|
53
|
+
startScenario(scenarioName, testInfo) {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
if (this._config.screenshotValidation.screenshotValidationEnabled) {
|
|
56
|
-
yield this._screenshotValidation.createIntegrationScenario({ scenarioName });
|
|
56
|
+
const scenario = yield this._screenshotValidation.createIntegrationScenario({ scenarioName });
|
|
57
|
+
if (testInfo) {
|
|
58
|
+
yield testInfo.attach('wopee-scenario-uuid', {
|
|
59
|
+
contentType: 'text/plain',
|
|
60
|
+
body: scenario === null || scenario === void 0 ? void 0 : scenario.uuid,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
});
|
|
59
65
|
}
|
|
@@ -81,6 +87,7 @@ class Wopee {
|
|
|
81
87
|
_trackFullPage(trackFullPageOptions) {
|
|
82
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
89
|
let apolloTrackResult = null;
|
|
90
|
+
let pageContentBase64 = null;
|
|
84
91
|
if (this._config.screenshotValidation.screenshotValidationEnabled) {
|
|
85
92
|
const pageScreenshotOptions = {
|
|
86
93
|
animations: 'disabled',
|
|
@@ -91,7 +98,12 @@ class Wopee {
|
|
|
91
98
|
};
|
|
92
99
|
const imageBuffer = yield trackFullPageOptions.page.screenshot(pageScreenshotOptions);
|
|
93
100
|
const imageBase64 = imageBuffer.toString('base64');
|
|
94
|
-
|
|
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 }));
|
|
95
107
|
apolloTrackResult = yield this._screenshotValidation.createIntegrationStep(payload);
|
|
96
108
|
}
|
|
97
109
|
return apolloTrackResult;
|
|
@@ -134,6 +146,7 @@ class Wopee {
|
|
|
134
146
|
_trackViewport(trackViewportOptions) {
|
|
135
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
148
|
let apolloTrackResult = null;
|
|
149
|
+
let pageContentBase64 = null;
|
|
137
150
|
if (this._config.screenshotValidation.screenshotValidationEnabled) {
|
|
138
151
|
const pageScreenshotOptions = {
|
|
139
152
|
animations: 'disabled',
|
|
@@ -144,7 +157,12 @@ class Wopee {
|
|
|
144
157
|
};
|
|
145
158
|
const imageBuffer = yield trackViewportOptions.page.screenshot(pageScreenshotOptions);
|
|
146
159
|
const imageBase64 = imageBuffer.toString('base64');
|
|
147
|
-
|
|
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 }));
|
|
148
166
|
apolloTrackResult = yield this._screenshotValidation.createIntegrationStep(payload);
|
|
149
167
|
}
|
|
150
168
|
return apolloTrackResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wopee.js","sourceRoot":"","sources":["../../../../lib/core/services/wopeeService/wopee.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+GAAyG;A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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;AAzLD,sBAyLC","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 } 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): Promise<void> {\n if (this._config.screenshotValidation.screenshotValidationEnabled) {\n await this._screenshotValidation.createIntegrationScenario({ scenarioName });\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,UAAU,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,0CAAE,UAAU;YACzD,gBAAgB,EAAE,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AiC,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,aAAa;YAClC,UAAU,EAAE,MAAA,OAAO,CAAC,GAAG,0CAAE,iBAAiB;YAC1C,OAAO,EAAE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BAAwB;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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/index.ts"],"names":[],"mappings":";;AAAA,yDAAmD;AAEnD,kBAAe,gCAAa,CAAC","sourcesContent":["import { WopeeReporter } from './wopeeReporter.js';\n\nexport default WopeeReporter;\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const ExtendIntegrationScenarioPayloadSchema: z.ZodObject<{
|
|
3
|
+
input: z.ZodObject<{
|
|
4
|
+
projectUuid: z.ZodString;
|
|
5
|
+
scenarioUuid: z.ZodString;
|
|
6
|
+
pwSteps: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
projectUuid?: string;
|
|
9
|
+
scenarioUuid?: string;
|
|
10
|
+
pwSteps?: string;
|
|
11
|
+
}, {
|
|
12
|
+
projectUuid?: string;
|
|
13
|
+
scenarioUuid?: string;
|
|
14
|
+
pwSteps?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
input?: {
|
|
18
|
+
projectUuid?: string;
|
|
19
|
+
scenarioUuid?: string;
|
|
20
|
+
pwSteps?: string;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
input?: {
|
|
24
|
+
projectUuid?: string;
|
|
25
|
+
scenarioUuid?: string;
|
|
26
|
+
pwSteps?: string;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
type ExtendIntegrationScenarioPayload = z.infer<typeof ExtendIntegrationScenarioPayloadSchema>;
|
|
30
|
+
export { ExtendIntegrationScenarioPayloadSchema, ExtendIntegrationScenarioPayload };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtendIntegrationScenarioPayloadSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ExtendIntegrationScenarioPayloadSchema = zod_1.z.object({
|
|
6
|
+
input: zod_1.z.object({
|
|
7
|
+
projectUuid: zod_1.z.string({
|
|
8
|
+
required_error: 'Project UUID is required',
|
|
9
|
+
}),
|
|
10
|
+
scenarioUuid: zod_1.z.string({
|
|
11
|
+
required_error: 'Scenario UUID is required, please propagate "testInfo" as second argument in "test.beforeEach" hook and pass it to "wopee.startScenario("scenarioTitle", testInfo)" method as second argument if you want to use features of Wopee reporter',
|
|
12
|
+
}),
|
|
13
|
+
pwSteps: zod_1.z.string(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
exports.ExtendIntegrationScenarioPayloadSchema = ExtendIntegrationScenarioPayloadSchema;
|
|
17
|
+
//# sourceMappingURL=wopeeReporter.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wopeeReporter.interface.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/types/wopeeReporter.interface.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,sCAAsC,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YACpB,cAAc,EAAE,0BAA0B;SAC3C,CAAC;QACF,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,cAAc,EACZ,6OAA6O;SAChP,CAAC;QACF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC;AAIM,wFAAsC","sourcesContent":["import { z } from 'zod';\n\nconst ExtendIntegrationScenarioPayloadSchema = z.object({\n input: z.object({\n projectUuid: z.string({\n required_error: 'Project UUID is required',\n }),\n scenarioUuid: z.string({\n required_error:\n 'Scenario UUID is required, please propagate \"testInfo\" as second argument in \"test.beforeEach\" hook and pass it to \"wopee.startScenario(\"scenarioTitle\", testInfo)\" method as second argument if you want to use features of Wopee reporter',\n }),\n pwSteps: z.string(),\n }),\n});\n\ntype ExtendIntegrationScenarioPayload = z.infer<typeof ExtendIntegrationScenarioPayloadSchema>;\n\nexport { ExtendIntegrationScenarioPayloadSchema, ExtendIntegrationScenarioPayload };\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WopeeReporter = void 0;
|
|
16
|
+
const wopeeReporter_interface_js_1 = require("./types/wopeeReporter.interface.js");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
const axios_1 = __importDefault(require("axios"));
|
|
19
|
+
require("dotenv/config");
|
|
20
|
+
const { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;
|
|
21
|
+
class WopeeReporter {
|
|
22
|
+
onTestEnd(test) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a, _b, _c, _d, _e;
|
|
25
|
+
const testRunId = (0, utils_1.generateTestRunId)();
|
|
26
|
+
const testResults = (_a = test.results) === null || _a === void 0 ? void 0 : _a[0];
|
|
27
|
+
const wopeeScenarioUuid = (_c = (_b = testResults === null || testResults === void 0 ? void 0 : testResults.attachments.find((a) => (a === null || a === void 0 ? void 0 : a.name) === 'wopee-scenario-uuid')) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.toString('utf-8');
|
|
28
|
+
const steps = testResults === null || testResults === void 0 ? void 0 : testResults.steps.map((step, index) => ({
|
|
29
|
+
testRunId,
|
|
30
|
+
number: index + 1,
|
|
31
|
+
testTitle: test.title,
|
|
32
|
+
title: step.title,
|
|
33
|
+
status: step.error ? 'failed' : 'passed',
|
|
34
|
+
error: step.error ? (0, utils_1.parseError)(step.error) : step.error,
|
|
35
|
+
category: step.category,
|
|
36
|
+
location: step.location,
|
|
37
|
+
}));
|
|
38
|
+
const query = `
|
|
39
|
+
mutation ExtendIntegrationScenario($input: ExtendIntegrationScenarioInput!) {
|
|
40
|
+
extendIntegrationScenario(input: $input)
|
|
41
|
+
}`;
|
|
42
|
+
const extendIntegrationScenarioPayload = {
|
|
43
|
+
input: {
|
|
44
|
+
projectUuid: WOPEE_PROJECT_UUID,
|
|
45
|
+
scenarioUuid: wopeeScenarioUuid,
|
|
46
|
+
pwSteps: JSON.stringify(steps),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const variables = wopeeReporter_interface_js_1.ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);
|
|
50
|
+
try {
|
|
51
|
+
return yield axios_1.default.post(WOPEE_API_URL, { query, variables }, {
|
|
52
|
+
headers: {
|
|
53
|
+
api_key: WOPEE_API_KEY,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
59
|
+
const status = (_d = error.response) === null || _d === void 0 ? void 0 : _d.status;
|
|
60
|
+
const errorData = (_e = error.response) === null || _e === void 0 ? void 0 : _e.data;
|
|
61
|
+
console.error('[WOPEE_REPORTER_ERROR]', errorData);
|
|
62
|
+
throw new Error(`API request failed with status code: ${status}.`);
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Unexpected error occurred during API call.');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.WopeeReporter = WopeeReporter;
|
|
70
|
+
//# sourceMappingURL=wopeeReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mFAG4C;AAC5C,mCAAwD;AAExD,kDAA0B;AAC1B,yBAAuB;AAEvB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzE,MAAa,aAAa;IAClB,SAAS,CAAC,IAAc;;;YAC5B,MAAM,SAAS,GAAG,IAAA,yBAAiB,GAAE,CAAC;YACtC,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAG,CAAC,CAAC,CAAC;YACtC,MAAM,iBAAiB,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAC/C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,MAAK,qBAAqB,CAAC,0CAC7C,IAAI,0CAAE,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,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;AArDD,sCAqDC","sourcesContent":["import {\n ExtendIntegrationScenarioPayload,\n ExtendIntegrationScenarioPayloadSchema,\n} from './types/wopeeReporter.interface.js';\nimport { generateTestRunId, parseError } from './utils';\nimport type { Reporter, TestCase } from '@playwright/test/reporter';\nimport axios from 'axios';\nimport 'dotenv/config';\n\nconst { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;\n\nexport class WopeeReporter implements Reporter {\n async onTestEnd(test: TestCase) {\n const testRunId = generateTestRunId();\n const testResults = test.results?.[0];\n const wopeeScenarioUuid = testResults?.attachments\n .find((a) => a?.name === 'wopee-scenario-uuid')\n ?.body?.toString('utf-8');\n\n const steps = testResults?.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 }));\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),\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"]}
|
|
@@ -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,12 +1,15 @@
|
|
|
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",
|
|
7
7
|
"playwright",
|
|
8
8
|
"wopee"
|
|
9
9
|
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build:win": "rm -rf ./build/ && npx tsc && node utils/addVersionToBuild.mjs"
|
|
12
|
+
},
|
|
10
13
|
"author": "Ondrej Winter <ondrej.winter@gmail.com>",
|
|
11
14
|
"license": "PROPRIETARY",
|
|
12
15
|
"homepage": "https://Wopee.io",
|
|
@@ -19,8 +22,8 @@
|
|
|
19
22
|
"types": "./build/index.d.ts",
|
|
20
23
|
"type": "commonjs",
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@autonomous-testing/sdk": "3.
|
|
23
|
-
"dotenv": "^16.4.
|
|
25
|
+
"@autonomous-testing/sdk": "3.3.0",
|
|
26
|
+
"dotenv": "^16.4.7",
|
|
24
27
|
"lodash": "^4.17.21"
|
|
25
28
|
},
|
|
26
29
|
"devDependencies": {
|