Skip to content

Commit

Permalink
Fix Example Projects and run them via CI
Browse files Browse the repository at this point in the history
  • Loading branch information
justinseanmartin authored and Dave Apgar and Justin Martin and Joel Levin committed May 6, 2017
1 parent f6c573e commit 5789786
Show file tree
Hide file tree
Showing 18 changed files with 629 additions and 429 deletions.

This file was deleted.

Expand Up @@ -7,56 +7,25 @@
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. licenses this file to you.

#import <KIF/KIF.h>
@import KIF;

@interface KIFUITestActor (BasicCalculator)
#import "KIFUITestActor+BasicCalculator.h"

- (void)enterValue1:(NSString *)value;
- (void)enterValue2:(NSString *)value;
- (void)setOperation:(NSString *)operation;
- (void)enterValue1:(NSString *)value1 value2:(NSString *)value2 operation:(NSString *)operation;
- (void)waitForResult:(NSString *)result;

@end

@implementation KIFUITestActor (BasicCalculator)

- (void)enterValue1:(NSString *)value
{
[self clearTextFromAndThenEnterText:value intoViewWithAccessibilityLabel:@"First Number"];
}

- (void)enterValue2:(NSString *)value
{
[self clearTextFromAndThenEnterText:value intoViewWithAccessibilityLabel:@"Second Number"];
}

- (void)setOperation:(NSString *)operation
{
[self tapViewWithAccessibilityLabel:operation];
}

- (void)enterValue1:(NSString *)value1 value2:(NSString *)value2 operation:(NSString *)operation
{
[self enterValue1:value1];
[self enterValue2:value2];
[self setOperation:operation];
}

- (void)waitForResult:(NSString *)result
{
[self waitForViewWithAccessibilityLabel:result];
}

@end

@interface BasicCalculatorTests : KIFTestCase
@end


@implementation BasicCalculatorTests

- (void)beforeAll
{
// Run the test animations super fast!!!
UIApplication.sharedApplication.animationSpeed = 4.0;
KIFTypist.keystrokeDelay = 0.0025f;
KIFTestActor.defaultAnimationStabilizationTimeout = 0.1;
KIFTestActor.defaultAnimationWaitingTimeout = 2.0;

[tester tapViewWithAccessibilityLabel:@"Basic Calculator" traits:UIAccessibilityTraitButton];
}

Expand Down Expand Up @@ -95,4 +64,4 @@ - (void)testToFail
NSLog(@"This line never executes.");
}

@end
@end
@@ -0,0 +1,16 @@
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. licenses this file to you.

#import <KIF/KIF.h>


@interface KIFUITestActor (BasicCalculator)

- (void)enterValue1:(NSString *)value;
- (void)enterValue2:(NSString *)value;
- (void)setOperation:(NSString *)operation;
- (void)enterValue1:(NSString *)value1 value2:(NSString *)value2 operation:(NSString *)operation;
- (void)waitForResult:(NSString *)result;

@end
@@ -0,0 +1,37 @@
// Licensed to Square, Inc. under one or more contributor license agreements.
// See the LICENSE file distributed with this work for the terms under
// which Square, Inc. licenses this file to you.

#import "KIFUITestActor+BasicCalculator.h"


@implementation KIFUITestActor (BasicCalculator)

- (void)enterValue1:(NSString *)value
{
[self clearTextFromAndThenEnterText:value intoViewWithAccessibilityLabel:@"First Number"];
}

- (void)enterValue2:(NSString *)value
{
[self clearTextFromAndThenEnterText:value intoViewWithAccessibilityLabel:@"Second Number"];
}

- (void)setOperation:(NSString *)operation
{
[self tapViewWithAccessibilityLabel:operation];
}

- (void)enterValue1:(NSString *)value1 value2:(NSString *)value2 operation:(NSString *)operation
{
[self enterValue1:value1];
[self enterValue2:value2];
[self setOperation:operation];
}

- (void)waitForResult:(NSString *)result
{
[self waitForViewWithAccessibilityLabel:result];
}

@end

0 comments on commit 5789786

Please sign in to comment.