Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix more tests
  • Loading branch information
ueman committed Nov 13, 2023
commit 317ec74d7efe3e866af7beb042a717008f8506b7
3 changes: 1 addition & 2 deletions flutter/lib/src/sentry_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ mixin SentryFlutter {
integrations.add(LoadImageListIntegration(channel));
}
final renderer = options.rendererWrapper.getRenderer();
if (renderer == FlutterRenderer.skia ||
renderer == FlutterRenderer.canvasKit) {
if (!platformChecker.isWeb || renderer == FlutterRenderer.canvasKit) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTML renderer is the only renderer where screenshots do not work. Therefore, it should be enough to check for !web and the CanvasKit renderer

Copy link
Contributor

@buenaflor buenaflor Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if we have it documented somewhere that HTML renderer isn't supported for screenshot?

Might be good to improve the docs for that as well some time since the docs on sentry.io don't specify that, but well, docs in general are still rough on sentry 😓

Copy link
Collaborator Author

@ueman ueman Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denrase might know that, since he wrote it. Though, it's pretty well known that the backing API doesn't work on the HTML renderer

integrations.add(ScreenshotIntegration());
}

Expand Down
34 changes: 7 additions & 27 deletions flutter/test/sentry_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void main() {
await Sentry.close();
});

test('installed with skia renderer', () async {
test('installed on io platforms', () async {
List<Integration> integrations = [];

await SentryFlutter.init(
Expand All @@ -505,7 +505,8 @@ void main() {
integrations = options.integrations;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(platform: MockPlatform.iOs()),
platformChecker:
getPlatformChecker(platform: MockPlatform.iOs(), isWeb: false),
rendererWrapper: MockRendererWrapper(FlutterRenderer.skia),
);

Expand All @@ -528,7 +529,8 @@ void main() {
integrations = options.integrations;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(platform: MockPlatform.iOs()),
platformChecker:
getPlatformChecker(platform: MockPlatform.iOs(), isWeb: true),
rendererWrapper: MockRendererWrapper(FlutterRenderer.canvasKit),
);

Expand All @@ -551,7 +553,8 @@ void main() {
integrations = options.integrations;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(platform: MockPlatform.iOs()),
platformChecker:
getPlatformChecker(platform: MockPlatform.iOs(), isWeb: true),
rendererWrapper: MockRendererWrapper(FlutterRenderer.html),
);

Expand All @@ -563,29 +566,6 @@ void main() {

await Sentry.close();
}, testOn: 'vm');

test('not installed with unknown renderer', () async {
List<Integration> integrations = [];

await SentryFlutter.init(
(options) async {
options.dsn = fakeDsn;
options.automatedTestMode = true;
integrations = options.integrations;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(platform: MockPlatform.iOs()),
rendererWrapper: MockRendererWrapper(FlutterRenderer.unknown),
);

expect(
integrations
.map((e) => e.runtimeType)
.contains(ScreenshotIntegration),
false);

await Sentry.close();
}, testOn: 'vm');
});

group('initial values', () {
Expand Down