Skip to content

Commit 8abdc23

Browse files
fix: dart format
1 parent 98d2659 commit 8abdc23

File tree

14 files changed

+353
-137
lines changed

14 files changed

+353
-137
lines changed

.circleci/config.yml

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -28,54 +28,11 @@ commands:
2828
name: Install Pods
2929
working_directory: example/ios
3030
command: pod install --repo-update
31-
setup_captain:
32-
parameters:
33-
platform:
34-
type: enum
35-
enum:
36-
- ios
37-
- android
31+
setup_patrol:
3832
steps:
3933
- run:
40-
name: Install Appium
41-
command: npm install -g appium
42-
- when:
43-
condition:
44-
equal:
45-
- <<parameters.platform>>
46-
- ios
47-
steps:
48-
- run:
49-
name: Install XCUITest Driver
50-
command: appium driver install [email protected]
51-
- when:
52-
condition:
53-
equal:
54-
- <<parameters.platform>>
55-
- android
56-
steps:
57-
- run:
58-
name: Install UIAutomator2 Driver
59-
command: appium driver install [email protected]
60-
- run:
61-
name: Launch Appium
62-
# Enable --relaxed-security for `mobile: shell` command that Captain uses internally.
63-
command: appium --relaxed-security
64-
background: true
65-
- run:
66-
name: Install .NET 6
67-
command: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 6.0.1xx
68-
- run:
69-
name: Add .NET to PATH
70-
command: |
71-
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> $BASH_ENV
72-
echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> $BASH_ENV
73-
- run:
74-
name: Clone Captain
75-
command: git clone [email protected]:Instabug/Captain.git ../Instabug.Captain
76-
- run:
77-
name: Configure Captain Platform
78-
command: echo 'export CAPTAIN_PLATFORM=<<parameters.platform>>' >> $BASH_ENV
34+
name: Install patrol
35+
command: dart pub global activate patrol_cli 3.5.0
7936
# This runs `flutter pub get` and `dart pub get` if we pass parameter `generate_pigeons` to the job it also runs the following:
8037
# - `sh ./scripts/pigeon.sh`
8138
# - `dart run build_runner build --delete-conflicting-outputs`
@@ -150,22 +107,20 @@ jobs:
150107
working-directory: example/android
151108
test-command: ./gradlew test
152109

153-
e2e_android_captain:
110+
e2e_android_patrol:
154111
executor:
155112
name: android/android-machine
156113
resource-class: xlarge
157114
tag: 2024.01.1
158115
steps:
159116
- advanced-checkout/shallow-checkout
160-
- setup_captain:
161-
platform: android
162117
- setup_flutter
118+
- setup_patrol
163119
- android/start-emulator-and-run-tests:
164-
run-tests-working-directory: e2e
165120
additional-avd-args: --device 3
166121
system-image: system-images;android-33;default;x86_64
167-
post-emulator-launch-assemble-command: cd example && flutter build apk --debug
168-
test-command: dotnet test
122+
post-emulator-launch-assemble-command: cd example
123+
test-command: patrol test -t integration_test/ --verbose
169124

