diff --git a/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m b/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m index 96f65fe760..76c95a0650 100644 --- a/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m +++ b/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m @@ -76,7 +76,7 @@ NSDictionary* launchArgsMap; - (void)checkGoldenForTest:(XCTestCase*)test { XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot]; if (!_goldenImage.image) { - XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot.image]; + XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot]; attachment.name = [_goldenImage.goldenName stringByAppendingString:@"_new.png"]; attachment.lifetime = XCTAttachmentLifetimeKeepAlways; [test addAttachment:attachment]; diff --git a/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m b/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m index 9b0f699eeb..a0196b9b3b 100644 --- a/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m +++ b/engine/src/flutter/testing/scenario_app/ios/Scenarios/ScenariosUITests/LocalizationInitializationTest.m @@ -26,10 +26,17 @@ FLUTTER_ASSERT_ARC NSTimeInterval timeout = 10.0; // The locales received by dart:ui are exposed onBeginFrame via semantics label. - // There should only be one locale, since the default iOS app only has en_US as - // the locale. The list should consist of just the en locale. + // There should only be one locale. The list should consist of the default + // locale provided by the iOS app. + NSArray* preferredLocales = [NSLocale preferredLanguages]; + XCTAssertEqual(preferredLocales.count, 1); + // Dart connects the locale parts with `_` while iOS connects them with `-`. + // Converts to dart format before comparing. + NSString* localeDart = [preferredLocales.firstObject stringByReplacingOccurrencesOfString:@"-" + withString:@"_"]; + NSString* expectedIdentifier = [NSString stringWithFormat:@"[%@]", localeDart]; XCUIElement* textInputSemanticsObject = - [self.application.textFields matchingIdentifier:@"[en]"].element; + [self.application.textFields matchingIdentifier:expectedIdentifier].element; XCTAssertTrue([textInputSemanticsObject waitForExistenceWithTimeout:timeout]); [textInputSemanticsObject tap];