Skip to content

Commit 8cf4d96

Browse files
authored
[ci] Drive tests with html renderer if CHANNEL is stable. (#7146)
Introduces a small fork in the `drive_examples_command` to run integration tests with `--web-renderer=html` in the `stable` channel (and `--web-renderer=canvaskit` in `master`). This is supposed to be removed, once the current `master` rolls into `stable` (see clean-up issue referenced below). ## Issues * Part of: flutter/flutter#143543 * Prevents flakes: #7115 (comment) * Clean-up issue: flutter/flutter#151869
1 parent 2aee0b9 commit 8cf4d96

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

script/tool/lib/src/drive_examples_command.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ class DriveExamplesCommand extends PackageLoopingCommand {
119119
'web-server',
120120
'--web-port=7357',
121121
'--browser-name=chrome',
122-
'--web-renderer=canvaskit',
122+
// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
123+
if (platform.environment['CHANNEL']?.toLowerCase() == 'master')
124+
'--web-renderer=canvaskit',
125+
if (platform.environment['CHANNEL']?.toLowerCase() != 'master')
126+
'--web-renderer=html',
123127
if (platform.environment.containsKey('CHROME_EXECUTABLE'))
124128
'--chrome-binary=${platform.environment['CHROME_EXECUTABLE']}',
125129
],

script/tool/test/drive_examples_command_test.dart

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ void main() {
3838
runner = CommandRunner<void>(
3939
'drive_examples_command', 'Test for drive_example_command');
4040
runner.addCommand(command);
41+
42+
// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
43+
mockPlatform.environment['CHANNEL'] = 'master';
4144
});
4245

4346
void setMockFlutterDevicesOutput({
@@ -688,6 +691,60 @@ void main() {
688691
]));
689692
});
690693

694+
// TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869
695+
test('drives a web plugin (html renderer in stable)', () async {
696+
// Override the platform to simulate CHANNEL: stable
697+
mockPlatform.environment['CHANNEL'] = 'stable';
698+
699+
final RepositoryPackage plugin = createFakePlugin(
700+
'plugin',
701+
packagesDir,
702+
extraFiles: <String>[
703+
'example/integration_test/plugin_test.dart',
704+
'example/test_driver/integration_test.dart',
705+
'example/web/index.html',
706+
],
707+
platformSupport: <String, PlatformDetails>{
708+
platformWeb: const PlatformDetails(PlatformSupport.inline),
709+
},
710+
);
711+
712+
final Directory pluginExampleDirectory = getExampleDir(plugin);
713+
714+
final List<String> output = await runCapturingPrint(runner, <String>[
715+
'drive-examples',
716+
'--web',
717+
]);
718+
719+
expect(
720+
output,
721+
containsAllInOrder(<Matcher>[
722+
contains('Running for plugin'),
723+
contains('No issues found!'),
724+
]),
725+
);
726+
727+
expect(
728+
processRunner.recordedCalls,
729+
orderedEquals(<ProcessCall>[
730+
ProcessCall(
731+
getFlutterCommand(mockPlatform),
732+
const <String>[
733+
'drive',
734+
'-d',
735+
'web-server',
736+
'--web-port=7357',
737+
'--browser-name=chrome',
738+
'--web-renderer=html',
739+
'--driver',
740+
'test_driver/integration_test.dart',
741+
'--target',
742+
'integration_test/plugin_test.dart',
743+
],
744+
pluginExampleDirectory.path),
745+
]));
746+
});
747+
691748
test('runs chromedriver when requested', () async {
692749
final RepositoryPackage plugin = createFakePlugin(
693750
'plugin',

0 commit comments

Comments
 (0)