xcfit 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/Pre-Defined_Steps/Cucumberish_Predefined_Steps.md +12 -0
  4. data/Pre-Defined_Steps/XCFit_Predefined_Steps.md +49 -0
  5. data/README.md +53 -31
  6. data/XCFit.podspec +1 -1
  7. data/XCFit4Demo/Cartfile +1 -0
  8. data/XCFit4Demo/Cartfile.resolved +2 -0
  9. data/XCFit4Demo/XCFit4Demo.xcodeproj/project.pbxproj +864 -0
  10. data/XCFit4Demo/XCFit4Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  11. data/XCFit4Demo/XCFit4Demo/AppDelegate.swift +46 -0
  12. data/XCFit4Demo/XCFit4Demo/Assets.xcassets/AppIcon.appiconset/Contents.json +38 -0
  13. data/XCFit4Demo/XCFit4Demo/Base.lproj/LaunchScreen.storyboard +27 -0
  14. data/XCFit4Demo/XCFit4Demo/Base.lproj/Main.storyboard +53 -0
  15. data/XCFit4Demo/XCFit4Demo/Info.plist +38 -0
  16. data/XCFit4Demo/XCFit4Demo/ViewController.swift +33 -0
  17. data/XCFit4Demo/XCFit4DemoCucumberTests/BaseScreen.swift +21 -0
  18. data/XCFit4Demo/XCFit4DemoCucumberTests/CommonStepDefinitions.swift +89 -0
  19. data/XCFit4Demo/XCFit4DemoCucumberTests/Extensions.swift +57 -0
  20. data/XCFit4Demo/XCFit4DemoCucumberTests/Features/demo.feature +8 -0
  21. data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreen.swift +24 -0
  22. data/XCFit4Demo/XCFit4DemoCucumberTests/HomeScreenSteps.swift +29 -0
  23. data/XCFit4Demo/XCFit4DemoCucumberTests/Hooks.swift +27 -0
  24. data/XCFit4Demo/XCFit4DemoCucumberTests/Info.plist +22 -0
  25. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests-Bridging-Header.h +17 -0
  26. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.h +22 -0
  27. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.m +27 -0
  28. data/XCFit4Demo/XCFit4DemoCucumberTests/XCFit4DemoCucumberTests.swift +39 -0
  29. data/XCFit4Demo/XCFit4DemoTests/Info.plist +22 -0
  30. data/XCFit4Demo/XCFit4DemoTests/XCFit4DemoTests.swift +36 -0
  31. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Extensions.swift +60 -0
  32. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreen.swift +23 -0
  33. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/HomeScreenTest.swift +28 -0
  34. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/Info.plist +22 -0
  35. data/XCFit4Demo/XCFit4DemoXCUIPoMTests/XCFit4DemoXCUIPoMTestsTestBase.swift +36 -0
  36. data/homebrew/xcfit +1 -1
  37. data/lib/XCFit/version.rb +1 -1
  38. metadata +33 -6
  39. data/Docs/InitialVersion.md +0 -340
  40. data/Docs/README_XCFit2.md +0 -572
  41. data/Docs/Xcode7.md +0 -273
  42. data/Docs/xcdoe7swift2.md +0 -311
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:XCFit4Demo.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,46 @@
1
+ //
2
+ // AppDelegate.swift
3
+ // XCFit4Demo
4
+ //
5
+ // Created by Shashikant Jagtap on 11/02/2017.
6
+ // Copyright © 2017 Shashikant Jagtap. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+
11
+ @UIApplicationMain
12
+ class AppDelegate: UIResponder, UIApplicationDelegate {
13
+
14
+ var window: UIWindow?
15
+
16
+
17
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18
+ // Override point for customization after application launch.
19
+ return true
20
+ }
21
+
22
+ func applicationWillResignActive(_ application: UIApplication) {
23
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24
+ // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25
+ }
26
+
27
+ func applicationDidEnterBackground(_ application: UIApplication) {
28
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30
+ }
31
+
32
+ func applicationWillEnterForeground(_ application: UIApplication) {
33
+ // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34
+ }
35
+
36
+ func applicationDidBecomeActive(_ application: UIApplication) {
37
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38
+ }
39
+
40
+ func applicationWillTerminate(_ application: UIApplication) {
41
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42
+ }
43
+
44
+
45
+ }
46
+
@@ -0,0 +1,38 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "iphone",
5
+ "size" : "29x29",
6
+ "scale" : "2x"
7
+ },
8
+ {
9
+ "idiom" : "iphone",
10
+ "size" : "29x29",
11
+ "scale" : "3x"
12
+ },
13
+ {
14
+ "idiom" : "iphone",
15
+ "size" : "40x40",
16
+ "scale" : "2x"
17
+ },
18
+ {
19
+ "idiom" : "iphone",
20
+ "size" : "40x40",
21
+ "scale" : "3x"
22
+ },
23
+ {
24
+ "idiom" : "iphone",
25
+ "size" : "60x60",
26
+ "scale" : "2x"
27
+ },
28
+ {
29
+ "idiom" : "iphone",
30
+ "size" : "60x60",
31
+ "scale" : "3x"
32
+ }
33
+ ],
34
+ "info" : {
35
+ "version" : 1,
36
+ "author" : "xcode"
37
+ }
38
+ }
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
5
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
6
+ </dependencies>
7
+ <scenes>
8
+ <!--View Controller-->
9
+ <scene sceneID="EHf-IW-A2E">
10
+ <objects>
11
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
12
+ <layoutGuides>
13
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
14
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
15
+ </layoutGuides>
16
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
17
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
18
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
20
+ </view>
21
+ </viewController>
22
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
23
+ </objects>
24
+ <point key="canvasLocation" x="53" y="375"/>
25
+ </scene>
26
+ </scenes>
27
+ </document>
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12106.1" systemVersion="16C68" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3
+ <device id="retina4_7" orientation="portrait">
4
+ <adaptation id="fullscreen"/>
5
+ </device>
6
+ <dependencies>
7
+ <deployment identifier="iOS"/>
8
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12074.1"/>
9
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10
+ </dependencies>
11
+ <scenes>
12
+ <!--View Controller-->
13
+ <scene sceneID="tne-QT-ifu">
14
+ <objects>
15
+ <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="XCFit4Demo" customModuleProvider="target" sceneMemberID="viewController">
16
+ <layoutGuides>
17
+ <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
18
+ <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
19
+ </layoutGuides>
20
+ <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
21
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
22
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23
+ <subviews>
24
+ <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XUv-Ck-Fmr">
25
+ <rect key="frame" x="51" y="318" width="186" height="30"/>
26
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
27
+ <accessibility key="accessibilityConfiguration" hint="Click" identifier="Click" label="Click"/>
28
+ <state key="normal" title="Click Me"/>
29
+ <connections>
30
+ <action selector="ClickMeButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="lWJ-VB-jXa"/>
31
+ </connections>
32
+ </button>
33
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="5UX-c6-Hel">
34
+ <rect key="frame" x="23" y="390" width="243" height="30"/>
35
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
36
+ <accessibility key="accessibilityConfiguration" hint="Welcome" identifier="Welcome" label="Welcome"/>
37
+ <nil key="textColor"/>
38
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
39
+ <textInputTraits key="textInputTraits"/>
40
+ </textField>
41
+ </subviews>
42
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
43
+ </view>
44
+ <connections>
45
+ <outlet property="WelcomeTextField" destination="5UX-c6-Hel" id="yc7-N1-90X"/>
46
+ </connections>
47
+ </viewController>
48
+ <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
49
+ </objects>
50
+ <point key="canvasLocation" x="136.80000000000001" y="138.98050974512745"/>
51
+ </scene>
52
+ </scenes>
53
+ </document>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>APPL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>1</string>
21
+ <key>LSRequiresIPhoneOS</key>
22
+ <true/>
23
+ <key>UILaunchStoryboardName</key>
24
+ <string>LaunchScreen</string>
25
+ <key>UIMainStoryboardFile</key>
26
+ <string>Main</string>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ <string>UIInterfaceOrientationLandscapeLeft</string>
35
+ <string>UIInterfaceOrientationLandscapeRight</string>
36
+ </array>
37
+ </dict>
38
+ </plist>
@@ -0,0 +1,33 @@
1
+ //
2
+ // ViewController.swift
3
+ // XCFit4Demo
4
+ //
5
+ // Created by Shashikant Jagtap on 11/02/2017.
6
+ // Copyright © 2017 Shashikant Jagtap. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+
11
+ class ViewController: UIViewController {
12
+
13
+ @IBAction func ClickMeButton(_ sender: Any) {
14
+
15
+ WelcomeTextField.text = "HELLO XCFIT"
16
+ }
17
+
18
+
19
+ @IBOutlet weak var WelcomeTextField: UITextField!
20
+
21
+ override func viewDidLoad() {
22
+ super.viewDidLoad()
23
+ // Do any additional setup after loading the view, typically from a nib.
24
+ }
25
+
26
+ override func didReceiveMemoryWarning() {
27
+ super.didReceiveMemoryWarning()
28
+ // Dispose of any resources that can be recreated.
29
+ }
30
+
31
+
32
+ }
33
+
@@ -0,0 +1,21 @@
1
+ //
2
+ //
3
+ // Created by XCFit Framework
4
+ // Copyright © 2016 XCFit Framework. All rights reserved.
5
+ //
6
+
7
+ /*
8
+ This is sample code created by XCFit Framework and can be edited/Removed as needed.
9
+
10
+ This assumes that your apps is made up of multiple screens. All the common varibales, functions, related to screens can be put here. This class will be perent class of your individual screen.
11
+
12
+ */
13
+
14
+ import XCTest
15
+ import Foundation
16
+
17
+ class BaseScreen: XCTestCase {
18
+
19
+ // Add your own methods to base screen class e.g
20
+
21
+ }
@@ -0,0 +1,89 @@
1
+ //
2
+ // CommonStepDefinitions.swift
3
+ // Copyright © 2016 XCFit Framework. All rights reserved.
4
+ //
5
+ //
6
+
7
+ /*
8
+ This is sample code created by XCFit Framework and can be edited/Removed as needed.
9
+
10
+ This class has some mostly used step definitions included here. You can add some more here if needed.
11
+
12
+ */
13
+
14
+ import XCTest
15
+ import Cucumberish
16
+
17
+ class CommonStepDefinitions: NSObject {
18
+
19
+ fileprivate var application : XCUIApplication!
20
+
21
+ fileprivate func elementByLabel(_ label : String, type: String) -> XCUIElement
22
+ {
23
+ var elementQurey : XCUIElementQuery!
24
+ switch(type){
25
+ case "button":
26
+ elementQurey = application.buttons
27
+ case "label":
28
+ elementQurey = application.staticTexts
29
+ case "tab":
30
+ elementQurey = application.tabs
31
+ case "field", "text field":
32
+ elementQurey = application.textFields
33
+ case "textView", "text view":
34
+ elementQurey = application.textViews
35
+ case "view":
36
+ elementQurey = application.otherElements
37
+ default: elementQurey = application.otherElements
38
+ }
39
+ return elementQurey[label]
40
+ }
41
+
42
+ fileprivate func setup(_ application: XCUIApplication)
43
+ {
44
+ self.application = application
45
+ //And/When/Then/But I tap the "Header" view
46
+ MatchAll("^I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view|field|textView)$") { (args, userInfo) -> Void in
47
+ let label = args?[0]
48
+ let type = args?[1]
49
+ self.elementByLabel(label!, type: type!).tap()
50
+ }
51
+
52
+ //And/When/Then/But I tap the "Increment" button 5 times
53
+ MatchAll("^I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view) ([1-9]{1}) time(?:s)?$") { (args, userInfo) -> Void in
54
+ let label = args?[0]
55
+ let type = args?[1]
56
+ let times = NSString(string: (args?[2])!).integerValue
57
+ let element = self.elementByLabel(label!, type: type!)
58
+ for _ in 0 ..< times{
59
+ element.tap()
60
+ }
61
+ }
62
+
63
+ //When/And/But/When I write "London" in the "City" field
64
+ MatchAll("^I write \"([^\\\"]*)\" (?:into|in) (?:the )?\"([^\\\"]*)\" (field|text view)$") { (args, userInfo) -> Void in
65
+ let type = args?[2]
66
+ let label = args?[1]
67
+ let element = self.elementByLabel(label!, type: type!)
68
+ element.tap()
69
+ element.typeText((args?[0])!)
70
+ }
71
+
72
+
73
+ MatchAll("^I switch (on|off) the \"([^\\\"]*)\" switch$") { (args, userInfo) -> Void in
74
+ let theSwitch = application.switches[(args?[1])!]
75
+ let currentValu = NSString(string: theSwitch.value as! String).integerValue
76
+ let newValue = args?[0] == "on" ? 1 : 0
77
+ if(currentValu != newValue){
78
+ theSwitch.tap()
79
+ }
80
+
81
+ }
82
+
83
+ }
84
+
85
+ class func setup(_ application: XCUIApplication)
86
+ {
87
+ CommonStepDefinitions().setup(application)
88
+ }
89
+ }
@@ -0,0 +1,57 @@
1
+ //
2
+ // Extensions.swift
3
+ // Created by XCFit Framework
4
+ // Copyright © 2016 XCFit Framework. All rights reserved.
5
+ //
6
+ //
7
+
8
+ /*
9
+ This is sample code created by XCFit Framework and can be edited/Removed as needed.
10
+
11
+ This file can take all the Swift extensions build around XCUI Test Frameworks which can be directly used in the tests, page objects. Here are sample extensions on XCUIElement and XCTestCase.
12
+
13
+ */
14
+
15
+ import Foundation
16
+ import XCTest
17
+
18
+ extension XCUIElement {
19
+
20
+ public func tapOnceVisible(testCase: XCTestCase,
21
+ file: String = #file, line: UInt = #line) {
22
+ let existsPredicate = NSPredicate(format: "exists == true")
23
+
24
+
25
+ testCase.expectation(for: existsPredicate,
26
+ evaluatedWith: self, handler: nil)
27
+
28
+ testCase.waitForExpectations(timeout: 20) { (error) -> Void in
29
+ if (error != nil) {
30
+ let message = "Failed to find \(self) after 20 seconds."
31
+ testCase.recordFailure(withDescription: message,
32
+ inFile: file, atLine: line, expected: true)
33
+ }
34
+ }
35
+
36
+ self.tap()
37
+ }
38
+
39
+
40
+ }
41
+
42
+ extension XCTestCase {
43
+ func waitForElementToAppear(element: XCUIElement,
44
+ file: String = #file, line: UInt = #line) {
45
+ let existsPredicate = NSPredicate(format: "exists == true")
46
+ expectation(for: existsPredicate,
47
+ evaluatedWith: element, handler: nil)
48
+
49
+ waitForExpectations(timeout: 20) { (error) -> Void in
50
+ if (error != nil) {
51
+ let message = "Failed to find \(element) after 5 seconds."
52
+ self.recordFailure(withDescription: message,
53
+ inFile: file, atLine: line, expected: true)
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,8 @@
1
+ Feature: Test
2
+
3
+ Scenario: Test
4
+
5
+ Given the app is running
6
+ When I tap the "Click" button
7
+
8
+
@@ -0,0 +1,24 @@
1
+ //
2
+ //
3
+ // Created by XCFit Framework
4
+ // Copyright © 2016 XCFit Framework. All rights reserved.
5
+ //
6
+
7
+ /*
8
+
9
+ This is sample code created by XCFit Framework and can be edited/Removed as needed.
10
+
11
+ This assumes that your apps is made up of multiple screens. You can write individual screen class which extend BaseScreen. All the functionality related to screen can be included in this class.
12
+ */
13
+
14
+ import Foundation
15
+ import XCTest
16
+
17
+
18
+ class HomeScreen: BaseScreen {
19
+
20
+ // You can add locators and functions of homeScreen here
21
+
22
+ let homeButtuon = XCUIApplication().buttons["Home"]
23
+
24
+ }