[tools]Build IPA validation UI Polish (#116744)

* [tools]some ui polish for build ipa validation

* do not print out a few success validations

* rename installed type to success for more general usage

* forgot nit after reverting custom validation types and re-use doctor types
This commit is contained in:
hellohuanlin
2022-12-15 14:43:32 -08:00
committed by GitHub
parent c98978ae36
commit 0916375f44
27 changed files with 220 additions and 133 deletions

View File

@@ -918,18 +918,18 @@ void main() {
expect(
testLogger.statusText,
contains(
'┌─ App Settings ──────────────────────────────────────────────────────────────────┐\n'
'│ Version Number: Missing │\n'
'│ Build Number: Missing │\n'
'│ Display Name: Missing │\n'
'│ Deployment Target: Missing │\n'
'│ Bundle Identifier: io.flutter.someProject │\n'
'│ │\n'
'│ You must set up the missing settings. │\n'
'│ │\n'
'│ To update the settings, please refer to https://docs.flutter.dev/deployment/ios │\n'
'└─────────────────────────────────────────────────────────────────────────────────┘\n'
'[!] App Settings Validation\n'
' ! Version Number: Missing\n'
' ! Build Number: Missing\n'
' ! Display Name: Missing\n'
' ! Deployment Target: Missing\n'
' • Bundle Identifier: io.flutter.someProject\n'
' ! You must set up the missing app settings.\n'
));
expect(
testLogger.statusText,
contains('To update the settings, please refer to https://docs.flutter.dev/deployment/ios')
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -972,17 +972,18 @@ void main() {
expect(
testLogger.statusText,
contains(
'┌─ App Settings ──────────────────────────────────────────────────────────────────┐\n'
'│ Version Number: 12.34.56 │\n'
'│ Build Number: 666 │\n'
'│ Display Name: Awesome Gallery │\n'
'│ Deployment Target: 11.0 │\n'
'│ Bundle Identifier: io.flutter.someProject │\n'
'│ │\n'
'│ To update the settings, please refer to https://docs.flutter.dev/deployment/ios │\n'
'└─────────────────────────────────────────────────────────────────────────────────┘\n'
'[✓] App Settings Validation\n'
' • Version Number: 12.34.56\n'
' • Build Number: 666\n'
' • Display Name: Awesome Gallery\n'
' • Deployment Target: 11.0\n'
' • Bundle Identifier: io.flutter.someProject\n'
)
);
expect(
testLogger.statusText,
contains('To update the settings, please refer to https://docs.flutter.dev/deployment/ios')
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1019,8 +1020,8 @@ void main() {
<String>['build', 'ipa', '--no-pub']);
expect(
testLogger.statusText,
contains('Warning: Your application still contains the default "com.example" bundle identifier.')
testLogger.statusText,
contains(' ! Your application still contains the default "com.example" bundle identifier.')
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
@@ -1058,8 +1059,8 @@ void main() {
<String>['build', 'ipa', '--no-pub']);
expect(
testLogger.statusText,
isNot(contains('Warning: Your application still contains the default "com.example" bundle identifier.'))
testLogger.statusText,
isNot(contains(' ! Your application still contains the default "com.example" bundle identifier.'))
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
@@ -1140,7 +1141,7 @@ void main() {
expect(
testLogger.statusText,
contains('Warning: App icon is set to the default placeholder icon. Replace with unique icons.'),
contains(' ! App icon is set to the default placeholder icon. Replace with unique icons.'),
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
@@ -1217,7 +1218,10 @@ void main() {
await createTestCommandRunner(command).run(
<String>['build', 'ipa', '--no-pub']);
expect(testLogger.statusText, isNot(contains('Warning: App icon is set to the default placeholder icon. Replace with unique icons.')));
expect(
testLogger.statusText,
isNot(contains(' ! App icon is set to the default placeholder icon. Replace with unique icons.'))
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1273,7 +1277,10 @@ void main() {
await createTestCommandRunner(command).run(
<String>['build', 'ipa', '--no-pub']);
expect(testLogger.statusText, contains('Warning: App icon is using the wrong size (e.g. Icon-App-20x20@2x.png).'));
expect(
testLogger.statusText,
contains(' ! App icon is using the incorrect size (e.g. Icon-App-20x20@2x.png).')
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1329,7 +1336,10 @@ void main() {
await createTestCommandRunner(command).run(
<String>['build', 'ipa', '--no-pub']);
expect(testLogger.statusText, contains('Warning: App icon is using the wrong size (e.g. Icon-App-20x20@2x.png).'));
expect(
testLogger.statusText,
contains(' ! App icon is using the incorrect size (e.g. Icon-App-20x20@2x.png).')
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1385,7 +1395,10 @@ void main() {
await createTestCommandRunner(command).run(
<String>['build', 'ipa', '--no-pub']);
expect(testLogger.statusText, isNot(contains('Warning: App icon is using the wrong size (e.g. Icon-App-20x20@2x.png).')));
expect(
testLogger.statusText,
isNot(contains(' ! App icon is using the incorrect size (e.g. Icon-App-20x20@2x.png).'))
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1443,7 +1456,10 @@ void main() {
<String>['build', 'ipa', '--no-pub']);
// The validation should be skipped, even when the icon size is incorrect.
expect(testLogger.statusText, isNot(contains('Warning: App icon is using the wrong size (e.g. Icon-App-20x20@2x.png).')));
expect(
testLogger.statusText,
isNot(contains(' ! App icon is using the incorrect size (e.g. Icon-App-20x20@2x.png).')),
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => fakeProcessManager,
@@ -1545,8 +1561,10 @@ void main() {
// The validation should be skipped, even when the image size is incorrect.
for (final String imageFileName in imageFileNames) {
expect(testLogger.statusText, isNot(contains(
'Warning: App icon is using the wrong size (e.g. $imageFileName).')));
expect(
testLogger.statusText,
isNot(contains(' ! App icon is using the incorrect size (e.g. $imageFileName).'))
);
}
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
@@ -1623,7 +1641,7 @@ void main() {
expect(
testLogger.statusText,
contains('Warning: Launch image is set to the default placeholder. Replace with unique launch images.'),
contains(' ! Launch image is set to the default placeholder icon. Replace with unique launch image.'),
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
@@ -1701,7 +1719,7 @@ void main() {
expect(
testLogger.statusText,
isNot(contains('Warning: Launch image is set to the default placeholder. Replace with unique launch images.')),
isNot(contains(' ! Launch image is set to the default placeholder icon. Replace with unique launch image.')),
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,

View File

@@ -58,7 +58,7 @@ void main() {
group('doctor', () {
testUsingContext('vs code validator when both installed', () async {
final ValidationResult result = await VsCodeValidatorTestTargets.installedWithExtension.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.statusInfo, 'version 1.2.3');
expect(result.messages, hasLength(2));
@@ -85,7 +85,7 @@ void main() {
testUsingContext('vs code validator when 64bit installed', () async {
expect(VsCodeValidatorTestTargets.installedWithExtension64bit.title, 'VS Code, 64-bit edition');
final ValidationResult result = await VsCodeValidatorTestTargets.installedWithExtension64bit.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.statusInfo, 'version 1.2.3');
expect(result.messages, hasLength(2));
@@ -100,7 +100,7 @@ void main() {
testUsingContext('vs code validator when extension missing', () async {
final ValidationResult result = await VsCodeValidatorTestTargets.installedWithoutExtension.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.statusInfo, 'version 1.2.3');
expect(result.messages, hasLength(2));
@@ -157,7 +157,7 @@ void main() {
userMessages: UserMessages(),
);
final ValidationResult result = await deviceValidator.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.messages, const <ValidationMessage>[
ValidationMessage('name (mobile) • device-id • android • 1.2.3'),
ValidationMessage.hint('Device locked'),
@@ -850,7 +850,7 @@ class PassingValidator extends DoctorValidator {
ValidationMessage('A helpful message'),
ValidationMessage('A second, somewhat longer helpful message'),
];
return const ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo');
return const ValidationResult(ValidationType.success, messages, statusInfo: 'with statusInfo');
}
}
@@ -862,7 +862,7 @@ class PiiValidator extends DoctorValidator {
const List<ValidationMessage> messages = <ValidationMessage>[
ValidationMessage('Contains PII path/to/username', piiStrippedMessage: 'Does not contain PII'),
];
return const ValidationResult(ValidationType.installed, messages);
return const ValidationResult(ValidationType.success, messages);
}
}
@@ -1089,7 +1089,7 @@ class PassingGroupedValidator extends DoctorValidator {
const List<ValidationMessage> messages = <ValidationMessage>[
ValidationMessage('A helpful message'),
];
return const ValidationResult(ValidationType.installed, messages);
return const ValidationResult(ValidationType.success, messages);
}
}
@@ -1125,7 +1125,7 @@ class PassingGroupedValidatorWithStatus extends DoctorValidator {
const List<ValidationMessage> messages = <ValidationMessage>[
ValidationMessage('A different message'),
];
return const ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message');
return const ValidationResult(ValidationType.success, messages, statusInfo: 'A status message');
}
}

View File

@@ -41,8 +41,8 @@ void main() {
// Run the validation check and get the results
final ValidationResult result = await httpHostValidator.validate();
// Check for a ValidationType.installed result
expect(result.type, equals(ValidationType.installed));
// Check for a ValidationType.success result
expect(result.type, equals(ValidationType.success));
}
});
@@ -108,8 +108,8 @@ void main() {
// Run the validation check and get the results
final ValidationResult result = await httpHostValidator.validate();
// Check for a ValidationType.installed result
expect(result.type, equals(ValidationType.installed));
// Check for a ValidationType.success result
expect(result.type, equals(ValidationType.success));
}
});
@@ -253,8 +253,8 @@ void main() {
// Run the validation check and get the results
final ValidationResult result = await httpHostValidator.validate();
// Check for a ValidationType.installed result
expect(result.type, equals(ValidationType.installed));
// Check for a ValidationType.success result
expect(result.type, equals(ValidationType.success));
}
});
@@ -275,8 +275,8 @@ void main() {
// Run the validation check and get the results
final ValidationResult result = await httpHostValidator.validate();
// Check for a ValidationType.installed result
expect(result.type, equals(ValidationType.installed));
// Check for a ValidationType.success result
expect(result.type, equals(ValidationType.success));
}
});
@@ -295,8 +295,8 @@ void main() {
// Run the validation check and get the results
final ValidationResult result = await httpHostValidator.validate();
// Check for a ValidationType.installed result
expect(result.type, equals(ValidationType.installed));
// Check for a ValidationType.success result
expect(result.type, equals(ValidationType.success));
}
});
});

View File

@@ -142,7 +142,7 @@ void main() {
// gen_snapshot is downloaded on demand, and the doctor should not
// fail if the gen_snapshot binary is not present.
expect(await flutterValidator.validate(), _matchDoctorValidation(
validationType: ValidationType.installed,
validationType: ValidationType.success,
statusInfo: 'Channel beta, 1.0.0, on Windows, locale en_US.UTF-8',
messages: anything,
));
@@ -199,7 +199,7 @@ void main() {
);
expect(await flutterValidator.validate(), _matchDoctorValidation(
validationType: ValidationType.installed,
validationType: ValidationType.success,
statusInfo: 'Channel beta, 1.0.0, on Windows, locale en_US.UTF-8',
messages: containsAll(const <ValidationMessage>[
ValidationMessage('Pub download mirror https://example.com/pub'),
@@ -327,7 +327,7 @@ void main() {
);
expect(await flutterValidator.validate(), _matchDoctorValidation(
validationType: ValidationType.installed,
validationType: ValidationType.success,
statusInfo: 'Channel beta, 1.0.0, on Linux, locale en_US.UTF-8',
messages: contains(const ValidationMessage('Upstream repository https://github.com/flutter/flutter.git')),
));
@@ -418,7 +418,7 @@ void main() {
);
expect(await flutterValidator.validate(), _matchDoctorValidation(
validationType: ValidationType.installed,
validationType: ValidationType.success,
statusInfo: 'Channel beta, 1.0.0, on Linux, locale en_US.UTF-8',
messages: isNot(
contains(const ValidationMessage(
@@ -598,7 +598,7 @@ void main() {
);
expect(await flutterValidator.validate(), _matchDoctorValidation(
validationType: ValidationType.installed,
validationType: ValidationType.success,
statusInfo: 'Channel beta, 1.0.0, on Linux, locale en_US.UTF-8',
messages: isNot(contains(isA<ValidationMessage>().having(
(ValidationMessage message) => message.message,

View File

@@ -77,7 +77,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(2020.1) plugins check on linux (installed via JetBrains ToolBox app)', () async {
@@ -104,7 +104,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(>=2020.2) plugins check on linux (installed via JetBrains ToolBox app)', () async {
@@ -131,7 +131,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(2020.1~) plugins check on linux (installed via tar.gz)', () async {
@@ -158,7 +158,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('legacy intellij(<2020) plugins check on windows', () async {
@@ -185,7 +185,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(2020.1 ~ 2020.2) plugins check on windows (installed via JetBrains ToolBox app)', () async {
@@ -212,7 +212,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(>=2020.3) plugins check on windows (installed via JetBrains ToolBox app and plugins)', () async {
@@ -239,7 +239,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('intellij(2020.1~) plugins check on windows (installed via installer)', () async {
@@ -266,7 +266,7 @@ void main() {
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
expect(ValidationType.success, result.type);
});
testWithoutContext('can locate installations on macOS from Spotlight', () {

View File

@@ -114,7 +114,7 @@ void main() {
);
final ValidationResult result = await linuxDoctorValidator.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.messages, const <ValidationMessage>[
ValidationMessage('clang version 4.0.1-6+build1'),
ValidationMessage('cmake version 3.16.3'),

View File

@@ -15,7 +15,7 @@ void main() {
testWithoutContext('Emits installed status when CocoaPods is installed', () async {
final CocoaPodsValidator workflow = CocoaPodsValidator(FakeCocoaPods(CocoaPodsStatus.recommended, '1000.0.0'), UserMessages());
final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
});
testWithoutContext('Emits missing status when CocoaPods is not installed', () async {

View File

@@ -182,7 +182,7 @@ void main() {
);
final XcodeValidator validator = XcodeValidator(xcode: xcode, userMessages: UserMessages());
final ValidationResult result = await validator.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
expect(result.messages.length, 2);
final ValidationMessage firstMessage = result.messages.first;
expect(firstMessage.type, ValidationMessageType.information);

View File

@@ -50,7 +50,7 @@ void main() {
testWithoutContext('WebValidator can find executable on macOS', () async {
final ValidationResult result = await webValidator.validate();
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
});
testWithoutContext('WebValidator Can notice missing macOS executable ', () async {

View File

@@ -165,7 +165,7 @@ void main() {
userMessages.visualStudioVersion(fakeVisualStudio.displayName!, fakeVisualStudio.fullVersion!));
expect(result.messages.contains(expectedDisplayNameMessage), true);
expect(result.type, ValidationType.installed);
expect(result.type, ValidationType.success);
});
testWithoutContext('Emits missing status when Visual Studio is not installed', () async {

View File

@@ -138,7 +138,7 @@ Hyper-V Requirements: A hypervisor has been detected. Features required for
/// The expected validation result object for
/// a passing windows version test
const ValidationResult validWindows10ValidationResult = ValidationResult(
ValidationType.installed,
ValidationType.success,
<ValidationMessage>[],
statusInfo: 'Installed version of Windows is version 10 or higher',
);