Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1a6005f

Browse files
authored
Add iOS version to scenario golden images (#30263)
1 parent 2eca05e commit 1a6005f

25 files changed

+83
-115
lines changed

testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/project.pbxproj

Lines changed: 65 additions & 75 deletions
Large diffs are not rendered by default.

testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenImage.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ - (BOOL)compareGoldenToImage:(UIImage*)image {
102102
}
103103

104104
NS_INLINE NSString* _platformName() {
105+
NSString* systemVersion = UIDevice.currentDevice.systemVersion;
105106
NSString* simulatorName =
106107
[[NSProcessInfo processInfo].environment objectForKey:@"SIMULATOR_DEVICE_NAME"];
107108
if (simulatorName) {
108-
return [NSString stringWithFormat:@"%@_simulator", simulatorName];
109+
return [NSString stringWithFormat:@"%@_%@_simulator", simulatorName, systemVersion];
109110
}
110111

111112
size_t size;

testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ - (instancetype)initWithLaunchArg:(NSString*)launchArg {
3939
@"--non-full-screen-flutter-view-platform-view" :
4040
@"non_full_screen_flutter_view_platform_view",
4141
@"--bogus-font-text" : @"bogus_font_text",
42+
@"--spawn-engine-works" : @"spawn_engine_works",
4243
};
4344
});
4445
_identifier = launchArgsMap[launchArg];

testing/scenario_app/ios/Scenarios/ScenariosUITests/SpawnEngineTest.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

testing/scenario_app/ios/Scenarios/ScenariosUITests/SpawnEngineTest.m

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,26 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import "SpawnEngineTest.h"
6-
#import "GoldenImage.h"
5+
#import "GoldenPlatformViewTests.h"
6+
7+
@interface SpawnEngineTest : XCTestCase
8+
@end
79

810
@implementation SpawnEngineTest
911

10-
- (void)setUp {
11-
[super setUp];
12+
- (void)testSpawnEngineWorks {
1213
self.continueAfterFailure = NO;
1314

14-
self.application = [[XCUIApplication alloc] init];
15-
self.application.launchArguments = @[ @"--spawn-engine-works", @"--enable-software-rendering" ];
16-
[self.application launch];
17-
}
15+
XCUIApplication* application = [[XCUIApplication alloc] init];
16+
application.launchArguments = @[ @"--spawn-engine-works", @"--enable-software-rendering" ];
17+
[application launch];
1818

19-
- (void)testSpawnEngineWorks {
20-
NSString* prefix = @"golden_spawn_engine_works_";
21-
GoldenImage* golden = [[GoldenImage alloc] initWithGoldenNamePrefix:prefix];
22-
if (!golden.image) {
23-
XCTFail(@"unable to find golden image for: %@", prefix);
24-
}
25-
XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot];
26-
if (![golden compareGoldenToImage:screenshot.image]) {
27-
XCTAttachment* screenshotAttachment = [XCTAttachment attachmentWithImage:screenshot.image];
28-
screenshotAttachment.name = [golden.goldenName stringByAppendingString:@"_actual"];
29-
screenshotAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
30-
[self addAttachment:screenshotAttachment];
31-
32-
XCTFail(@"Goldens do not match. Follow the steps in the "
33-
@"README to update golden named %@ if needed.",
34-
golden.goldenName);
35-
}
19+
XCUIElement* addTextField = application.textFields[@"ready"];
20+
XCTAssertTrue([addTextField waitForExistenceWithTimeout:30]);
21+
22+
GoldenTestManager* manager =
23+
[[GoldenTestManager alloc] initWithLaunchArg:@"--spawn-engine-works"];
24+
[manager checkGoldenForTest:self];
3625
}
3726

3827
@end
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)