flutter/dev/devicelab/bin/tasks/flavors_test_macos.dart
Andrew Kolos f8b9748661
Restore and fix flavors_test_macos (#139841)
Partially resolves[^1] https://github.com/flutter/flutter/issues/139774.

Effectively reverts https://github.com/flutter/flutter/pull/125581.

The main change here is that I deleted and recreated the macos Xcode project for this integration test (hence the large diff). I tried fixing the existing project first, but it was set up quite differently, and—for whatever reason—the integration test would get stuck trying to load `dev/integration_tests/flavors/integration_test/integration_test.dart`.

I verified that this works locally, but I don't know if it's possible to run this on the devicelab try pool to verify that it works on devicelab hardware.

[^1]: I would not close the issue until 1) this PR lands, 2) the integration test consistently passes on CI, and 3) macOS support for flavors is publicly documented.
2023-12-18 08:52:22 +00:00

50 lines
1.6 KiB
Dart

// 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 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.macos;
await task(() async {
await createFlavorsTest().call();
await createIntegrationTestFlavorsTest().call();
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
await flutter(
'install',
options: <String>['--flavor', 'paid', '-d', 'macos'],
);
await flutter(
'install',
options: <String>['--flavor', 'paid', '--uninstall-only', '-d', 'macos'],
);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'build',
canFail: true,
stderr: stderr,
options: <String>['macos', '--flavor', 'bogus'],
);
final String stderrString = stderr.toString();
print(stderrString);
if (!stderrString.contains('The Xcode project defines schemes:')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
return TaskResult.success(null);
},
);
return installTestsResult;
});
}