Skip to content

Commit 749f3d8

Browse files
committed
test: update testing flow
1 parent ecb9b04 commit 749f3d8

File tree

6 files changed

+48
-72
lines changed

6 files changed

+48
-72
lines changed

android/libs/adjust-android.jar

0 Bytes
Binary file not shown.

ios/AdjustSdk.m

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -766,28 +766,10 @@ @implementation AdjustSdk
766766
testOptions.deleteState = [value boolValue];
767767
}
768768
}
769-
if ([dict objectForKey:@"baseUrl"]) {
770-
NSString *value = dict[@"baseUrl"];
769+
if ([dict objectForKey:@"urlOverwrite"]) {
770+
NSString *value = dict[@"urlOverwrite"];
771771
if ([self isFieldValid:value]) {
772-
testOptions.baseUrl = value;
773-
}
774-
}
775-
if ([dict objectForKey:@"gdprUrl"]) {
776-
NSString *value = dict[@"gdprUrl"];
777-
if ([self isFieldValid:value]) {
778-
testOptions.gdprUrl = value;
779-
}
780-
}
781-
if ([dict objectForKey:@"subscriptionUrl"]) {
782-
NSString *value = dict[@"subscriptionUrl"];
783-
if ([self isFieldValid:value]) {
784-
testOptions.subscriptionUrl = value;
785-
}
786-
}
787-
if ([dict objectForKey:@"purchaseVerificationUrl"]) {
788-
NSString *value = dict[@"purchaseVerificationUrl"];
789-
if ([self isFieldValid:value]) {
790-
testOptions.purchaseVerificationUrl = value;
772+
testOptions.urlOverwrite = value;
791773
}
792774
}
793775
if ([dict objectForKey:@"extraPath"]) {
@@ -838,6 +820,18 @@ @implementation AdjustSdk
838820
testOptions.adServicesFrameworkEnabled = [value boolValue];
839821
}
840822
}
823+
if ([dict objectForKey:@"attStatus"]) {
824+
NSString *value = dict[@"attStatus"];
825+
if ([self isFieldValid:value]) {
826+
testOptions.attStatusInt = [NSNumber numberWithInt:[value intValue]];
827+
}
828+
}
829+
if ([dict objectForKey:@"idfa"]) {
830+
NSString *value = dict[@"idfa"];
831+
if ([self isFieldValid:value]) {
832+
testOptions.idfa = value;
833+
}
834+
}
841835

842836
[Adjust setTestOptions:testOptions];
843837
}
0 Bytes
Binary file not shown.

test/app/App.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,22 @@ const App: () => React$Node = () => {
4747
AdjustSdkTestEmitter = new NativeEventEmitter(NativeModules.ASTEventEmitter);
4848
}
4949

50-
var baseUrl = "";
51-
var gdprUrl = "";
52-
var subscriptionUrl = "";
53-
var ipAddress = "192.168.8.64";
50+
var urlOverwrite = "";
51+
var ipAddress = "192.168.86.53";
5452
if (Platform.OS === "android") {
55-
baseUrl = "https://" + ipAddress + ":8443";
56-
gdprUrl = "https://" + ipAddress + ":8443";
57-
subscriptionUrl = "https://" + ipAddress + ":8443";
58-
purchaseVerificationUrl = "https://" + ipAddress + ":8443";
53+
urlOverwrite = "https://" + ipAddress + ":8443";
5954
} else if (Platform.OS === "ios") {
60-
baseUrl = "http://" + ipAddress + ":8080";
61-
gdprUrl = "http://" + ipAddress + ":8080";
62-
subscriptionUrl = "http://" + ipAddress + ":8080";
63-
purchaseVerificationUrl = "http://" + ipAddress + ":8080";
55+
urlOverwrite = "http://" + ipAddress + ":8080";
6456
}
6557
var controlUrl = "ws://" + ipAddress + ":1987";
6658

6759
// AdjustSdkTest.addTestDirectory("purchase-verification");
6860
// AdjustSdkTest.addTest("Test_AdRevenue_ad_revenue_v2");
6961
Adjust.getSdkVersion(function(sdkVersion) {
70-
AdjustSdkTest.startTestSession(baseUrl, controlUrl, sdkVersion);
62+
AdjustSdkTest.startTestSession(urlOverwrite, controlUrl, sdkVersion);
7163
});
7264

