mirror of
https://github.com/flutter/packages.git
synced 2025-06-19 13:38:53 +08:00
[tool] Extend flutter test
workaround to other desktops (#6024)
Expand the multiple-test-files workaround in `drive-examples` from macOS to all of the desktop platforms, now that we know it's not macOS-specific. See https://github.com/flutter/flutter/issues/135673
This commit is contained in:
@ -404,8 +404,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
|||||||
// Workaround for https://github.com/flutter/flutter/issues/135673
|
// Workaround for https://github.com/flutter/flutter/issues/135673
|
||||||
// Once that is fixed on stable, this logic can be removed and the command
|
// Once that is fixed on stable, this logic can be removed and the command
|
||||||
// can always just be run with "integration_test".
|
// can always just be run with "integration_test".
|
||||||
final bool needsMultipleInvocations =
|
final bool needsMultipleInvocations = testFiles.length > 1 &&
|
||||||
testFiles.length > 1 && getBoolArg(platformMacOS);
|
(getBoolArg(platformLinux) ||
|
||||||
|
getBoolArg(platformMacOS) ||
|
||||||
|
getBoolArg(platformWindows));
|
||||||
final Iterable<String> individualRunTargets = needsMultipleInvocations
|
final Iterable<String> individualRunTargets = needsMultipleInvocations
|
||||||
? testFiles
|
? testFiles
|
||||||
.map((File f) => getRelativePosixPath(f, from: example.directory))
|
.map((File f) => getRelativePosixPath(f, from: example.directory))
|
||||||
|
@ -450,7 +450,8 @@ void main() {
|
|||||||
|
|
||||||
// This tests the workaround for https://github.com/flutter/flutter/issues/135673
|
// This tests the workaround for https://github.com/flutter/flutter/issues/135673
|
||||||
// and the behavior it tests should be removed once that is fixed.
|
// and the behavior it tests should be removed once that is fixed.
|
||||||
test('runs tests separately on macOS', () async {
|
group('runs tests separately on desktop', () {
|
||||||
|
test('macOS', () async {
|
||||||
final RepositoryPackage plugin = createFakePlugin(
|
final RepositoryPackage plugin = createFakePlugin(
|
||||||
'plugin',
|
'plugin',
|
||||||
packagesDir,
|
packagesDir,
|
||||||
@ -503,6 +504,117 @@ void main() {
|
|||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This tests the workaround for https://github.com/flutter/flutter/issues/135673
|
||||||
|
// and the behavior it tests should be removed once that is fixed.
|
||||||
|
test('Linux', () async {
|
||||||
|
final RepositoryPackage plugin = createFakePlugin(
|
||||||
|
'plugin',
|
||||||
|
packagesDir,
|
||||||
|
extraFiles: <String>[
|
||||||
|
'example/integration_test/first_test.dart',
|
||||||
|
'example/integration_test/second_test.dart',
|
||||||
|
'example/linux/foo.cc',
|
||||||
|
],
|
||||||
|
platformSupport: <String, PlatformDetails>{
|
||||||
|
platformLinux: const PlatformDetails(PlatformSupport.inline),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||||
|
|
||||||
|
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||||
|
'drive-examples',
|
||||||
|
'--linux',
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for plugin'),
|
||||||
|
contains('No issues found!'),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
processRunner.recordedCalls,
|
||||||
|
orderedEquals(<ProcessCall>[
|
||||||
|
ProcessCall(
|
||||||
|
getFlutterCommand(mockPlatform),
|
||||||
|
const <String>[
|
||||||
|
'test',
|
||||||
|
'-d',
|
||||||
|
'linux',
|
||||||
|
'integration_test/first_test.dart',
|
||||||
|
],
|
||||||
|
pluginExampleDirectory.path),
|
||||||
|
ProcessCall(
|
||||||
|
getFlutterCommand(mockPlatform),
|
||||||
|
const <String>[
|
||||||
|
'test',
|
||||||
|
'-d',
|
||||||
|
'linux',
|
||||||
|
'integration_test/second_test.dart',
|
||||||
|
],
|
||||||
|
pluginExampleDirectory.path),
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
// This tests the workaround for https://github.com/flutter/flutter/issues/135673
|
||||||
|
// and the behavior it tests should be removed once that is fixed.
|
||||||
|
test('Windows', () async {
|
||||||
|
final RepositoryPackage plugin = createFakePlugin(
|
||||||
|
'plugin',
|
||||||
|
packagesDir,
|
||||||
|
extraFiles: <String>[
|
||||||
|
'example/integration_test/first_test.dart',
|
||||||
|
'example/integration_test/second_test.dart',
|
||||||
|
'example/windows/foo.cpp',
|
||||||
|
],
|
||||||
|
platformSupport: <String, PlatformDetails>{
|
||||||
|
platformWindows: const PlatformDetails(PlatformSupport.inline),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||||
|
|
||||||
|
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||||
|
'drive-examples',
|
||||||
|
'--windows',
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for plugin'),
|
||||||
|
contains('No issues found!'),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
processRunner.recordedCalls,
|
||||||
|
orderedEquals(<ProcessCall>[
|
||||||
|
ProcessCall(
|
||||||
|
getFlutterCommand(mockPlatform),
|
||||||
|
const <String>[
|
||||||
|
'test',
|
||||||
|
'-d',
|
||||||
|
'windows',
|
||||||
|
'integration_test/first_test.dart',
|
||||||
|
],
|
||||||
|
pluginExampleDirectory.path),
|
||||||
|
ProcessCall(
|
||||||
|
getFlutterCommand(mockPlatform),
|
||||||
|
const <String>[
|
||||||
|
'test',
|
||||||
|
'-d',
|
||||||
|
'windows',
|
||||||
|
'integration_test/second_test.dart',
|
||||||
|
],
|
||||||
|
pluginExampleDirectory.path),
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('driving when plugin does not suppport web is a no-op', () async {
|
test('driving when plugin does not suppport web is a no-op', () async {
|
||||||
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
||||||
'example/integration_test/plugin_test.dart',
|
'example/integration_test/plugin_test.dart',
|
||||||
|
Reference in New Issue
Block a user