170125
test_ios:
171126
macos:
@@ -188,25 +143,19 @@ jobs:
188143
-destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.2' \
189144
test | xcpretty
190145
191-
e2e_ios_captain:
146+
e2e_ios_patrol:
192147
macos:
193148
xcode: 15.2.0
194149
resource_class: macos.m1.medium.gen1
195150
steps:
196151
- advanced-checkout/shallow-checkout
197-
- setup_captain:
198-
platform: ios
199152
- setup_ios
200-
- run:
201-
name: Build Example App
202-
working_directory: example
203-
command: flutter build ios --simulator
153+
- setup_patrol
204154
- run:
205155
name: Run E2E Tests
206156
no_output_timeout: 30m
207-
working_directory: e2e
208-
command: dotnet test
209-
157+
working_directory: example
158+
command: patrol test -t integration_test/ --verbose
210159
format_flutter:
211160
docker:
212161
- image: cirrusci/flutter
@@ -292,9 +241,9 @@ workflows:
292241
- test_flutter:
293242
name: test_flutter-2.10.5
294243
version: 2.10.5
295-
- e2e_android_captain
244+
- e2e_android_patrol
296245
- test_ios
297-
- e2e_ios_captain
246+
- e2e_ios_patrol
298247
- format_flutter
299248
- lint_flutter:
300249
requires:
@@ -312,9 +261,9 @@ workflows:
312261
# TODO: Fix the flaky tests and add the following jobs to the dependencies for the release
313262
# The following jobs have been removed while releasing v13.2.0 to avoid delaying the release
314263
# as they were just flaky and the tests pass locally without issues.
315-
# - e2e_android_captain
264+
# - e2e_android_patrol
316265
# - test_ios
317-
- e2e_ios_captain
266+
- e2e_ios_patrol
318267
- verify_pub
319268
filters:
320269
branches:

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include: package:lint/analysis_options_package.yaml
22

33
analyzer:
44
exclude:
5-
# - "example/**"
5+
- "example/**"
66
- "**/*.g.dart"
77

88
linter:

example/integration_test/bug_reporting_test.dart

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Future<void> assertOptionsPromptIsDisplayed(PatrolIntegrationTester $) async {
1010
identifier: 'IBGReportBugPromptOptionAccessibilityIdentifier'),
1111
android: AndroidSelector(
1212
resourceName:
13-
'com.instabug.flutter.example:id/instabug_main_prompt_container')));
13+
'com.instabug.flutter.example:id/instabug_main_prompt_container')));
1414

1515
expect(
1616
isAndroid
@@ -91,18 +91,20 @@ void main() {
9191

9292
await $("Two Fingers Swipe Left").scrollTo().tap();
9393
await wait(second: 1);
94-
final gesture1 = await $.tester.startGesture(const Offset(300, 400)); // finger 1
95-
final gesture2 = await $.tester.startGesture(const Offset(300, 600)); // finger 2
94+
final gesture1 =
95+
await $.tester.startGesture(const Offset(300, 400)); // finger 1
96+
final gesture2 =
97+
await $.tester.startGesture(const Offset(300, 600)); // finger 2
9698

9799
// Swipe both fingers to the left (same direction)
98-
await gesture1.moveBy(const Offset(-150, 0));
99-
await gesture2.moveBy(const Offset(-150, 0));
100+
await gesture1.moveBy(const Offset(-150, 0));
101+
await gesture2.moveBy(const Offset(-150, 0));
100102

101103
// End gestures
102104
await gesture1.up();
103105
await gesture2.up();
104106

105-
await wait(second: 1);
107+
await wait(second: 1);
106108
assertOptionsPromptIsDisplayed($);
107109
},
108110
framePolicy: LiveTestWidgetsFlutterBindingFramePolicy.fullyLive,
@@ -114,10 +116,11 @@ void main() {
114116

115117
await wait(second: 1);
116118
final floatingButton = await $.native2.getNativeViews(NativeSelector(
117-
ios: IOSSelector(identifier: 'IBGFloatingButtonAccessibilityIdentifier'),
119+
ios:
120+
IOSSelector(identifier: 'IBGFloatingButtonAccessibilityIdentifier'),
118121
android: AndroidSelector(
119122
resourceName:
120-
'com.instabug.flutter.example:id/instabug_floating_button'),
123+
'com.instabug.flutter.example:id/instabug_floating_button'),
121124
));
122125

123126
expect(
@@ -151,7 +154,7 @@ void main() {
151154
identifier: 'IBGBugVCReproStepsDisclaimerAccessibilityIdentifier'),
152155
android: AndroidSelector(
153156
resourceName:
154-
'com.instabug.flutter.example:id/instabug_text_view_repro_steps_disclaimer'),
157+
'com.instabug.flutter.example:id/instabug_text_view_repro_steps_disclaimer'),
155158
));
156159