73-
const commandExecutor = new CommandExecutor(baseUrl, gdprUrl, subscriptionUrl, purchaseVerificationUrl);
65+
const commandExecutor = new CommandExecutor(urlOverwrite);
7466
emitterSubscription = AdjustSdkTestEmitter.addListener('command', (json) => {
7567
const className = json["className"];
7668
const functionName = json["functionName"];

test/app/command_executor.js

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function AdjustCommand(functionName, params, order) {
4545
this.order = order;
4646
};
4747

48-
export function CommandExecutor(baseUrl, gdprUrl, subscriptionUrl, purchaseVerificationUrl) {
49-
this.adjustCommandExecutor = new AdjustCommandExecutor(baseUrl, gdprUrl, subscriptionUrl, purchaseVerificationUrl);
48+
export function CommandExecutor(urlOverwrite) {
49+
this.adjustCommandExecutor = new AdjustCommandExecutor(urlOverwrite);
5050
};
5151

5252
CommandExecutor.prototype.scheduleCommand = function(className, functionName, params, order) {
@@ -58,16 +58,9 @@ CommandExecutor.prototype.scheduleCommand = function(className, functionName, pa
5858
}
5959
};
6060

61-
function AdjustCommandExecutor(baseUrl, gdprUrl, subscriptionUrl, purchaseVerificationUrl) {
62-
this.baseUrl = baseUrl;
63-
this.gdprUrl = gdprUrl;
64-
this.subscriptionUrl = subscriptionUrl;
65-
this.purchaseVerificationUrl = purchaseVerificationUrl;
61+
function AdjustCommandExecutor(urlOverwrite) {
62+
this.urlOverwrite = urlOverwrite;
6663
this.extraPath = null;
67-
this.basePath = null;
68-
this.gdprPath = null;
69-
this.subscriptionPath = null;
70-
this.purchaseVerificationPath = null;
7164
this.savedEvents = {};
7265
this.savedConfigs = {};
7366
this.savedCommands = [];
@@ -155,17 +148,10 @@ AdjustCommandExecutor.prototype.executeCommand = function(command, idx) {
155148

156149
AdjustCommandExecutor.prototype.testOptions = function(params) {
157150
var testOptions = new AdjustTestOptions();
158-
testOptions.baseUrl = this.baseUrl;
159-
testOptions.gdprUrl = this.gdprUrl;
160-
testOptions.subscriptionUrl = this.subscriptionUrl;
161-
testOptions.purchaseVerificationUrl = this.purchaseVerificationUrl;
151+
testOptions.urlOverwrite = this.urlOverwrite;
162152

163153
if ('basePath' in params) {
164154
this.extraPath = getFirstParameterValue(params, 'basePath');
165-
this.basePath = getFirstParameterValue(params, 'basePath');
166-
this.gdprPath = getFirstParameterValue(params, 'basePath');
167-
this.subscriptionPath = getFirstParameterValue(params, 'basePath');
168-
this.purchaseVerificationPath = getFirstParameterValue(params, 'basePath');
169155
}
170156
if ('timerInterval' in params) {
171157
testOptions.timerIntervalInMilliseconds = getFirstParameterValue(params, 'timerInterval').toString();
@@ -185,6 +171,12 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
185171
if ('adServicesFrameworkEnabled' in params) {
186172
testOptions.adServicesFrameworkEnabled = getFirstParameterValue(params, 'adServicesFrameworkEnabled').toString() === 'true';
187173
}
174+
if ('attStatus' in params) {
175+
testOptions.attStatus = getFirstParameterValue(params, 'attStatus').toString();
176+
}
177+
if ('idfa' in params) {
178+
testOptions.idfa = getFirstParameterValue(params, 'idfa').toString();
179+
}
188180
var useTestConnectionOptions = false;
189181
if ('teardown' in params) {
190182
var teardownOptions = getValueFromKey(params, 'teardown');
@@ -194,10 +186,6 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
194186
if ('resetSdk' === option) {
195187
testOptions.teardown = true;
196188
testOptions.extraPath = this.extraPath;
197-
testOptions.basePath = this.basePath;
198-
testOptions.gdprPath = this.gdprPath;
199-
testOptions.subscriptionPath = this.subscriptionPath;
200-
testOptions.purchaseVerificationPath = this.purchaseVerificationPath;
201189
testOptions.useTestConnectionOptions = true;
202190
useTestConnectionOptions = true;
203191
Adjust.teardown('test');
@@ -218,10 +206,6 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
218206
if ('sdk' === option) {
219207
testOptions.teardown = true;
220208
testOptions.extraPath = null;
221-
testOptions.basePath = null;
222-
testOptions.gdprPath = null;
223-
testOptions.subscriptionPath = null;
224-
testOptions.purchaseVerificationPath = null;
225209
testOptions.useTestConnectionOptions = false;
226210
Adjust.teardown('test');
227211
}
@@ -398,6 +382,12 @@ AdjustCommandExecutor.prototype.config = function(params) {
398382
}
399383
}
400384

385+
if ('attConsentWaitingSeconds' in params) {
386+
var attConsentWaitingSecondsS = getFirstParameterValue(params, 'attConsentWaitingSeconds');
387+
var attConsentWaitingSeconds = parseFloat(attConsentWaitingSecondsS);
388+
adjustConfig.setAttConsentWaitingInterval(attConsentWaitingSeconds);
389+
}
390+
401391
if ('userAgent' in params) {
402392
var userAgent = getFirstParameterValue(params, 'userAgent');
403393
adjustConfig.setUserAgent(userAgent);
@@ -419,7 +409,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
419409
AdjustSdkTest.addInfoToSend("costCurrency", attribution.costCurrency);
420410
AdjustSdkTest.addInfoToSend("fbInstallReferrer", attribution.fbInstallReferrer);
421411

422-
AdjustSdkTest.sendInfoToServer(_this.basePath);
412+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
423413
});
424414
}
425415

@@ -433,7 +423,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
433423
AdjustSdkTest.addInfoToSend("jsonResponse", sessionSuccess.jsonResponse.toString());
434424
}
435425

436-
AdjustSdkTest.sendInfoToServer(_this.basePath);
426+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
437427
});
438428
}
439429

@@ -448,7 +438,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
448438
AdjustSdkTest.addInfoToSend("jsonResponse", sessionFailed.jsonResponse.toString());
449439
}
450440

451-
AdjustSdkTest.sendInfoToServer(_this.basePath);
441+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
452442
});
453443
}
454444

