xcfit 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/BaseScreen.swift +33 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/CommonStepDefinitions.swift +84 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Extensions.swift +50 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreen.swift +17 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreenSteps.swift +21 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Hooks.swift +19 -0
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +54 -25
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +2 -0
- data/XCFit_Templates/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -11
- data/lib/XCFit/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c89ff1ffec4a0475ce949d429f2c9f745ce6637
|
4
|
+
data.tar.gz: 7093bdc9feba7d5081ef6d66b69bde9c1c633f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f4a0fed86b7541ad9c41a125f60c803d60906cad8668233026cb7ff2f87d41791aa6f098e1ded4bdd79df7f9faefc0b1d2b03e981abeae3671a97029e5c9e7d
|
7
|
+
data.tar.gz: b11be63dfbcdde4ea9dd65d665f70ba90533163ce48d5addf3f33973567d8d418aa85377a811960f56f313056a4a9f92ec0147b4e4ff53d43a4677f3858e27bc
|
@@ -0,0 +1,33 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
import XCTest
|
8
|
+
import Foundation
|
9
|
+
|
10
|
+
class BaseScreen: XCTestCase {
|
11
|
+
|
12
|
+
func waitAndTap(element: XCUIElement) {
|
13
|
+
|
14
|
+
let exists = NSPredicate(format: "exists == true")
|
15
|
+
|
16
|
+
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
17
|
+
self.waitForExpectations(timeout: 10, handler: nil)
|
18
|
+
|
19
|
+
element.tap()
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
func waitForExist(element: XCUIElement) {
|
25
|
+
|
26
|
+
let exists = NSPredicate(format: "exists == true")
|
27
|
+
|
28
|
+
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
29
|
+
self.waitForExpectations(timeout: 10, handler: nil)
|
30
|
+
XCTAssert(element.exists)
|
31
|
+
|
32
|
+
}
|
33
|
+
}
|
data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/CommonStepDefinitions.swift
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
//
|
2
|
+
// CommonStepDefinitions.swift
|
3
|
+
// Originally Created Ahmed Ali [ Cucumberish] and re-written by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
//
|
7
|
+
|
8
|
+
import XCTest
|
9
|
+
|
10
|
+
class CommonStepDefinitions: NSObject {
|
11
|
+
|
12
|
+
fileprivate var application : XCUIApplication!
|
13
|
+
|
14
|
+
fileprivate func elementByLabel(_ label : String, type: String) -> XCUIElement
|
15
|
+
{
|
16
|
+
var elementQurey : XCUIElementQuery!
|
17
|
+
switch(type){
|
18
|
+
case "button":
|
19
|
+
elementQurey = application.buttons
|
20
|
+
case "label":
|
21
|
+
elementQurey = application.staticTexts
|
22
|
+
case "tab":
|
23
|
+
elementQurey = application.tabs
|
24
|
+
case "field", "text field":
|
25
|
+
elementQurey = application.textFields
|
26
|
+
case "textView", "text view":
|
27
|
+
elementQurey = application.textViews
|
28
|
+
case "view":
|
29
|
+
elementQurey = application.otherElements
|
30
|
+
default: elementQurey = application.otherElements
|
31
|
+
}
|
32
|
+
return elementQurey[label]
|
33
|
+
}
|
34
|
+
|
35
|
+
fileprivate func setup(_ application: XCUIApplication)
|
36
|
+
{
|
37
|
+
self.application = application
|
38
|
+
//And/When/Then/But I tap the "Header" view
|
39
|
+
MatchAll("^I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view|field|textView)$") { (args, userInfo) -> Void in
|
40
|
+
let label = args?[0]
|
41
|
+
let type = args?[1]
|
42
|
+
self.elementByLabel(label!, type: type!).tap()
|
43
|
+
}
|
44
|
+
|
45
|
+
//And/When/Then/But I tap the "Increment" button 5 times
|
46
|
+
MatchAll("^I tap (?:the )?\"([^\\\"]*)\" (button|label|tab|view) ([1-9]{1}) time(?:s)?$") { (args, userInfo) -> Void in
|
47
|
+
let label = args?[0]
|
48
|
+
let type = args?[1]
|
49
|
+
let times = NSString(string: (args?[2])!).integerValue
|
50
|
+
let element = self.elementByLabel(label!, type: type!)
|
51
|
+
for _ in 0 ..< times{
|
52
|
+
element.tap()
|
53
|
+
}
|
54
|
+
}
|
55
|
+
// Then I write "Ahmed Ali" into the "Name" field
|
56
|
+
|
57
|
+
//When/And/But/When I write "Ahmed" in the "Name" field
|
58
|
+
MatchAll("^I write \"([^\\\"]*)\" (?:into|in) (?:the )?\"([^\\\"]*)\" (field|text view)$") { (args, userInfo) -> Void in
|
59
|
+
let type = args?[2]
|
60
|
+
let label = args?[1]
|
61
|
+
let element = self.elementByLabel(label!, type: type!)
|
62
|
+
element.tap()
|
63
|
+
element.typeText((args?[0])!)
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
MatchAll("^I switch (on|off) the \"([^\\\"]*)\" switch$") { (args, userInfo) -> Void in
|
68
|
+
let theSwitch = application.switches[(args?[1])!]
|
69
|
+
let currentValu = NSString(string: theSwitch.value as! String).integerValue
|
70
|
+
let newValue = args?[0] == "on" ? 1 : 0
|
71
|
+
if(currentValu != newValue){
|
72
|
+
theSwitch.tap()
|
73
|
+
}
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
}
|
79
|
+
|
80
|
+
class func setup(_ application: XCUIApplication)
|
81
|
+
{
|
82
|
+
CommonStepDefinitions().setup(application)
|
83
|
+
}
|
84
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
//
|
2
|
+
// Extensions.swift
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
//
|
7
|
+
|
8
|
+
import Foundation
|
9
|
+
import XCTest
|
10
|
+
|
11
|
+
extension XCUIElement {
|
12
|
+
|
13
|
+
public func tapOnceVisible(testCase: XCTestCase,
|
14
|
+
file: String = #file, line: UInt = #line) {
|
15
|
+
let existsPredicate = NSPredicate(format: "exists == true")
|
16
|
+
|
17
|
+
|
18
|
+
testCase.expectation(for: existsPredicate,
|
19
|
+
evaluatedWith: self, handler: nil)
|
20
|
+
|
21
|
+
testCase.waitForExpectations(timeout: 20) { (error) -> Void in
|
22
|
+
if (error != nil) {
|
23
|
+
let message = "Failed to find \(self) after 20 seconds."
|
24
|
+
testCase.recordFailure(withDescription: message,
|
25
|
+
inFile: file, atLine: line, expected: true)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
self.tap()
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
extension XCTestCase {
|
36
|
+
func waitForElementToAppear(element: XCUIElement,
|
37
|
+
file: String = #file, line: UInt = #line) {
|
38
|
+
let existsPredicate = NSPredicate(format: "exists == true")
|
39
|
+
expectation(for: existsPredicate,
|
40
|
+
evaluatedWith: element, handler: nil)
|
41
|
+
|
42
|
+
waitForExpectations(timeout: 20) { (error) -> Void in
|
43
|
+
if (error != nil) {
|
44
|
+
let message = "Failed to find \(element) after 5 seconds."
|
45
|
+
self.recordFailure(withDescription: message,
|
46
|
+
inFile: file, atLine: line, expected: true)
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
import Foundation
|
8
|
+
import XCTest
|
9
|
+
|
10
|
+
|
11
|
+
class HomeScreen: BaseScreen {
|
12
|
+
|
13
|
+
// You can add locators and functions of homeScreen here
|
14
|
+
|
15
|
+
let crappyButtuon = XCUIApplication().buttons["I am really useless button"]
|
16
|
+
|
17
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
import Foundation
|
8
|
+
import XCTest
|
9
|
+
|
10
|
+
class HomeScreenSteps: BaseScreen {
|
11
|
+
|
12
|
+
func HomeScreenSteps() {
|
13
|
+
|
14
|
+
MatchAll("I tap on crappy button") { (args, userInfo) -> Void in
|
15
|
+
|
16
|
+
//self.waitAndTap(HomeScreen().crappyButton)
|
17
|
+
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//
|
2
|
+
//
|
3
|
+
// Created by XCFit Framework
|
4
|
+
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
import Foundation
|
8
|
+
import XCTest
|
9
|
+
class Hooks: NSObject {
|
10
|
+
class func CustomHooks()
|
11
|
+
{
|
12
|
+
var application : XCUIApplication!
|
13
|
+
//A closure that will be executed just before executing any of your features
|
14
|
+
beforeStart { () -> Void in
|
15
|
+
application = XCUIApplication()
|
16
|
+
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
@@ -55,6 +55,12 @@
|
|
55
55
|
</array>
|
56
56
|
<key>Nodes</key>
|
57
57
|
<array>
|
58
|
+
<string>HomeScreen.swift</string>
|
59
|
+
<string>BaseScreen.swift</string>
|
60
|
+
<string>HomeScreenSteps.swift</string>
|
61
|
+
<string>Hooks.swift</string>
|
62
|
+
<string>Extensions.swift</string>
|
63
|
+
<string>CommonStepDefinitions.swift</string>
|
58
64
|
<string>Info.plist:PackageType</string>
|
59
65
|
<string>___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h</string>
|
60
66
|
<string>___PACKAGENAMEASIDENTIFIER___.h</string>
|
@@ -63,6 +69,48 @@
|
|
63
69
|
</array>
|
64
70
|
<key>Definitions</key>
|
65
71
|
<dict>
|
72
|
+
<key>HomeScreen.swift</key>
|
73
|
+
<dict>
|
74
|
+
<key>Path</key>
|
75
|
+
<string>HomeScreen.swift</string>
|
76
|
+
<key>Group</key>
|
77
|
+
<string>Screens</string>
|
78
|
+
</dict>
|
79
|
+
<key>BaseScreen.swift</key>
|
80
|
+
<dict>
|
81
|
+
<key>Path</key>
|
82
|
+
<string>BaseScreen.swift</string>
|
83
|
+
<key>Group</key>
|
84
|
+
<string>Screens</string>
|
85
|
+
</dict>
|
86
|
+
<key>HomeScreenSteps.swift</key>
|
87
|
+
<dict>
|
88
|
+
<key>Path</key>
|
89
|
+
<string>HomeScreenSteps.swift</string>
|
90
|
+
<key>Group</key>
|
91
|
+
<string>Step Definitions</string>
|
92
|
+
</dict>
|
93
|
+
<key>Hooks.swift</key>
|
94
|
+
<dict>
|
95
|
+
<key>Path</key>
|
96
|
+
<string>Hooks.swift</string>
|
97
|
+
<key>Group</key>
|
98
|
+
<string>Common</string>
|
99
|
+
</dict>
|
100
|
+
<key>Extensions.swift</key>
|
101
|
+
<dict>
|
102
|
+
<key>Path</key>
|
103
|
+
<string>Extensions.swift</string>
|
104
|
+
<key>Group</key>
|
105
|
+
<string>Common</string>
|
106
|
+
</dict>
|
107
|
+
<key>CommonStepDefinitions.swift</key>
|
108
|
+
<dict>
|
109
|
+
<key>Path</key>
|
110
|
+
<string>CommonStepDefinitions.swift</string>
|
111
|
+
<key>Group</key>
|
112
|
+
<string>Common</string>
|
113
|
+
</dict>
|
66
114
|
<key>Info.plist:PackageType</key>
|
67
115
|
<string><key>CFBundlePackageType</key>
|
68
116
|
<string>BNDL</string>
|
@@ -71,6 +119,8 @@
|
|
71
119
|
<dict>
|
72
120
|
<key>Path</key>
|
73
121
|
<string>___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h</string>
|
122
|
+
<key>Group</key>
|
123
|
+
<string>Supporting Files</string>
|
74
124
|
</dict>
|
75
125
|
<key>___PACKAGENAMEASIDENTIFIER___.swift</key>
|
76
126
|
<dict>
|
@@ -81,37 +131,16 @@
|
|
81
131
|
<dict>
|
82
132
|
<key>Path</key>
|
83
133
|
<string>___PACKAGENAMEASIDENTIFIER___.m</string>
|
134
|
+
<key>Group</key>
|
135
|
+
<string>Supporting Files</string>
|
84
136
|
</dict>
|
85
137
|
<key>___PACKAGENAMEASIDENTIFIER___.h</key>
|
86
138
|
<dict>
|
87
139
|
<key>Path</key>
|
88
140
|
<string>___PACKAGENAMEASIDENTIFIER___.h</string>
|
141
|
+
<key>Group</key>
|
142
|
+
<string>Supporting Files</string>
|
89
143
|
</dict>
|
90
144
|
</dict>
|
91
|
-
<key>Options</key>
|
92
|
-
<array>
|
93
|
-
<dict>
|
94
|
-
<key>Identifier</key>
|
95
|
-
<string>languageChoice</string>
|
96
|
-
<key>Units</key>
|
97
|
-
<dict>
|
98
|
-
<key>Swift</key>
|
99
|
-
<dict>
|
100
|
-
<key>Nodes</key>
|
101
|
-
<array>
|
102
|
-
<string>___PACKAGENAMEASIDENTIFIER___.swift</string>
|
103
|
-
</array>
|
104
|
-
<key>Definitions</key>
|
105
|
-
<dict>
|
106
|
-
<key>___PACKAGENAMEASIDENTIFIER___.swift</key>
|
107
|
-
<dict>
|
108
|
-
<key>Path</key>
|
109
|
-
<string>___PACKAGENAMEASIDENTIFIER___.swift</string>
|
110
|
-
</dict>
|
111
|
-
</dict>
|
112
|
-
</dict>
|
113
|
-
</dict>
|
114
|
-
</dict>
|
115
|
-
</array>
|
116
145
|
</dict>
|
117
146
|
</plist>
|
@@ -13,6 +13,8 @@ class ___PACKAGENAMEASIDENTIFIER___: NSObject {
|
|
13
13
|
//A closure that will be executed just before executing any of your features
|
14
14
|
beforeStart { () -> Void in
|
15
15
|
application = XCUIApplication()
|
16
|
+
CommonStepDefinitions.setup(application);
|
17
|
+
HomeScreenSteps().HomeScreenSteps()
|
16
18
|
}
|
17
19
|
//A Given step definition
|
18
20
|
Given("the app is running") { (args, userInfo) -> Void in
|
@@ -24,16 +24,5 @@
|
|
24
24
|
<string>com.apple.dt.cocoaUITestBundleTarget</string>
|
25
25
|
</dict>
|
26
26
|
</array>
|
27
|
-
<key>OptionConstraints</key>
|
28
|
-
<array>
|
29
|
-
<dict>
|
30
|
-
<key>Identifier</key>
|
31
|
-
<string>productName</string>
|
32
|
-
<key>ConstraintType</key>
|
33
|
-
<string>DefaultIfAssociatedTarget</string>
|
34
|
-
<key>Value</key>
|
35
|
-
<string>___ASSOCIATEDTARGET_bundleName___UITests</string>
|
36
|
-
</dict>
|
37
|
-
</array>
|
38
27
|
</dict>
|
39
28
|
</plist>
|
data/lib/XCFit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcfit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shashikant86
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -128,6 +128,12 @@ files:
|
|
128
128
|
- XCFit_Templates/XCFit/Base Acceptance Tests.xctemplate/TemplateInfo.plist
|
129
129
|
- XCFit_Templates/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h
|
130
130
|
- XCFit_Templates/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___.m
|
131
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/BaseScreen.swift
|
132
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/CommonStepDefinitions.swift
|
133
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Extensions.swift
|
134
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreen.swift
|
135
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreenSteps.swift
|
136
|
+
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Hooks.swift
|
131
137
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon.png
|
132
138
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon@2x.png
|
133
139
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist
|