Skip to content

Commit

Permalink
Change freezeAnimation -> freezeAnimatedImage
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack committed Sep 26, 2023
1 parent f520fbe commit 8f21c5b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
21 changes: 20 additions & 1 deletion packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,29 @@ export const configSchema = {
scope: {
type: 'string'
},
freezeAnimation: {
freezeAnimatedImage: {
type: 'boolean',
onlyAutomate: true
},
freezeAnimatedImageOptions: {
type: 'object',
additionalProperties: false,
onlyAutomate: true,
properties: {
freezeImageBySelectors: {
type: 'array',
items: {
type: 'string'
}
},
freezeImageByXpaths: {
type: 'array',
items: {
type: 'string'
}
}
}
},
ignoreRegions: {
type: 'object',
additionalProperties: false,
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export function percyAutomateRequestHandler(req, percy) {

req.body.options = merge([{
percyCSS: percy.config.snapshot.percyCSS,
freezeAnimation: percy.config.snapshot.freezeAnimation,
freezeAnimatedImage: percy.config.snapshot.freezeAnimatedImage || percy.config.snapshot.freezeAnimation,
freezeImageBySelectors: percy.config.snapshot.freezeAnimatedImageOptions?.freezeImageBySelectors,
freezeImageByXpaths: percy.config.snapshot.freezeAnimatedImageOptions?.freezeImageByXpaths,
ignoreRegionSelectors: percy.config.snapshot.ignoreRegions?.ignoreRegionSelectors,
ignoreRegionXpaths: percy.config.snapshot.ignoreRegions?.ignoreRegionXpaths,
considerRegionSelectors: percy.config.snapshot.considerRegions?.considerRegionSelectors,
Expand Down
10 changes: 7 additions & 3 deletions packages/core/test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ describe('API Server', () => {
await percy.start();

percy.config.snapshot.percyCSS = '.global { color: blue }';
percy.config.snapshot.freezeAnimation = false;
percy.config.snapshot.freezeAnimatedImage = false;
percy.config.snapshot.freezeAnimatedImageOptions = { freezeImageByXpaths: ['/xpath-global'] };
percy.config.snapshot.ignoreRegions = { ignoreRegionSelectors: ['.selector-global'] };
percy.config.snapshot.considerRegions = { considerRegionXpaths: ['/xpath-global'] };

Expand All @@ -286,7 +287,8 @@ describe('API Server', () => {
environment_info: 'environment',
options: {
percyCSS: '.percy-screenshot: { color: red }',
freeze_animation: true,
freeze_animated_image: true,
freezeImageBySelectors: ['.selector-per-screenshot'],
ignore_region_xpaths: ['/xpath-per-screenshot'],
consider_region_xpaths: ['/xpath-per-screenshot']
}
Expand All @@ -299,7 +301,9 @@ describe('API Server', () => {
environmentInfo: 'environment',
buildInfo: { id: '123', url: 'https://percy.io/test/test/123', number: 1 },
options: {
freezeAnimation: true,
freezeAnimatedImage: true,
freezeImageBySelectors: ['.selector-per-screenshot'],
freezeImageByXpaths: ['/xpath-global'],
percyCSS: '.global { color: blue }\n.percy-screenshot: { color: red }',
ignoreRegionSelectors: ['.selector-global'],
ignoreRegionXpaths: ['/xpath-per-screenshot'],
Expand Down
2 changes: 1 addition & 1 deletion packages/webdriver-utils/src/providers/genericProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class GenericProvider {
}

addDefaultOptions() {
this.options.freezeAnimation = this.options.freezeAnimation || false;
this.options.freezeAnimation = this.options.freezeAnimatedImage || this.options.freezeAnimation || false;
}

defaultPercyCSS() {
Expand Down

0 comments on commit 8f21c5b

Please sign in to comment.