Skip to content

Commit

Permalink
Adding CLI Metrics to measure client duration (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit3200 authored Aug 30, 2023
1 parent bac46d4 commit 68e43af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@ export const comparisonSchema = {
windowHeight: {
type: 'integer',
minimum: 0
}
},
cliScreenshotStartTime: { type: 'integer', default: 0 },
cliScreenshotEndTime: { type: 'integer', default: 0 }
}
},
tag: {
Expand Down
6 changes: 5 additions & 1 deletion packages/webdriver-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ export default class WebdriverUtils {

async automateScreenshot() {
try {
const startTime = Date.now();
this.log.info(`[${this.snapshotName}] : Starting automate screenshot ...`);
const automate = ProviderResolver.resolve(this.sessionId, this.commandExecutorUrl, this.capabilities, this.sessionCapabilites, this.clientInfo, this.environmentInfo, this.options, this.buildInfo);
this.log.debug(`[${this.snapshotName}] : Resolved provider ...`);
await automate.createDriver();
this.log.debug(`[${this.snapshotName}] : Created driver ...`);
return await automate.screenshot(this.snapshotName, this.options);
const comparisonData = await automate.screenshot(this.snapshotName, this.options);
comparisonData.metadata.cliScreenshotStartTime = startTime;
comparisonData.metadata.cliScreenshotEndTime = Date.now();
return comparisonData;
} catch (e) {
this.log.error(`[${this.snapshotName}] : Error - ${e.message}`);
this.log.error(`[${this.snapshotName}] : Error Log - ${e.toString()}`);
Expand Down

0 comments on commit 68e43af

Please sign in to comment.