@@ -464,7 +454,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
464454
AdjustSdkTest.addInfoToSend("jsonResponse", eventSuccess.jsonResponse.toString());
465455
}
466456

467-
AdjustSdkTest.sendInfoToServer(_this.basePath);
457+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
468458
});
469459
}
470460

@@ -481,7 +471,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
481471
AdjustSdkTest.addInfoToSend("jsonResponse", eventFailed.jsonResponse.toString());
482472
}
483473

484-
AdjustSdkTest.sendInfoToServer(_this.basePath);
474+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
485475
});
486476
}
487477

@@ -492,7 +482,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
492482
adjustConfig.setShouldLaunchDeeplink(launchDeferredDeeplink);
493483
adjustConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
494484
AdjustSdkTest.addInfoToSend("deeplink", deeplink.uri);
495-
AdjustSdkTest.sendInfoToServer(_this.basePath);
485+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
496486
});
497487
}
498488
};
@@ -923,7 +913,7 @@ AdjustCommandExecutor.prototype.getLastDeeplink = function(params) {
923913
var _this = this;
924914
Adjust.getLastDeeplink(function(lastDeeplink) {
925915
AdjustSdkTest.addInfoToSend('last_deeplink', lastDeeplink);
926-
AdjustSdkTest.sendInfoToServer(_this.basePath);
916+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
927917
});
928918
}
929919
};
@@ -939,7 +929,7 @@ AdjustCommandExecutor.prototype.verifyPurchase = function(params) {
939929
AdjustSdkTest.addInfoToSend('verification_status', verificationInfo.verificationStatus);
940930
AdjustSdkTest.addInfoToSend('code', verificationInfo.code);
941931
AdjustSdkTest.addInfoToSend('message', verificationInfo.message);
942-
AdjustSdkTest.sendInfoToServer(_this.basePath);
932+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
943933
});
944934
} else if (Platform.OS === "android") {
945935
var productId = getFirstParameterValue(params, 'productId');
@@ -950,7 +940,7 @@ AdjustCommandExecutor.prototype.verifyPurchase = function(params) {
950940
AdjustSdkTest.addInfoToSend('verification_status', verificationInfo.verificationStatus);
951941
AdjustSdkTest.addInfoToSend('code', verificationInfo.code);
952942
AdjustSdkTest.addInfoToSend('message', verificationInfo.message);
953-
AdjustSdkTest.sendInfoToServer(_this.basePath);
943+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
954944
});
955945
}
956946
};
@@ -960,7 +950,7 @@ AdjustCommandExecutor.prototype.processDeeplink = function(params) {
960950
var _this = this;
961951
Adjust.processDeeplink(deeplink, function(resolvedLink) {
962952
AdjustSdkTest.addInfoToSend('resolved_link', resolvedLink);
963-
AdjustSdkTest.sendInfoToServer(_this.basePath);
953+
AdjustSdkTest.sendInfoToServer(_this.extraPath);
964954
});
965955
};
966956

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)