Skip to content

Commit

Permalink
Add FullPage in global config for PoA (#1477)
Browse files Browse the repository at this point in the history
* Add FullPage in global config for PoA

* Simulating test: local should have more priority
  • Loading branch information
Amit3200 authored Dec 22, 2023
1 parent 664163f commit 6c50702
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/config/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,8 @@ describe('PercyConfig', () => {
'disable-shadow-dom': true,
'cli-enable-javascript': true,
'ignore-region-xpaths': [''],
'enable-layout': false
'enable-layout': false,
'full-page': false
})).toEqual({
fooBar: 'baz',
foo: { barBaz: 'qux' },
Expand All @@ -1213,7 +1214,8 @@ describe('PercyConfig', () => {
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXpaths: [''],
enableLayout: false
enableLayout: false,
fullPage: false
});
});

Expand All @@ -1227,7 +1229,8 @@ describe('PercyConfig', () => {
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXpaths: [''],
enableLayout: false
enableLayout: false,
fullPage: false
}, { kebab: true })).toEqual({
'foo-bar': 'baz',
foo: { 'bar-baz': 'qux' },
Expand All @@ -1237,7 +1240,8 @@ describe('PercyConfig', () => {
'disable-shadow-dom': true,
'cli-enable-javascript': true,
'ignore-region-xpaths': [''],
'enable-layout': false
'enable-layout': false,
'full-page': false
});
});

Expand All @@ -1251,7 +1255,8 @@ describe('PercyConfig', () => {
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXpaths: [''],
enableLayout: false
enableLayout: false,
fullPage: false
}, { snake: true })).toEqual({
foo_bar: 'baz',
foo: { bar_baz: 'qux' },
Expand All @@ -1261,7 +1266,8 @@ describe('PercyConfig', () => {
disable_shadow_dom: true,
cli_enable_javascript: true,
ignore_region_xpaths: [''],
enable_layout: false
enable_layout: false,
full_page: false
});
});

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const configSchema = {
}
}
},
fullPage: {
type: 'boolean',
onlyAutomate: true
},
freezeAnimation: { // for backward compatibility
type: 'boolean',
onlyAutomate: true
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function percyAutomateRequestHandler(req, percy) {
});

req.body.options = merge([{
fullPage: percy.config.snapshot.fullPage,
percyCSS: percy.config.snapshot.percyCSS,
freezeAnimatedImage: percy.config.snapshot.freezeAnimatedImage || percy.config.snapshot.freezeAnimation,
freezeImageBySelectors: percy.config.snapshot.freezeAnimatedImageOptions?.freezeImageBySelectors,
Expand Down
3 changes: 3 additions & 0 deletions packages/core/test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ describe('API Server', () => {

await percy.start();

percy.config.snapshot.fullPage = false;
percy.config.snapshot.percyCSS = '.global { color: blue }';
percy.config.snapshot.freezeAnimatedImage = false;
percy.config.snapshot.freezeAnimatedImageOptions = { freezeImageByXpaths: ['/xpath-global'] };
Expand All @@ -286,6 +287,7 @@ describe('API Server', () => {
client_info: 'client',
environment_info: 'environment',
options: {
fullPage: true,
percyCSS: '.percy-screenshot: { color: red }',
freeze_animated_image: true,
freezeImageBySelectors: ['.selector-per-screenshot'],
Expand All @@ -301,6 +303,7 @@ describe('API Server', () => {
environmentInfo: 'environment',
buildInfo: { id: '123', url: 'https://percy.io/test/test/123', number: 1 },
options: {
fullPage: true,
freezeAnimatedImage: true,
freezeImageBySelectors: ['.selector-per-screenshot'],
freezeImageByXpaths: ['/xpath-global'],
Expand Down

0 comments on commit 6c50702

Please sign in to comment.