Skip to content

Commit

Permalink
🐛 fix casing issue for PoA configs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjwala committed Sep 25, 2023
1 parent cb64b0c commit f520fbe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions packages/config/src/utils/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { getSchema } from '../validate.js';
const CAMELCASE_MAP = new Map([
['css', 'CSS'],
['javascript', 'JavaScript'],
['dom', 'DOM'],
['xpaths', 'XPaths']
['dom', 'DOM']
]);

// Regular expression that matches words from boundaries or consecutive casing
Expand Down
6 changes: 3 additions & 3 deletions packages/config/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ describe('PercyConfig', () => {
enableJavaScript: false,
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXPaths: ['']
ignoreRegionXpaths: ['']
});
});

Expand All @@ -1224,7 +1224,7 @@ describe('PercyConfig', () => {
enableJavaScript: false,
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXPaths: ['']
ignoreRegionXpaths: ['']
}, { kebab: true })).toEqual({
'foo-bar': 'baz',
foo: { 'bar-baz': 'qux' },
Expand All @@ -1246,7 +1246,7 @@ describe('PercyConfig', () => {
enableJavaScript: false,
disableShadowDOM: true,
cliEnableJavaScript: true,
ignoreRegionXPaths: ['']
ignoreRegionXpaths: ['']
}, { snake: true })).toEqual({
foo_bar: 'baz',
foo: { bar_baz: 'qux' },
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const configSchema = {
type: 'string'
}
},
considerRegionXPaths: {
considerRegionXpaths: {
type: 'array',
items: {
type: 'string'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function percyAutomateRequestHandler(req, percy) {
ignoreRegionSelectors: percy.config.snapshot.ignoreRegions?.ignoreRegionSelectors,
ignoreRegionXpaths: percy.config.snapshot.ignoreRegions?.ignoreRegionXpaths,
considerRegionSelectors: percy.config.snapshot.considerRegions?.considerRegionSelectors,
considerRegionXPaths: percy.config.snapshot.considerRegions?.considerRegionXPaths
considerRegionXpaths: percy.config.snapshot.considerRegions?.considerRegionXpaths
},
camelCasedOptions
], (path, prev, next) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe('API Server', () => {
percy.config.snapshot.percyCSS = '.global { color: blue }';
percy.config.snapshot.freezeAnimation = false;
percy.config.snapshot.ignoreRegions = { ignoreRegionSelectors: ['.selector-global'] };
percy.config.snapshot.considerRegions = { considerRegionXPaths: ['/xpath-global'] };
percy.config.snapshot.considerRegions = { considerRegionXpaths: ['/xpath-global'] };

await expectAsync(request('/percy/automateScreenshot', {
body: {
Expand All @@ -302,8 +302,8 @@ describe('API Server', () => {
freezeAnimation: true,
percyCSS: '.global { color: blue }\n.percy-screenshot: { color: red }',
ignoreRegionSelectors: ['.selector-global'],
ignoreRegionXPaths: ['/xpath-per-screenshot'],
considerRegionXPaths: ['/xpath-global', '/xpath-per-screenshot']
ignoreRegionXpaths: ['/xpath-per-screenshot'],
considerRegionXpaths: ['/xpath-global', '/xpath-per-screenshot']
}
}));

Expand Down

0 comments on commit f520fbe

Please sign in to comment.