-
-
Notifications
You must be signed in to change notification settings - Fork 257
enha: Flutter min version test #1061
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
Merged
Merged
Changes from 44 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
b40d314
add dvice test running sentry setup and checking wether ui has loaded
denrase fcc40f7
add github action for integration tests
denrase 078c83c
build debug apk
denrase c7db8b6
build debug apk and run integratin test on enumlator
denrase afaf307
don’t build apk before
denrase 8df868c
fix name
denrase 6414522
run parent dir test
denrase f385cf9
build apk through flutter and only run flutter test in emulator step
denrase c835a9c
verify directory content
denrase d3789e3
fix typo
denrase 9812c18
provide working dir to android emulator step
denrase f00bb4d
no need to build apk beforehand
denrase 74d74f7
no need toshow dir content
denrase 9862ee6
run on ios simulator
denrase cbbc477
run on smallest supported ios version for action
denrase 9e971fb
enable android test
denrase 6c95df8
run ios 14 simulator, run on flutter beta
denrase 11a1490
bump sim version to lowest supported by action
denrase 14171b1
run on version that works
denrase 97046d6
specify device
denrase 8d3ca56
revert versions again
denrase 23b6675
fix input
denrase 1b225d9
bump vesion
denrase 43b27cd
fix order
denrase 73e2483
pin action steps
denrase e258802
Merge branch 'main' into enha/flutter-min-version-test
denrase e4da556
run format
denrase 44ebf16
pin third party actions and add version comments
denrase 8656247
Merge branch 'main' into enha/flutter-min-version-test
denrase 844f08b
run android on ubuntu, split workflow in 2 jobs
denrase 37f7bf2
rename test and run all native bridge commands
denrase 399b8a9
Merge branch 'main' into enha/flutter-min-version-test
denrase 3e4f9b7
remove not needed async
denrase 3aaa295
Merge branch 'main' into enha/flutter-min-version-test
denrase c028b3e
test sentry public api
denrase 893961e
Merge branch 'main' into enha/flutter-min-version-test
denrase 9efd563
Merge branch 'main' into enha/flutter-min-version-test
denrase 33af637
fix test expectation
denrase efb44c3
Merge branch 'main' into enha/flutter-min-version-test
denrase bdf60af
Merge branch 'main' into enha/flutter-min-version-test
denrase d7d9aa9
update where tests are run
denrase 2a0f5d4
run format
denrase 5158fc5
remove unused imports
denrase c49118c
also pass stacktrace
denrase 398258a
reset user
denrase 5f4fa4d
add screenshot widget
denrase cac4064
start/finish transactions
denrase d81fddf
run format
denrase ebadd79
cancel previous workflow
denrase 180ec29
Merge branch 'main' into enha/flutter-min-version-test
marandaneto 0177b6b
Merge branch 'main' into enha/flutter-min-version-test
marandaneto 7456af5
Merge branch 'main' into enha/flutter-min-version-test
marandaneto 893b3bb
Merge branch 'main' into enha/flutter-min-version-test
marandaneto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: flutter integration tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test-android: | ||
runs-on: macos-latest | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defaults: | ||
run: | ||
working-directory: ./flutter/example | ||
strategy: | ||
matrix: | ||
sdk: ['stable', 'beta'] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '8' | ||
|
||
- uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2 | ||
with: | ||
channel: ${{ matrix.sdk }} | ||
|
||
- name: flutter upgrade | ||
run: flutter upgrade | ||
|
||
- name: flutter pub get | ||
run: flutter pub get | ||
|
||
- name: launch android emulator & run android integration test | ||
uses: reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66 #[email protected] | ||
with: | ||
working-directory: ./flutter/example | ||
api-level: 21 | ||
arch: x86_64 | ||
profile: Nexus 6 | ||
script: flutter test integration_test/integration_test.dart | ||
test-ios: | ||
runs-on: macos-11 | ||
defaults: | ||
run: | ||
working-directory: ./flutter/example | ||
strategy: | ||
matrix: | ||
sdk: ['stable', 'beta'] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2 | ||
with: | ||
channel: ${{ matrix.sdk }} | ||
|
||
- name: flutter upgrade | ||
run: flutter upgrade | ||
|
||
- name: flutter pub get | ||
run: flutter pub get | ||
|
||
- name: launch ios emulator | ||
uses: futureware-tech/simulator-action@ee05c113b79f056b47f354d7b313555f5491e158 #pin@v2 | ||
with: | ||
model: 'iPhone 8' | ||
os_version: '15.2' | ||
|
||
- name: run ios integration test | ||
run: flutter test integration_test/integration_test.dart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
import 'package:sentry_flutter/sentry_flutter.dart'; | ||
import 'package:sentry_flutter_example/main.dart'; | ||
|
||
void main() { | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; | ||
|
||
Future<void> setupSentryAndApp(WidgetTester tester) async { | ||
await setupSentry(() async { | ||
await tester.pumpWidget(DefaultAssetBundle( | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bundle: SentryAssetBundle(enableStructuredDataTracing: true), | ||
child: MyApp(), | ||
)); | ||
await tester.pumpAndSettle(); | ||
}); | ||
} | ||
|
||
// Tests | ||
|
||
testWidgets('setup sentry and render app', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
// Find any UI element and verify it is present. | ||
expect(find.text('Open another Scaffold'), findsOneWidget); | ||
}); | ||
|
||
testWidgets('setup sentry and capture event', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
final event = SentryEvent(); | ||
final sentryId = await Sentry.captureEvent(event); | ||
|
||
expect(sentryId != SentryId.empty(), true); | ||
}); | ||
|
||
testWidgets('setup sentry and capture exception', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
try { | ||
throw SentryException( | ||
type: 'StarError', value: 'I have a bad feeling about this...'); | ||
} catch (exception, stacktrace) { | ||
final sentryId = | ||
await Sentry.captureException(exception, stackTrace: stacktrace); | ||
|
||
expect(sentryId != SentryId.empty(), true); | ||
} | ||
}); | ||
|
||
testWidgets('setup sentry and capture message', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
final sentryId = await Sentry.captureMessage('hello world!'); | ||
|
||
expect(sentryId != SentryId.empty(), true); | ||
}); | ||
|
||
testWidgets('setup sentry and capture user feedback', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
final feedback = SentryUserFeedback( | ||
eventId: SentryId.newId(), | ||
name: 'fixture-name', | ||
email: '[email protected]', | ||
comments: 'fixture-comments'); | ||
await Sentry.captureUserFeedback(feedback); | ||
}); | ||
|
||
testWidgets('setup sentry and close', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
await Sentry.close(); | ||
}); | ||
|
||
testWidgets('setup sentry and add breadcrumb', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
final breadcrumb = Breadcrumb(message: 'fixture-message'); | ||
await Sentry.addBreadcrumb(breadcrumb); | ||
}); | ||
|
||
testWidgets('setup sentry and configure scope', (tester) async { | ||
await setupSentryAndApp(tester); | ||
|
||
await Sentry.configureScope((scope) async { | ||
await scope.setContexts('contexts-key', 'contexts-value'); | ||
await scope.removeContexts('contexts-key'); | ||
|
||
final user = SentryUser(id: 'fixture-id'); | ||
await scope.setUser(user); | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
final breadcrumb = Breadcrumb(message: 'fixture-message'); | ||
await scope.addBreadcrumb(breadcrumb); | ||
await scope.clearBreadcrumbs(); | ||
|
||
await scope.setExtra('extra-key', 'extra-value'); | ||
await scope.removeExtra('extra-key'); | ||
|
||
await scope.setTag('tag-key', 'tag-value'); | ||
await scope.removeTag('tag-key'); | ||
}); | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.