Skip to content

Commit e3742a8

Browse files
Merge pull request #367 from Countly/staging
Staging
2 parents 1d043b3 + 1f6d0ab commit e3742a8

19 files changed

+73
-53
lines changed

example/integration_test/experimental_tests/visibility_prev_names_recording_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ void main() {
1919
await Countly.initWithConfig(config);
2020

2121
await createMixViewsAndEvents(inForeground: true);
22-
sleep(Duration(seconds: 2)); // lets add duration to session
22+
await Future.delayed(const Duration(seconds: 2)); // lets add duration to session
2323

2424
FlutterForegroundTask.minimizeApp();
25-
sleep(Duration(seconds: 2));
25+
await Future.delayed(const Duration(seconds: 2));
2626

2727
// record events and views in background
2828
await createMixViewsAndEvents(inForeground: false);
@@ -31,7 +31,7 @@ void main() {
3131
if (Platform.isIOS) {
3232
printMessageMultipleTimes('waiting for 3 seconds, now go to foreground', 3);
3333
}
34-
sleep(Duration(seconds: 5));
34+
await Future.delayed(const Duration(seconds: 5));
3535

3636
// Get request and event queues from native side
3737
List<String> requestList = await getRequestQueue();

example/integration_test/sc-AP-appPerformanceMonit/AP_207A_enableFBAndStartTimeTracking_manual_test.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:countly_flutter/countly_flutter.dart';
2+
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
23
import 'package:flutter_test/flutter_test.dart';
34
import 'package:integration_test/integration_test.dart';
45
import '../utils.dart';
@@ -17,7 +18,14 @@ void main() {
1718

1819
// go foreground and background
1920
// TODO: this automation is Android only, iOS automation is not supported yet
20-
goBackgroundAndForeground();
21+
FlutterForegroundTask.minimizeApp();
22+
23+
print('Waiting for 3 seconds in background');
24+
await Future.delayed(const Duration(seconds: 3));
25+
26+
FlutterForegroundTask.launchApp();
27+
28+
await Future.delayed(const Duration(seconds: 2));
2129

2230
// check if there is 3 apm related requests in the queue
2331
List<String> apmRequests = await getAndPrintWantedElementsWithParamFromAllQueues('apm');

example/integration_test/sc-AP-appPerformanceMonit/AP_207B_enableFBAndStartTimeTracking_manual_test.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io';
22

33
import 'package:countly_flutter/countly_flutter.dart';
4+
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
45
import 'package:flutter_test/flutter_test.dart';
56
import 'package:integration_test/integration_test.dart';
67
import '../utils.dart';
@@ -20,7 +21,15 @@ void main() {
2021

2122
// go foreground and background
2223
// TODO: this automation is Android only, iOS automation is not supported yet
23-
goBackgroundAndForeground();
24+
FlutterForegroundTask.minimizeApp();
25+
26+
print('Waiting for 3 seconds in background');
27+
await Future.delayed(const Duration(seconds: 3));
28+
29+
FlutterForegroundTask.launchApp();
30+
31+
await Future.delayed(const Duration(seconds: 2));
32+
2433

2534
// check if there is 3 apm related requests in the queue
2635
List<String> apmRequests = await getAndPrintWantedElementsWithParamFromAllQueues('apm');

example/integration_test/server_tests/BM_200_timeout_test.dart

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,16 @@ void main() {
3434
expect(eventList.isEmpty, true);
3535
expect(requestList[0], contains("begin_session"));
3636

37-
if (Platform.isAndroid) {
38-
expect(requestArray.length, 5);
39-
expect(requestArray[0]['method'], contains("sc"));
40-
expect(requestArray[1]['begin_session'], ['1']);
41-
expect(requestArray[2]['hc'], isNotNull);
42-
expect(requestArray[3]['begin_session'], ['1']);
43-
expect(requestArray[4]['method'], contains("sc"));
44-
} else if (Platform.isIOS) {
45-
expect(requestArray.length, 4);
46-
int beginSessions = 0, scCount = 0, hcCount = 0;
47-
for (final req in requestArray) {
48-
if (req.containsKey('begin_session')) beginSessions++;
49-
if (req.containsKey('method') && req['method']!.contains('sc')) scCount++;
50-
if (req.containsKey('hc')) hcCount++;
51-
}
52-
expect(beginSessions, equals(2));
53-
expect(scCount, equals(1));
54-
expect(hcCount, equals(1));
37+
expect(requestArray.length, 4);
38+
int beginSessions = 0, scCount = 0, hcCount = 0;
39+
for (final req in requestArray) {
40+
print(req.toString());
41+
if (req.containsKey('begin_session')) beginSessions++;
42+
if (req.containsKey('method') && req['method']!.contains('sc')) scCount++;
43+
if (req.containsKey('hc')) hcCount++;
5544
}
45+
expect(beginSessions, equals(2));
46+
expect(scCount, equals(1));
47+
expect(hcCount, equals(1));
5648
});
5749
}

example/integration_test/server_tests/BM_201B_no_backoff_D_FQ_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void main() {
5454
requestList = await getRequestQueue(); // List of strings
5555
eventList = await getEventQueue(); // List of json objects
5656

57-
expect(requestList.length, Platform.isAndroid ? 4 : 5);
57+
expect(requestList.length, 5);
5858
expect(eventList.length, 0);
5959
});
6060
}

example/integration_test/server_tests/BM_202B_no_backoff_FQ_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:io';
2+
13
import 'package:countly_flutter/countly_flutter.dart';
24
import 'package:flutter_test/flutter_test.dart';
35
import 'package:integration_test/integration_test.dart';
@@ -22,7 +24,7 @@ void main() {
2224

2325
List<String> requestList = await getRequestQueue(); // List of strings
2426
List<String> eventList = await getEventQueue(); // List of json objects
25-
expect(requestList.length, 7);
27+
expect(requestList.length, Platform.isAndroid ? 6 : 7);
2628
expect(eventList.length, 0);
2729

2830
createServer(requestArray, delay: 1);

example/integration_test/session_tests/automatic_sessions/204_CNR_A_id_change_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ void main() {
6060

6161
var i = 0;
6262
var androidBeginSession = [0, 4, 7];
63-
var iosBeginSession = [0, 3, 6];
63+
var iosBeginSession = [0, 3, 7];
6464
var androidMerge = [1, 8];
65-
var iosMerge = [1, 7];
65+
var iosMerge = [1, 6];
6666
var androidOrientation = [2, 5];
6767
var iosOrientation = [4];
6868
var androidEndSession = [3, 6];

example/integration_test/session_tests/automatic_sessions/205_CR_CG_A_id_change_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ void main() {
6666
// example:
6767
// consent: [{"sessions":true,"crashes":true,"users":true,"push":true,"feedback":true,"scrolls":true,"remote-config":true,"attribution":true,"clicks":true,"location":true,"star-rating":true,"events":true,"views":true,"apm":true}]
6868
Map<String, dynamic> consentInRequest = jsonDecode(queryParams['consent']![0]);
69-
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content']) {
69+
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content', 'metrics']) {
7070
expect(consentInRequest[key], true);
7171
}
72-
expect(consentInRequest.length, Platform.isAndroid ? 15 : 12);
72+
expect(consentInRequest.length, Platform.isAndroid ? 16 : 13);
7373
} else if ((Platform.isAndroid && (i == 1 || i == 5)) || (Platform.isIOS && (i == 0 || i == 5))) {
7474
expect(queryParams['begin_session']?[0], '1');
7575
} else if (i == 2 || (Platform.isAndroid && (i == 10 || i == 9)) || (Platform.isIOS && (i == 8 || i == 9))) {

example/integration_test/session_tests/automatic_sessions/206_CR_CNG_A_id_change_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ void main() {
6060
// example:
6161
// consent: [{"sessions":true,"crashes":true,"users":true,"push":true,"feedback":true,"scrolls":true,"remote-config":true,"attribution":true,"clicks":true,"location":true,"star-rating":true,"events":true,"views":true,"apm":true}]
6262
Map<String, dynamic> consentInRequest = jsonDecode(queryParams['consent']![0]);
63-
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content']) {
63+
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content', 'metrics']) {
6464
expect(consentInRequest[key], false);
6565
}
66-
expect(consentInRequest.length, Platform.isAndroid ? 15 : 12);
66+
expect(consentInRequest.length, Platform.isAndroid ? 16 : 13);
6767
} else if (i == 2 || i == 3 || i == 4) {
6868
expect(queryParams['old_device_id']?[0].isNotEmpty, true);
6969
expect(queryParams['device_id']?[0], 'newID');

example/integration_test/session_tests/background_tests/212_CR_CG_AS_init_in_background_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ void main() {
4545

4646
Map<String, List<String>> queryParamsConsent = Uri.parse("?" + requestList[0]).queryParametersAll;
4747
Map<String, dynamic> consentInRequest = jsonDecode(queryParamsConsent['consent']![0]);
48-
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content']) {
48+
for (var key in ['push', 'feedback', 'crashes', 'attribution', 'users', 'events', 'remote-config', 'sessions', 'location', 'views', 'apm', 'content', 'metrics']) {
4949
expect(consentInRequest[key], true);
5050
}
51-
expect(consentInRequest.length, Platform.isAndroid ? 15 : 12);
51+
expect(consentInRequest.length, Platform.isAndroid ? 16 : 13);
5252

5353
expect(eventList.length, 1); // orientation
5454

0 commit comments

Comments
 (0)