Skip to content
Merged
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
6 changes: 5 additions & 1 deletion script/tool/lib/src/drive_examples_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ class DriveExamplesCommand extends PackageLoopingCommand {
'web-server',
'--web-port=7357',
'--browser-name=chrome',
'--web-renderer=canvaskit',
// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
if (platform.environment['CHANNEL']?.toLowerCase() == 'master')
'--web-renderer=canvaskit',
if (platform.environment['CHANNEL']?.toLowerCase() != 'master')
'--web-renderer=html',
if (platform.environment.containsKey('CHROME_EXECUTABLE'))
'--chrome-binary=${platform.environment['CHROME_EXECUTABLE']}',
],
Expand Down
57 changes: 57 additions & 0 deletions script/tool/test/drive_examples_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ void main() {
runner = CommandRunner<void>(
'drive_examples_command', 'Test for drive_example_command');
runner.addCommand(command);

// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
mockPlatform.environment['CHANNEL'] = 'master';
});

void setMockFlutterDevicesOutput({
Expand Down Expand Up @@ -688,6 +691,60 @@ void main() {
]));
});

// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
test('drives a web plugin (html renderer in stable)', () async {
// Override the platform to simulate CHANNEL: stable
mockPlatform.environment['CHANNEL'] = 'stable';

final RepositoryPackage plugin = createFakePlugin(
'plugin',
packagesDir,
extraFiles: <String>[
'example/integration_test/plugin_test.dart',
'example/test_driver/integration_test.dart',
'example/web/index.html',
],
platformSupport: <String, PlatformDetails>{
platformWeb: const PlatformDetails(PlatformSupport.inline),
},
);

final Directory pluginExampleDirectory = getExampleDir(plugin);

final List<String> output = await runCapturingPrint(runner, <String>[
'drive-examples',
'--web',
]);

expect(
output,
containsAllInOrder(<Matcher>[
contains('Running for plugin'),
contains('No issues found!'),
]),
);

expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall(
getFlutterCommand(mockPlatform),
const <String>[
'drive',
'-d',
'web-server',
'--web-port=7357',
'--browser-name=chrome',
'--web-renderer=html',
'--driver',
'test_driver/integration_test.dart',
'--target',
'integration_test/plugin_test.dart',
],
pluginExampleDirectory.path),
]));
});

test('runs chromedriver when requested', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin',
Expand Down