Unverified Commit be8d29ff authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Run native_ui_tests_macos in correct directory (#90829)

parent 3a6c18da
...@@ -7,6 +7,7 @@ import 'package:flutter_devicelab/framework/framework.dart'; ...@@ -7,6 +7,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart'; import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios; deviceOperatingSystem = DeviceOperatingSystem.ios;
...@@ -35,7 +36,7 @@ Future<void> main() async { ...@@ -35,7 +36,7 @@ Future<void> main() async {
section('Run platform unit tests'); section('Run platform unit tests');
final Device device = await devices.workingDevice; final Device device = await devices.workingDevice;
if (!await runXcodeTests(projectDirectory, device.deviceId, 'native_ui_tests_ios')) { if (!await runXcodeTests(path.join(projectDirectory, 'ios'), 'id=${device.deviceId}', 'native_ui_tests_ios')) {
return TaskResult.failure('Platform unit tests failed'); return TaskResult.failure('Platform unit tests failed');
} }
......
...@@ -6,6 +6,7 @@ import 'package:flutter_devicelab/framework/framework.dart'; ...@@ -6,6 +6,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart'; import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async { Future<void> main() async {
await task(() async { await task(() async {
...@@ -26,7 +27,7 @@ Future<void> main() async { ...@@ -26,7 +27,7 @@ Future<void> main() async {
section('Run platform unit tests'); section('Run platform unit tests');
if (!await runXcodeTests(projectDirectory, 'platform=macOS', 'native_ui_tests_macos')) { if (!await runXcodeTests(path.join(projectDirectory, 'macos'), 'platform=macOS', 'native_ui_tests_macos')) {
return TaskResult.failure('Platform unit tests failed'); return TaskResult.failure('Platform unit tests failed');
} }
......
...@@ -140,7 +140,7 @@ Future<void> removeIOSimulator(String deviceId) async { ...@@ -140,7 +140,7 @@ Future<void> removeIOSimulator(String deviceId) async {
} }
} }
Future<bool> runXcodeTests(String projectDirectory, String deviceId, String testName) async { Future<bool> runXcodeTests(String platformDirectory, String destination, String testName) async {
final Map<String, String> environment = Platform.environment; final Map<String, String> environment = Platform.environment;
// If not running on CI, inject the Flutter team code signing properties. // If not running on CI, inject the Flutter team code signing properties.
final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633'; final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633';
...@@ -159,7 +159,7 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test ...@@ -159,7 +159,7 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
'-configuration', '-configuration',
'Release', 'Release',
'-destination', '-destination',
'id=$deviceId', destination,
'-resultBundlePath', '-resultBundlePath',
resultBundlePath, resultBundlePath,
'test', 'test',
...@@ -170,13 +170,15 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test ...@@ -170,13 +170,15 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
if (provisioningProfile != null) if (provisioningProfile != null)
'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile', 'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile',
], ],
workingDirectory: path.join(projectDirectory, 'ios'), workingDirectory: platformDirectory,
canFail: true, canFail: true,
); );
if (testResultExit != 0) { if (testResultExit != 0) {
final Directory? dumpDirectory = hostAgent.dumpDirectory; final Directory? dumpDirectory = hostAgent.dumpDirectory;
final Directory xcresultBundle = Directory(path.join(resultBundleTemp, 'result.xcresult'));
if (dumpDirectory != null) { if (dumpDirectory != null) {
if (xcresultBundle.existsSync()) {
// Zip the test results to the artifacts directory for upload. // Zip the test results to the artifacts directory for upload.
final String zipPath = path.join(dumpDirectory.path, final String zipPath = path.join(dumpDirectory.path,
'$testName-${DateTime.now().toLocal().toIso8601String()}.zip'); '$testName-${DateTime.now().toLocal().toIso8601String()}.zip');
...@@ -186,11 +188,14 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test ...@@ -186,11 +188,14 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
'-r', '-r',
'-9', '-9',
zipPath, zipPath,
'result.xcresult', path.basename(xcresultBundle.path),
], ],
workingDirectory: resultBundleTemp, workingDirectory: resultBundleTemp,
canFail: true, // Best effort to get the logs. canFail: true, // Best effort to get the logs.
); );
} else {
print('xcresult bundle ${xcresultBundle.path} does not exist, skipping upload');
}
} }
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment