Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding additional params for test case base grouping to snapshot and comparison #1547

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/cli-upload/test/upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ describe('percy upload', () => {
'scope-options': {},
'minimum-height': 10,
'enable-javascript': null,
'enable-layout': false
'enable-layout': false,
'th-test-case-execution-id': null
},
relationships: {
resources: {
Expand Down
4 changes: 3 additions & 1 deletion packages/client/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export class PercyClient {
environmentInfo,
sync,
testCase,
thTestCaseExecutionId,
resources = []
} = {}) {
validateId('build', buildId);
Expand Down Expand Up @@ -388,7 +389,8 @@ export class PercyClient {
'scope-options': scopeOptions || {},
'minimum-height': minHeight || null,
'enable-javascript': enableJavaScript || null,
'enable-layout': enableLayout || false
'enable-layout': enableLayout || false,
'th-test-case-execution-id': thTestCaseExecutionId || null
},
relationships: {
resources: {
Expand Down
13 changes: 9 additions & 4 deletions packages/client/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ describe('PercyClient', () => {
enableLayout: true,
clientInfo: 'sdk/info',
environmentInfo: 'sdk/env',
thTestCaseExecutionId: 'random-uuid',
resources: [{
url: '/foo',
content: 'foo',
Expand Down Expand Up @@ -694,7 +695,8 @@ describe('PercyClient', () => {
'minimum-height': 1000,
'scope-options': { scroll: true },
'enable-javascript': true,
'enable-layout': true
'enable-layout': true,
'th-test-case-execution-id': 'random-uuid'
},
relationships: {
resources: {
Expand Down Expand Up @@ -740,7 +742,8 @@ describe('PercyClient', () => {
'scope-options': {},
'minimum-height': null,
'enable-javascript': null,
'enable-layout': false
'enable-layout': false,
'th-test-case-execution-id': null
},
relationships: {
resources: {
Expand Down Expand Up @@ -809,7 +812,8 @@ describe('PercyClient', () => {
'enable-javascript': null,
'minimum-height': null,
widths: null,
'enable-layout': false
'enable-layout': false,
'th-test-case-execution-id': null
},
relationships: {
resources: {
Expand Down Expand Up @@ -1318,7 +1322,8 @@ describe('PercyClient', () => {
'minimum-height': null,
widths: null,
sync: false,
'enable-layout': false
'enable-layout': false,
'th-test-case-execution-id': null
},
relationships: {
resources: {
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const configSchema = {
testCase: {
type: 'string'
},
thTestCaseExecutionId: {
type: 'string'
},
fullPage: {
type: 'boolean',
onlyAutomate: true
Expand Down Expand Up @@ -271,6 +274,7 @@ export const snapshotSchema = {
enableLayout: { $ref: '/config/snapshot#/properties/enableLayout' },
sync: { $ref: '/config/snapshot#/properties/sync' },
testCase: { $ref: '/config/snapshot#/properties/testCase' },
thTestCaseExecutionId: { $ref: '/config/snapshot#/properties/thTestCaseExecutionId' },
reshuffleInvalidTags: { $ref: '/config/snapshot#/properties/reshuffleInvalidTags' },
scopeOptions: { $ref: '/config/snapshot#/properties/scopeOptions' },
discovery: {
Expand Down Expand Up @@ -558,6 +562,12 @@ export const comparisonSchema = {
externalDebugUrl: { type: 'string' },
domInfoSha: { type: 'string' },
sync: { type: 'boolean' },
testCase: {
type: 'string'
},
thTestCaseExecutionId: {
type: 'string'
},
metadata: {
type: 'object',
additionalProperties: false,
Expand Down
8 changes: 6 additions & 2 deletions packages/core/test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ describe('API Server', () => {
freeze_animated_image: true,
freezeImageBySelectors: ['.selector-per-screenshot'],
ignore_region_xpaths: ['/xpath-per-screenshot'],
consider_region_xpaths: ['/xpath-per-screenshot']
consider_region_xpaths: ['/xpath-per-screenshot'],
testCase: 'random test case',
thTestCaseExecutionId: 'random uuid'
}
},
method: 'post'
Expand All @@ -374,7 +376,9 @@ describe('API Server', () => {
ignoreRegionSelectors: ['.selector-global'],
ignoreRegionXpaths: ['/xpath-per-screenshot'],
considerRegionXpaths: ['/xpath-global', '/xpath-per-screenshot'],
version: 'v2'
version: 'v2',
testCase: 'random test case',
thTestCaseExecutionId: 'random uuid'
}
}));

Expand Down
2 changes: 2 additions & 0 deletions packages/webdriver-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default class WebdriverUtils {
comparisonData.metadata.cliScreenshotStartTime = startTime;
comparisonData.metadata.cliScreenshotEndTime = Date.now();
comparisonData.sync = options.sync;
comparisonData.testCase = options.testCase;
comparisonData.thTestCaseExecutionId = options.thTestCaseExecutionId;
log.debug(`[${snapshotName}] : Comparison Data: ${JSON.stringify(comparisonData)}`);
return comparisonData;
} catch (e) {
Expand Down