Skip to content
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
# E2E tests for the test command
- test/commands/test/async_main/async_main_test.dart
- test/commands/test/no_project/no_project_test.dart
- test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart

# E2E tests for the create command
- test/commands/create/flutter_app/core_test.dart
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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'),
);
});
}
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));
}),
);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.