Skip to content

Commit 4c43e91

Browse files
committed
extra test
1 parent b635ff0 commit 4c43e91

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import 'dart:convert';
2+
import 'dart:io';
3+
4+
import 'package:countly_flutter/countly_flutter.dart';
5+
import 'package:flutter_test/flutter_test.dart';
6+
import 'package:integration_test/integration_test.dart';
7+
import '../utils.dart';
8+
9+
/// Check if setting:
10+
/// .setMaxBreadcrumbCount()
11+
/// .setMaxStackTraceLineLength()
12+
/// .setMaxStackTraceLinesPerThread()
13+
/// creates a crash or error
14+
/// TODO: Replace this tests with individual tests for each method
15+
16+
const int MAX_RANDOM = 1;
17+
void main() {
18+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
19+
testWidgets('Init SDK with some limits', (WidgetTester tester) async {
20+
// Initialize the SDK
21+
CountlyConfig config = CountlyConfig(SERVER_URL, APP_KEY).setLoggingEnabled(true);
22+
config.sdkInternalLimits.setMaxBreadcrumbCount(MAX_RANDOM).setMaxStackTraceLineLength(MAX_RANDOM).setMaxStackTraceLinesPerThread(MAX_RANDOM);
23+
await Countly.initWithConfig(config);
24+
25+
// Create truncable events
26+
await createTruncableEvents();
27+
28+
// Get request and event queues from native side
29+
List<String> requestList = await getRequestQueue();
30+
List<String> eventList = await getEventQueue();
31+
32+
// Some logs for debugging
33+
print('RQ: $requestList');
34+
print('EQ: $eventList');
35+
print('RQ length: ${requestList.length}');
36+
print('EQ length: ${eventList.length}');
37+
38+
expect(requestList.length, Platform.isIOS ? 8 : 7); // user properties and custom user properties are separately sent in iOS
39+
expect(eventList.length, 0);
40+
41+
// TODO: refactor this part (move to utils and make it more generic)
42+
// 0: begin session
43+
// 1: custom APM with segmentation
44+
// 2: network Trace
45+
// 3: custom fatality crash with segmentation
46+
// 4: custom mortal crash with segmentation
47+
// 5: custom view and events with segmentation
48+
// 6: custom user properties
49+
var a = 0;
50+
for (var element in requestList) {
51+
Map<String, List<String>> queryParams = Uri.parse('?' + element).queryParametersAll;
52+
testCommonRequestParams(queryParams); // checks general params
53+
// some logs for debugging
54+
print('RQ.$a: $queryParams');
55+
print('========================');
56+
a++;
57+
}
58+
});
59+
}

0 commit comments

Comments
 (0)