Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 12 additions & 2 deletions .github/workflows/very_good_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ jobs:

- uses: subosito/flutter-action@v2.8.0

- name: Install Dependencies
- name: Install Dependencies (root)
run: flutter pub get

- name: Install Dependencies (test/fixtures/async_main)
working-directory: test/fixtures/async_main
run: dart pub get

- name: Install Dependencies (test/fixtures/spaced_golden_file_name)
working-directory: test/fixtures/spaced_golden_file_name
run: flutter pub get

- name: Format
Expand Down Expand Up @@ -56,7 +64,9 @@ jobs:
- "3.3.0"
test:
# E2E tests for the test command
- test/src/commands/test/e2e/
- test/src/commands/test/e2e/async_main_test.dart
- test/src/commands/test/e2e/no_project_test.dart
- test/src/commands/test/e2e/spaced_golden_file_name_test.dart

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

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

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

3 changes: 3 additions & 0 deletions test/fixtures/async_main/test/async_main_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@Tags(['e2e'])
library async_main_test;

// ignore_for_file: prefer_const_constructors
import 'package:test/test.dart';

Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/spaced_golden_file_name/pubspec.yaml
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,17 @@
@Tags(['e2e'])
library spaced_golden_file_name_test;

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'),
);
});
}
42 changes: 42 additions & 0 deletions test/src/commands/test/e2e/spaced_golden_file_name_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@Tags(['e2e'])
library spaced_golden_file_name_test;

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/fixtures/spaced_golden_file_name'),
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));
}),
);
}