157160
await wait(miliSeconds: 1000);
@@ -161,10 +164,10 @@ void main() {
161164
identifier: 'IBGReproStepsTableCellViewAccessibilityIdentifier'),
162165
android: AndroidSelector(
163166
resourceName:
164-
'com.instabug.flutter.example:id/ib_bug_repro_step_screenshot'),
167+
'com.instabug.flutter.example:id/ib_bug_repro_step_screenshot'),
165168
));
166169

167-
final count =isAndroid
170+
final count = isAndroid
168171
? screenshots.androidViews.length
169172
: screenshots.iosViews.length;
170173

@@ -176,51 +179,39 @@ void main() {
176179

177180
await $('Move Floating Button to Left').scrollTo().tap();
178181

179-
180182
await wait(second: 5);
181183

182184
final floatingButton = await $.native2.getNativeViews(NativeSelector(
183-
ios: IOSSelector(
184-
identifier: 'IBGFloatingButtonAccessibilityIdentifier'),
185+
ios:
186+
IOSSelector(identifier: 'IBGFloatingButtonAccessibilityIdentifier'),
185187
android: AndroidSelector(
186188
resourceName:
187-
'com.instabug.flutter.example:id/instabug_floating_button'),
189+
'com.instabug.flutter.example:id/instabug_floating_button'),
188190
));
189191

190-
191192
await wait(second: 2);
192193

193194
final size = $.tester.view.physicalSize / $.tester.view.devicePixelRatio;
194195
final width = size.width;
195196
$.log(floatingButton.androidViews.length.toString());
196197

197-
$.log(floatingButton.androidViews.first.visibleBounds.minX.toString());
198-
$.log(floatingButton.androidViews.first.visibleBounds.maxX.toString());
199-
$.log((width / 2).toString());
200-
201-
202198
bool isLeft = false;
203-
if (isAndroid &&
204-
floatingButton.androidViews.isNotEmpty) {
205-
206-
199+
if (isAndroid && floatingButton.androidViews.isNotEmpty) {
207200
$.log(floatingButton.androidViews.first.visibleBounds.minX.toString());
208201
$.log(floatingButton.androidViews.first.visibleBounds.maxX.toString());
209202
$.log((width / 2).toString());
210203

211-
isLeft = floatingButton.androidViews.first.visibleBounds.minX <
212-
(width / 2);
213-
} else if ((!isAndroid) &&
214-
floatingButton.iosViews.isNotEmpty) {
215-
isLeft = floatingButton.iosViews.first.frame.minX <
216-
(width / 2);
204+
isLeft =
205+
floatingButton.androidViews.first.visibleBounds.minX < (width / 2);
206+
} else if ((!isAndroid) && floatingButton.iosViews.isNotEmpty) {
207+
isLeft = floatingButton.iosViews.first.frame.minX < (width / 2);
217208
}
218209

219210
expect(isLeft, true);
220211
});
221212

222-
patrolTest(
223-
'onDismiss callback triggers when prompt is cancelled', ($) async {
213+
patrolTest('onDismiss callback triggers when prompt is cancelled',
214+
($) async {
224215
await init($);
225216

226217
await $('Set On Dismiss Callback').scrollTo().tap();
@@ -236,10 +227,9 @@ void main() {
236227

237228
await wait(second: 4);
238229

239-
final callbackWidget = $('onDismiss callback called with DismissType.cancel and ReportType.other');
230+
final callbackWidget = $(
231+
'onDismiss callback called with DismissType.cancel and ReportType.other');
240232
expect(callbackWidget, findsOneWidget);
241233
});
242-
243234
});
244-
245-
}
235+
}

example/integration_test/example_test.dart

Whitespace-only changes.

