-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow spaced golden file names (#722)
* chore: very_good create * refactor: moved test e2e tests * refactor: moved e2e create commands * refactor: removed e2e tag * ci: configured e2e ci * chore: removed README.md * ci: removed tag * chore: removed --set-exit-if-changed * ci: ammends e2e workflow * test: tested spaced golden file name * fix: allow golden spaced test names
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
e2e/test/commands/test/spaced_golden_file_name/fixture/pubspec.yaml
This file contains 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,14 @@ | ||
name: spaced_golden_file_name | ||
description: Fixture for testing golden files with spaced file names. | ||
publish_to: none | ||
|
||
environment: | ||
sdk: ">=2.18.0 <3.0.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter |
Binary file added
BIN
+16.5 KB
e2e/test/commands/test/spaced_golden_file_name/fixture/test/sized box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
...test/commands/test/spaced_golden_file_name/fixture/test/spaced_golden_file_name_test.dart
This file contains 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,14 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
testWidgets('renders SizedBox', (tester) async { | ||
final widget = SizedBox.shrink(); | ||
await tester.pumpWidget(widget); | ||
|
||
await expectLater( | ||
find.byWidget(widget), | ||
matchesGoldenFile('sized box.png'), | ||
); | ||
}); | ||
} |
39 changes: 39 additions & 0 deletions
39
e2e/test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart
This file contains 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,39 @@ | ||
import 'package:mason/mason.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
import 'package:test/test.dart'; | ||
import 'package:universal_io/io.dart'; | ||
|
||
import '../../../../helpers/helpers.dart'; | ||
|
||
void main() { | ||
test( | ||
'allows golden files with spaces in the name', | ||
timeout: const Timeout(Duration(minutes: 2)), | ||
withRunner((commandRunner, logger, updater, logs) async { | ||
final tempDirectory = Directory.systemTemp.createTempSync('async_main'); | ||
addTearDown(() => tempDirectory.deleteSync(recursive: true)); | ||
|
||
await copyDirectory( | ||
Directory('test/commands/test/spaced_golden_file_name/fixture'), | ||
tempDirectory, | ||
); | ||
|
||
await expectSuccessfulProcessResult( | ||
'flutter', | ||
['pub', 'get'], | ||
workingDirectory: tempDirectory.path, | ||
); | ||
await expectSuccessfulProcessResult( | ||
'flutter', | ||
['test', '--update-goldens'], | ||
workingDirectory: tempDirectory.path, | ||
); | ||
|
||
Directory.current = tempDirectory; | ||
final result = await commandRunner.run(['test']); | ||
|
||
verifyNever(() => logger.err(any())); | ||
expect(result, equals(ExitCode.success.code)); | ||
}), | ||
); | ||
} |
This file contains 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