Skip to content

Commit 6f7c309

Browse files
authored
Configure integration tests to run on dart2wasm (#9743)
1 parent 8382116 commit 6f7c309

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ jobs:
208208
# TODO(https://github.com/flutter/devtools/issues/9357): Re-enable tests on windows-latest.
209209
os: [macos-latest]
210210
# Consider running integration tests in ddc mode, too.
211-
bot: [integration_dart2js]
211+
bot: [integration_dart2js, integration_dart2wasm]
212212
device: [flutter, flutter-web, dart-cli]
213213
# Option 1/1 will run all tests for a device in a single shard.
214214
# Option 1/2 and 2/2 should be enabled to run tests for a device in 2 shards.
@@ -273,7 +273,7 @@ jobs:
273273
fail-fast: false
274274
matrix:
275275
# Consider running integration tests in ddc mode, too.
276-
bot: [integration_dart2js]
276+
bot: [integration_dart2js, integration_wasm]
277277
os: [ubuntu-latest, windows-latest]
278278
steps:
279279
- name: git clone

packages/devtools_app/integration_test/test_infra/run/run_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Future<void> runFlutterIntegrationTest(
8282
testTarget,
8383
testDriver: 'test_driver/integration_test.dart',
8484
headless: testRunnerArgs.headless,
85+
useWasm: testRunnerArgs.useWasm,
8586
dartDefineArgs: [
8687
'test_args=${jsonEncode(testArgs)}',
8788
if (testFileArgs.experimentsOn) 'enable_experiments=true',

packages/devtools_extensions/integration_test/run_tests.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Future<void> _runIntegrationTest(
3838
testRunnerArgs.testTarget!,
3939
testDriver: 'test_driver/integration_test.dart',
4040
headless: testRunnerArgs.headless,
41+
useWasm: testRunnerArgs.useWasm,
4142
dartDefineArgs: ['use_simulated_environment=true'],
4243
debugLogging: debugTestScript,
4344
);

packages/devtools_shared/lib/src/test/integration_test_runner.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class IntegrationTestRunner with IOMixin {
2727
String testTarget, {
2828
required String testDriver,
2929
bool headless = false,
30+
bool useWasm = false,
3031
List<String> dartDefineArgs = const <String>[],
3132
bool debugLogging = false,
3233
}) async {
@@ -51,7 +52,10 @@ class IntegrationTestRunner with IOMixin {
5152
headless ? 'web-server' : 'chrome',
5253
// --disable-gpu speeds up tests that use ChromeDriver when run on
5354
// GitHub Actions. See https://github.com/flutter/devtools/issues/8301.
54-
'--web-browser-flag=--disable-gpu',
55+
// However, it also breaks the tests when running with the wasm flag,
56+
// because it prevents capturing browser logs. See:
57+
// https://github.com/flutter/devtools/issues/9727
58+
useWasm ? '--wasm' : '--web-browser-flag=--disable-gpu',
5559
if (headless) ...[
5660
// Flags to avoid breakage with chromedriver 138. See
5761
// https://github.com/flutter/devtools/issues/9357.
@@ -223,6 +227,9 @@ class IntegrationTestRunnerArgs {
223227
/// instead of 'chrome'.
224228
bool get headless => argResults.flag(_headlessArg);
225229

230+
/// Whether this integration test should be run against dart2wasm-compiled DevTools.
231+
bool get useWasm => argResults.flag(_wasmArg);
232+
226233
/// Sharding information for this test run.
227234
({int shardNumber, int totalShards})? get shard {
228235
final shardValue = argResults.option(_shardArg);
@@ -250,6 +257,7 @@ class IntegrationTestRunnerArgs {
250257
static const _helpArg = 'help';
251258
static const testTargetArg = 'target';
252259
static const _headlessArg = 'headless';
260+
static const _wasmArg = 'wasm';
253261
static const _shardArg = 'shard';
254262

255263
/// Builds an arg parser for DevTools integration tests.
@@ -277,6 +285,11 @@ class IntegrationTestRunnerArgs {
277285
'the \'chrome\' device. For headless test runs, you will not be '
278286
'able to see the integration test run visually in a Chrome browser.',
279287
)
288+
..addFlag(
289+
_wasmArg,
290+
negatable: false,
291+
help: 'Runs the integration test against dart2wasm-compiled DevTools.',
292+
)
280293
..addOption(
281294
_shardArg,
282295
valueHelp: '1/3',

tool/ci/bots.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ elif [ "$BOT" = "test_webdriver" ]; then
7272
# elif [ "$BOT" = "integration_ddc" ]; then
7373

7474
# TODO(https://github.com/flutter/devtools/issues/1987): rewrite legacy integration tests.
75-
elif [ "$BOT" = "integration_dart2js" ]; then
75+
elif [[ "$BOT" == "integration_dart2js" || "$BOT" == "integration_dart2wasm" ]]; then
76+
if [ "$BOT" == "integration_dart2wasm" ]; then
77+
WASM_FLAG="--wasm"
78+
else
79+
WASM_FLAG=""
80+
fi
81+
7682
if [ "$DEVTOOLS_PACKAGE" = "devtools_app" ]; then
7783
flutter pub get
7884

@@ -85,15 +91,15 @@ run to see if golden image failures have been uploaded (this only happens once a
8591
completed). Download these goldens and update them in the codebase to apply the updates."
8692

8793
if [ "$DEVICE" = "flutter" ]; then
88-
dart run integration_test/run_tests.dart --headless --shard="$SHARD"
94+
dart run integration_test/run_tests.dart $WASM_FLAG --headless --shard="$SHARD"
8995
elif [ "$DEVICE" = "flutter-web" ]; then
90-
dart run integration_test/run_tests.dart --test-app-device=chrome --headless --shard="$SHARD"
96+
dart run integration_test/run_tests.dart --test-app-device=chrome $WASM_FLAG --headless --shard="$SHARD"
9197
elif [ "$DEVICE" = "dart-cli" ]; then
92-
dart run integration_test/run_tests.dart --test-app-device=cli --headless --shard="$SHARD"
98+
dart run integration_test/run_tests.dart --test-app-device=cli $WASM_FLAG --headless --shard="$SHARD"
9399
fi
94100
elif [ "$DEVTOOLS_PACKAGE" = "devtools_extensions" ]; then
95101
pushd $DEVTOOLS_DIR/packages/devtools_extensions
96-
dart run integration_test/run_tests.dart --headless
102+
dart run integration_test/run_tests.dart $WASM_FLAG --headless
97103
popd
98104
fi
99105
fi

0 commit comments

Comments
 (0)