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

chore: onboard adobe to proxy v1 tests #3163

Merged
merged 3 commits into from
Mar 18, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import { ProxyMetdata } from '../../../../../src/types';
import { ProxyV1TestData } from '../../../testTypes';
import { generateProxyV1Payload } from '../../../testUtils';

const statTags = {
aborted: {
destType: 'ADOBE_ANALYTICS',
destinationId: 'dummyDestinationId',
errorCategory: 'dataValidation',
errorType: 'instrumentation',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
workspaceId: 'dummyWorkspaceId',
},
};

export const proxyMetdata: ProxyMetdata = {
jobId: 1,
attemptNum: 1,
userId: 'dummyUserId',
sourceId: 'dummySourceId',
destinationId: 'dummyDestinationId',
workspaceId: 'dummyWorkspaceId',
secret: {},
dontBatch: false,
};
const headers = {
'Content-Type': 'application/xml',
};

export const reqMetadataArray = [proxyMetdata];

const failureRequestParameters = {
XML: {
payload:
'<?xml version="1.0" encoding="utf-8"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><marketingcloudorgid/><events>prodView</events><products>Games;;11;148.39</products><reportSuiteID>failureReport</reportSuiteID></request>',
yashasvibajpai marked this conversation as resolved.
Show resolved Hide resolved
},
params: {},
};

const successRequestParameters = {
XML: {
payload:
'<?xml version="1.0" encoding="utf-8"?><request><ipaddress>127.0.1.0</ipaddress><pageUrl>www.google.co.in</pageUrl><pageName>Google</pageName><visitorID>id1110011</visitorID><events>prodView</events><products>Games;Monopoly;1;14.00,Games;UNO;2;6.90</products><reportSuiteID>successreport</reportSuiteID></request>',
},
params: {},
};

export const testScenariosForV1API: ProxyV1TestData[] = [
{
id: 'adobe_analytics_v1_scenario_1',
name: 'adobe_analytics',
description: '[Proxy v1 API] :: Test for Failure response from Adobe Analytics with reason',
successCriteria: 'Should return a 400 status code with reason',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
...failureRequestParameters,
headers,
endpoint: 'https://adobe.failure.omtrdc.net/b/ss//6',
},
reqMetadataArray,
),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 400,
statTags: statTags.aborted,
message:
'[ADOBE_ANALYTICS Response Handler] Request failed for destination adobe_analytics : NO pagename OR pageurl',
response: [
{
error:
'[ADOBE_ANALYTICS Response Handler] Request failed for destination adobe_analytics : NO pagename OR pageurl',
metadata: proxyMetdata,
statusCode: 400,
},
],
},
},
},
},
},
{
id: 'adobe_analytics_v1_scenario_2',
name: 'adobe_analytics',
description:
'[Proxy v1 API] :: Test for Failure response from Adobe Analytics without reason (Generic error)',
successCriteria: 'Should return a 400 status code with a general error',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
...failureRequestParameters,
headers,
endpoint: 'https://adobe.failure2.omtrdc.net/b/ss//6',
},
reqMetadataArray,
),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 400,
statTags: statTags.aborted,
message:
'[ADOBE_ANALYTICS Response Handler] Request failed for destination adobe_analytics with a general error',
response: [
{
error:
'[ADOBE_ANALYTICS Response Handler] Request failed for destination adobe_analytics with a general error',
metadata: proxyMetdata,
statusCode: 400,
},
],
},
},
},
},
},
{
id: 'adobe_analytics_v1_scenario_3',
name: 'adobe_analytics',
description: '[Proxy v1 API] :: Test for Success response from Adobe Analytics',
successCriteria: 'Should return a 200 status code with status SUCCESS',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
...successRequestParameters,
headers,
endpoint: 'https://adobe.success.omtrdc.net/b/ss//6',
},
reqMetadataArray,
),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 200,
message: '[ADOBE_ANALYTICS] - Request Processed Successfully',
response: [
{
error: '"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><status>SUCCESS</status>"',
metadata: proxyMetdata,
statusCode: 200,
},
],
},
},
},
},
},
];
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const data = [
import { testScenariosForV1API } from './business';

const legacyTests = [
{
name: 'adobe_analytics',
description: 'Test 0: Failure response from Adobe Analytics with reason',
Expand Down Expand Up @@ -72,7 +74,7 @@ export const data = [
JSON_ARRAY: {},
XML: {
payload:
'<?xml version="1.0" encoding="utf-8"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><marketingcloudorgid/><events>prodView</events><products>Games;;11;148.39</products><reportSuiteID>failureReportgeneric</reportSuiteID></request>',
'<?xml version="1.0" encoding="utf-8"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><marketingcloudorgid/><events>prodView</events><products>Games;;11;148.39</products><reportSuiteID>failureReport</reportSuiteID></request>',
},
FORM: {},
},
Expand Down Expand Up @@ -140,3 +142,5 @@ export const data = [
},
},
];

export const data = [...testScenariosForV1API, ...legacyTests];
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const networkCallsData = [
{
httpReq: {
url: 'https://adobe.failure2.omtrdc.net/b/ss//6',
data: '<?xml version="1.0" encoding="utf-8"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><marketingcloudorgid/><events>prodView</events><products>Games;;11;148.39</products><reportSuiteID>failureReportgeneric</reportSuiteID></request>',
data: '<?xml version="1.0" encoding="utf-8"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><marketingcloudorgid/><events>prodView</events><products>Games;;11;148.39</products><reportSuiteID>failureReport</reportSuiteID></request>',
params: {},
headers: {
'Content-Type': 'application/xml',
Expand Down
Loading