diff --git a/package-lock.json b/package-lock.json index 0b28f5dd..d64b8aca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@adobe/spacecat-shared-data-access": "1.43.3", "@adobe/spacecat-shared-google-client": "1.2.2", "@adobe/spacecat-shared-http-utils": "1.6.8", - "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", + "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?0ffe830c28130f8ad8050a5c8ac0226ccd54e3b0", "@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/spacecat-shared-rum-api-client@1.8.4", "@adobe/spacecat-shared-utils": "1.19.6", "@aws-sdk/client-lambda": "3.637.0", @@ -5549,8 +5549,8 @@ }, "node_modules/@adobe/spacecat-shared-rum-api-client": { "version": "2.8.0", - "resolved": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", - "integrity": "sha512-Q7jqs9u+pqaijp1ygQN3zKep8EZj8hlbGAMf+QhJHyRE9KzoKTb6INnq7sPEIP8FclmkmkuQ/sXO2UCUuPeiCA==", + "resolved": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?0ffe830c28130f8ad8050a5c8ac0226ccd54e3b0", + "integrity": "sha512-BBqrCh7fP+eWWReMjpI6lyCnAKJGx3PFpY/1ivhqIZIONYN6NOOxqbCpyQgR+/yAFu2k9aprbGjum2lEC9FtRg==", "dependencies": { "@adobe/fetch": "4.1.8", "@adobe/helix-shared-wrap": "2.0.2", diff --git a/package.json b/package.json index 0a3927ee..0b4ed547 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@adobe/spacecat-shared-data-access": "1.43.3", "@adobe/spacecat-shared-google-client": "1.2.2", "@adobe/spacecat-shared-http-utils": "1.6.8", - "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", + "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?0ffe830c28130f8ad8050a5c8ac0226ccd54e3b0", "@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/spacecat-shared-rum-api-client@1.8.4", "@aws-sdk/client-lambda": "3.637.0", "@aws-sdk/credential-provider-node": "3.637.0", diff --git a/src/opportunities/opportunities.js b/src/opportunities/opportunities.js index c57d456b..1d7b1008 100644 --- a/src/opportunities/opportunities.js +++ b/src/opportunities/opportunities.js @@ -17,9 +17,9 @@ import { getRUMDomainkey } from '../support/utils.js'; const DAYS = 30; const OPPTY_QUERIES = [ - 'exp-opportunity/rage-click', - 'exp-opportunity/high-inorganic-high-bounce-rate', - 'exp-opportunity/high-organic-low-bounce-rate', + 'rageclick', + 'high-inorganic-high-bounce-rate', + 'high-organic-low-ctr', ]; let log = console; diff --git a/test/audits/opportunities.test.js b/test/audits/opportunities.test.js index 22905dfb..bb2ef5df 100644 --- a/test/audits/opportunities.test.js +++ b/test/audits/opportunities.test.js @@ -93,17 +93,20 @@ describe('Opportunities Tests', () => { }; const auditData = await opportunitiesHandler(url, context, site); - expect(context.rumApiClient.queryMulti).calledWith( - ['rageclick'], - { - domain: 'https://abc.com', - domainkey: 'abc_dummy_key', - interval: 30, - granularity: 'hourly', - }, - ); + const expected = Object.values(opportunitiesData).flatMap((data) => data); + + expect(context.rumApiClient.queryMulti).calledWith([ + 'rageclick', + 'high-inorganic-high-bounce-rate', + 'high-organic-low-ctr', + ], { + domain: 'https://abc.com', + domainkey: 'abc_dummy_key', + interval: 30, + granularity: 'hourly', + }); expect( auditData.auditResult.experimentationOpportunities, - ).to.deep.equal(opportunitiesData.rageclick); + ).to.deep.equal(expected); }); }); diff --git a/test/fixtures/opportunitiesdata.json b/test/fixtures/opportunitiesdata.json index fde23dbf..f738a5ec 100644 --- a/test/fixtures/opportunitiesdata.json +++ b/test/fixtures/opportunitiesdata.json @@ -61,5 +61,25 @@ } ] } - ] + ], + "high-organic-low-ctr": [{ + "type": "high-organic-low-ctr", + "page": "https://abc.com/abc-adoption/account", + "screenshot": "", + "trackedPageKPIName": "Click Through Rate", + "trackedPageKPIValue": "0.14", + "pageViews": 2145, + "samples": 123, + "metrics": [] + }], + "high-inorganic-high-bounce-rate": [{ + "type": "high-inorganic-high-bounce-rate", + "page": "https://abc.com/abc-adoption/pricing", + "screenshot": "", + "trackedPageKPIName": "Bounce Rate", + "trackedPageKPIValue": 0.76, + "pageViews": 8839, + "samples": 89, + "metrics": [] + }] }