example/integration_test/feature_requests_test.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@ void main() {
88
patrolTest(
99
'Show Feature Requests Screen',
1010
($) async {
11-
await init($);
11+
await init($);
1212

13-
await $('Show Feature Requests').scrollTo().tap();
13+
await $('Show Feature Requests').scrollTo().tap();
1414

15-
final title = await $.native2.getNativeViews(NativeSelector(
16-
ios: IOSSelector(
17-
identifier: 'IBGFeatureListTableView'),
15+
final title = await $.native2.getNativeViews(NativeSelector(
16+
ios: IOSSelector(identifier: 'IBGFeatureListTableView'),
1817
android: AndroidSelector(
1918
resourceName:
2019
'com.instabug.flutter.example:id/ib_fr_toolbar_main')));
2120

22-
23-
expect(isAndroid?title.androidViews.length:title.iosViews.length, equals(1));
24-
21+
expect(isAndroid ? title.androidViews.length : title.iosViews.length,
22+
equals(1));
2523
},
2624
framePolicy: LiveTestWidgetsFlutterBindingFramePolicy.fullyLive,
2725
);

example/integration_test/instabug_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ void main() {
99
patrolTest(
1010
'ChangePrimaryColor',
1111
($) async {
12-
await init($);
12+
await init($);
1313

1414
var color = "#FF0000";
15-
await $(#enter_primary_color_input).scrollTo().enterText(color);
16-
await $('Change Primary Color').scrollTo().tap();
15+
await $(#enter_primary_color_input).scrollTo().enterText(color);
16+
await $('Change Primary Color').scrollTo().tap();
1717

1818
await wait(second: 5);
1919
final floatingButton = await $.native2.getNativeViews(NativeSelector(

example/integration_test/surveys_test.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@ void main() {
88
patrolTest(
99
'Show Surveys Screen',
1010
($) async {
11-
await init($);
11+
await init($);
1212

13-
await $('Show Manual Survey').scrollTo().tap();
13+
await $('Show Manual Survey').scrollTo().tap();
1414

15-
final title = await $.native2.getNativeViews(NativeSelector(
16-
ios: IOSSelector(
17-
identifier: 'SurveyNavigationVC'),
15+
final title = await $.native2.getNativeViews(NativeSelector(
16+
ios: IOSSelector(identifier: 'SurveyNavigationVC'),
1817
android: AndroidSelector(
1918
resourceName:
2019
'com.instabug.flutter.example:id/instabug_survey_dialog_container')));
2120

22-
23-
expect(isAndroid?title.androidViews.length:title.iosViews.length, equals(1));
24-
21+
expect(isAndroid ? title.androidViews.length : title.iosViews.length,
22+
equals(1));
2523
},
2624
framePolicy: LiveTestWidgetsFlutterBindingFramePolicy.fullyLive,
2725
);

example/integration_test/utils/utils.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ Future<void> init(PatrolIntegrationTester $) async {
1414

1515
await $.pumpWidgetAndSettle(const MyApp());
1616
await $.native2.initialize();
17-
1817
}
1918

20-
Future<void> wait({int? second,int? miliSeconds}){
21-
return Future.delayed(Duration(seconds: second??0,milliseconds: miliSeconds??0));
19+
Future<void> wait({int? second, int? miliSeconds}) {
20+
return Future.delayed(
21+
Duration(seconds: second ?? 0, milliseconds: miliSeconds ?? 0));
2222
}
2323

24-
bool get isAndroid { return defaultTargetPlatform == TargetPlatform.android;}
24+
bool get isAndroid {
25+
return defaultTargetPlatform == TargetPlatform.android;
26+
}

example/ios/Podfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ target 'Runner' do
3030

3131
use_frameworks!
3232
use_modular_headers!
33-
33+
target 'RunnerUITests' do
34+
inherit! :complete
35+
end
3436
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3537
end
3638

0 commit comments

Comments
 (0)