Skip to content

Commit

Permalink
Refactor add_to_app_life_cycle_tests (flutter#145546)
Browse files Browse the repository at this point in the history
Refactor add_to_app_life_cycle_tests in order to reduce testing logic in test.dart, create a suite_runners directory and allow for later implementing package:test onto add_to_app_life_cycle_tests

Part of flutter#145482
  • Loading branch information
sealesj committed Mar 25, 2024
1 parent b05937d commit 2832611
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
23 changes: 23 additions & 0 deletions dev/bots/suite_runners/run_add_to_app_life_cycle_tests.dart
@@ -0,0 +1,23 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io' show Platform;

import 'package:path/path.dart' as path;

import '../run_command.dart';
import '../utils.dart';

Future<void> addToAppLifeCycleRunner(String flutterRoot) async {
if (Platform.isMacOS) {
printProgress('${green}Running add-to-app life cycle iOS integration tests$reset...');
final String addToAppDir = path.join(flutterRoot, 'dev', 'integration_tests', 'ios_add2app_life_cycle');
await runCommand('./build_and_test.sh',
<String>[],
workingDirectory: addToAppDir,
);
} else {
throw Exception('Only iOS has add-to-add lifecycle tests at this time.');
}
}
16 changes: 2 additions & 14 deletions dev/bots/test.dart
Expand Up @@ -66,6 +66,7 @@ import 'package:process/process.dart';
import 'browser.dart';
import 'run_command.dart';
import 'service_worker_test.dart';
import 'suite_runners/run_add_to_app_life_cycle_tests.dart';
import 'tool_subsharding.dart';
import 'utils.dart';

Expand Down Expand Up @@ -230,7 +231,7 @@ Future<void> main(List<String> args) async {
printProgress('Running task: ${Platform.environment[CIRRUS_TASK_NAME]}');
}
await selectShard(<String, ShardRunner>{
'add_to_app_life_cycle_tests': _runAddToAppLifeCycleTests,
'add_to_app_life_cycle_tests': () => addToAppLifeCycleRunner(flutterRoot),
'build_tests': _runBuildTests,
'framework_coverage': _runFrameworkCoverage,
'framework_tests': _runFrameworkTests,
Expand Down Expand Up @@ -790,19 +791,6 @@ Future<void> _flutterBuildDart2js(String relativePathToApplication, String targe
);
}

Future<void> _runAddToAppLifeCycleTests() async {
if (Platform.isMacOS) {
printProgress('${green}Running add-to-app life cycle iOS integration tests$reset...');
final String addToAppDir = path.join(flutterRoot, 'dev', 'integration_tests', 'ios_add2app_life_cycle');
await runCommand('./build_and_test.sh',
<String>[],
workingDirectory: addToAppDir,
);
} else {
printProgress('${yellow}Skipped on this platform (only iOS has add-to-add lifecycle tests at this time).$reset');
}
}

Future<void> _runFrameworkTests() async {
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];

Expand Down

0 comments on commit 2832611

Please sign in to comment.