Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 5e6f810

Browse files
committed
add screenshot attachment for debugging if the test fails in the future
1 parent 5bd7351 commit 5e6f810

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/VideoPlayerUITests.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ - (void)testEncryptedVideoStream {
8383
NSMutableSet *frames = [NSMutableSet set];
8484
int numberOfFrames = 60;
8585
for (int i = 0; i < numberOfFrames; i++) {
86-
UIImage *image = self.app.screenshot.image;
86+
XCUIScreenshot *screenshot = self.app.screenshot;
87+
88+
// Attach the screenshots for debugging if the test fails.
89+
XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
90+
attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
91+
[self addAttachment:attachment];
92+
93+
UIImage *image = screenshot.image;
8794
[frames addObject:UIImagePNGRepresentation(image)];
8895
// Take random interval between [1, 2) seconds, since the video length could be the same as a
8996
// fixed interval, which would always result in the same frame.

0 commit comments

Comments
 (0)