[ci] Run web tests in wasm (unit + integration). (#8111)

Adds CI configuration to run web integration tests (in the master channel) compiled to Wasm.

It also removes the `build-examples` step from web integration tests, in some isolated testing:

| platform tests shard | With build-examples | Without build-examples |
|---|-----|-----|
| 1 | 30m | 21m |
| 2 | 13m | 11m |
| 3 | 17m | 10m |

## Issues

* Fixes https://github.com/flutter/flutter/issues/151664
This commit is contained in:
David Iglesias
2025-01-07 14:12:51 -08:00
committed by GitHub
parent 34d5039681
commit 11a9fa8bf6
26 changed files with 282 additions and 72 deletions

View File

@ -337,6 +337,33 @@ test_on: vm && browser
);
});
test('runs in Chrome (wasm) when requested for Flutter package', () async {
final RepositoryPackage package = createFakePackage(
'a_package',
packagesDir,
isFlutter: true,
extraFiles: <String>['test/empty_test.dart'],
);
await runCapturingPrint(
runner, <String>['dart-test', '--platform=chrome', '--wasm']);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall(
getFlutterCommand(mockPlatform),
const <String>[
'test',
'--color',
'--platform=chrome',
'--wasm',
],
package.path),
]),
);
});
test('runs in Chrome by default for Flutter plugins that implement web',
() async {
final RepositoryPackage plugin = createFakePlugin(
@ -517,6 +544,33 @@ test_on: vm && browser
);
});
test('runs in Chrome (wasm) when requested for Dart package', () async {
final RepositoryPackage package = createFakePackage(
'package',
packagesDir,
extraFiles: <String>['test/empty_test.dart'],
);
await runCapturingPrint(
runner, <String>['dart-test', '--platform=chrome', '--wasm']);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall('dart', const <String>['pub', 'get'], package.path),
ProcessCall(
'dart',
const <String>[
'run',
'test',
'--platform=chrome',
'--compiler=dart2wasm',
],
package.path),
]),
);
});
test('skips running in browser mode if package opts out', () async {
final RepositoryPackage package = createFakePackage(
'a_package',