summaryrefslogtreecommitdiff
path: root/platform/ios/demo/ExamplesUITests/ExamplesUITests.m
blob: 3b08cb3fc87179e6962faa28b10bf9836fcbb95a (plain)
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
//
//  ExamplesUITests.m
//  ExamplesUITests
//
//  Created by Jason Wray on 1/26/16.
//  Copyright © 2016 Mapbox. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "Examples.h"

@interface ExamplesUITests : XCTestCase

@end
@implementation ExamplesUITests

- (void)setUp {
    [super setUp];

    // In UI tests it is usually best to stop immediately when a failure occurs.
    self.continueAfterFailure = NO;

    // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
    XCUIApplication *app = [[XCUIApplication alloc] init];
    app.launchArguments = [app.launchArguments arrayByAddingObject:@"useFastAnimations"];
    [app launch];
}

- (void)tearDown {
    [super tearDown];
}

- (void)testEveryExample {
    XCUIApplication *app = [[XCUIApplication alloc] init];

    for (int i = 0; i < app.tables.cells.count; i++) {
        [app.tables.cells.allElementsBoundByIndex[i] tap];

        // XCTest waits for the app to idle before continuing.

        [app.navigationBars.buttons[@"Back"] tap];
    }
}

@end