Skip to content

Commit

Permalink
Merge pull request #1084 from GetStream/fix/gallery_attachment_tests
Browse files Browse the repository at this point in the history
fix(ui): Fixed failing tests for attachment actions and gallery header
  • Loading branch information
imtoori authored Apr 14, 2022
2 parents affe37e + e75fce2 commit a2f1981
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,16 @@ void main() {

await tester.tap(find.text('Save Image'));

imageDownloader.progressCallback!(0, 100);
imageDownloader.progressCallback!(0, 100000);
await tester.pump();
expect(find.text('0%'), findsOneWidget);
expect(find.text('0.00 MB'), findsOneWidget);

imageDownloader.progressCallback!(50, 100);
imageDownloader.progressCallback!(50000, 100000);
await tester.pump();
expect(find.text('50%'), findsOneWidget);
expect(find.text('0.05 MB'), findsOneWidget);

imageDownloader.progressCallback!(100, 100);
imageDownloader.progressCallback!(100000, 100000);
imageDownloader.downloadedPathCallback!('path');
imageDownloader.completer.complete('path');
await tester.pump();
expect(find.byKey(const Key('completedIcon')), findsOneWidget);
Expand Down Expand Up @@ -510,15 +511,16 @@ void main() {

await tester.tap(find.text('Save Video'));

fileDownloader.progressCallback!(0, 100);
fileDownloader.progressCallback!(0, 100000);
await tester.pump();
expect(find.text('0%'), findsOneWidget);
expect(find.text('0.00 MB'), findsOneWidget);

fileDownloader.progressCallback!(50, 100);
fileDownloader.progressCallback!(50000, 100000);
await tester.pump();
expect(find.text('50%'), findsOneWidget);
expect(find.text('0.05 MB'), findsOneWidget);

fileDownloader.progressCallback!(100, 100);
fileDownloader.progressCallback!(100000, 100000);
fileDownloader.downloadedPathCallback!('path');
fileDownloader.completer.complete('path');
await tester.pump();
expect(find.byKey(const Key('completedIcon')), findsOneWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
final _message = Message();
final attachment = Attachment(
type: 'video',
title: 'video.mp4',
);
final _message = Message(
createdAt: DateTime.now(),
attachments: [
attachment,
],
);
return Scaffold(
appBar: StreamGalleryHeader(
message: _message,
Expand Down Expand Up @@ -107,7 +116,16 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
final _message = Message();
final attachment = Attachment(
type: 'video',
title: 'video.mp4',
);
final _message = Message(
createdAt: DateTime.now(),
attachments: [
attachment,
],
);
return Scaffold(
appBar: StreamGalleryHeader(
message: _message,
Expand Down

0 comments on commit a2f1981

Please sign in to comment.