forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoldenPlatformViewTests.m
More file actions
50 lines (37 loc) · 1.51 KB
/
GoldenPlatformViewTests.m
File metadata and controls
50 lines (37 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2013 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 "GoldenPlatformViewTests.h"
#include <sys/sysctl.h>
#import "GoldenTestManager.h"
static const NSInteger kSecondsToWaitForPlatformView = 30;
@interface GoldenPlatformViewTests ()
@property(nonatomic, copy) NSString* goldenName;
@property(nonatomic, strong) GoldenTestManager* manager;
@end
@implementation GoldenPlatformViewTests
- (instancetype)initWithManager:(GoldenTestManager*)manager invocation:(NSInvocation*)invocation {
self = [super initWithInvocation:invocation];
_manager = manager;
return self;
}
- (void)setUp {
[super setUp];
self.continueAfterFailure = NO;
self.application = [[XCUIApplication alloc] init];
self.application.launchArguments = @[ self.manager.launchArg, @"--enable-software-rendering" ];
[self.application launch];
}
// Note: don't prefix with "test" or GoldenPlatformViewTests will run instead of the subclasses.
- (void)checkPlatformViewGolden {
XCUIElement* element = self.application.textViews.firstMatch;
BOOL exists = [element waitForExistenceWithTimeout:kSecondsToWaitForPlatformView];
if (!exists) {
XCTFail(@"It took longer than %@ second to find the platform view."
@"There might be issues with the platform view's construction,"
@"or with how the scenario is built.",
@(kSecondsToWaitForPlatformView));
}
[self.manager checkGoldenForTest:self];
}
@end