xcfit 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -25
- data/XCFit.podspec +1 -1
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/BaseScreen.swift +2 -24
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/CommonStepDefinitions.swift +2 -6
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Extensions.swift +1 -2
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreen.swift +3 -3
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/HomeScreenSteps.swift +2 -2
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/Hooks.swift +1 -1
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +2 -2
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +4 -5
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +5 -6
- data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +2 -2
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift +11 -11
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeScreen.swift +6 -8
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeScreenTest.swift +7 -12
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/TemplateInfo.plist +1 -33
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___TestBase.swift +10 -8
- data/XCFit_Templates/XCFit/iOS XCUI POM Test Bundle.xctemplate/TemplateInfo.plist +1 -1
- data/homebrew/xcfit +4 -4
- data/lib/XCFit/version.rb +1 -1
- metadata +2 -6
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/BaseScreen.swift +0 -42
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeElements.swift +0 -31
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeProtocol.swift +0 -25
- data/XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/ProtocolOrientedTest.swift +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5ee1806f0c5fb1f83224761e21db5919f0f024
|
4
|
+
data.tar.gz: 55584b6b9ed25b0ef3d2115b89b8b5084804174f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1eb656fc56a7e8da5cbb314182b2fedf9d8f6225aa608452008ef50bd330966cef3902384739931dcecb1a1527f2ce5f751cd2decfca36be09c95283763fc54
|
7
|
+
data.tar.gz: a0f42886f4a8aa2a5f460e4b5c1296847e157a0f3ccf0343bb29d5b17fec05397dc26119eff827e89a094d04495881958419bae64488a4adf60adc881276e95a
|
data/README.md
CHANGED
@@ -7,9 +7,8 @@
|
|
7
7
|
|
8
8
|
**XCFit a.k.a ([XCUI](https://developer.apple.com/videos/play/wwdc2015/406/0), [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish) and [Fitnesse](https://github.com/paulstringer/OCSlimProject) Integrations Tests) is a full stack Xcode BDD framework for [Swift](https://swift.org) iOS and macOS apps. XCFit allows us to write API level, UI and Acceptance Tests with Swift in human readable language using tools like [Cucumber](https://cucumber.io/) and [Fitnesse](http://fitnesse.org/) in Xcode. We can still use Apple's brand new UI Testing framework (XCUI) under the hood of Cucumberish. XCFit is fully automated solution for Cucumberish and Fitnesse. You can use 80(Fitnesse):20(Cucumberish) formula to automate Acceptance and UI Testing for better coverage and faster feedback. XCFit is available on [Homebrew](http://brew.sh), [RubyGem](https://rubygems.org/gems/xcfit), [CocoaPods](http://cocoadocs.org/docsets/XCFit) and Swift Package Manager.**
|
9
9
|
|
10
|
-
### XCFit
|
10
|
+
### XCFit
|
11
11
|
|
12
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFit2Release.png)
|
13
12
|
|
14
13
|
* [XCFit : Full Stack BDD in Xcode](#xcfit--full-stack-bdd-in-xcode)
|
15
14
|
* [XCFit Features](#xcfit-features)
|
@@ -134,6 +133,7 @@ setup_xcode_templates:
|
|
134
133
|
## Install XCFit Cocoapod and Swift Package (Covered later)
|
135
134
|
|
136
135
|
Later, we need to install [XCFit](http://cocoadocs.org/docsets/XCFit) from CocoaPods to enable Cucumberish and Fitnesse test. We can also get XCFit from Swift Package Manager if we need to have additional helpers for the XCUI test framework.
|
136
|
+
Swift Packages only supports other Swift Packages.
|
137
137
|
|
138
138
|
---
|
139
139
|
|
@@ -222,7 +222,7 @@ Here is how to do it.
|
|
222
222
|
|
223
223
|
We still don't have content of [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) to be included in our project.
|
224
224
|
|
225
|
-
### Getting Cucumberish into our Target
|
225
|
+
### Getting Cucumberish CocoaPod into our Target
|
226
226
|
|
227
227
|
In order to get [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) source content. There are few ways we can do that
|
228
228
|
|
@@ -247,9 +247,8 @@ $ pod install
|
|
247
247
|
|
248
248
|
Now close the existing Xcode session and Xcode Workspace next time.
|
249
249
|
|
250
|
-
> **Note** There is issue with Cocoapods when you have ``'use_frameworks!'``, it will not import header files and build will fail. If you are not using Frameworks in th Podfile then this approach is OK.
|
251
250
|
|
252
|
-
- **Manual Installtion**
|
251
|
+
- **Manual Installtion (not recommended use CocoaPods instaed )**
|
253
252
|
|
254
253
|
We can manually copy content of [Cucumberish](https://github.com/Ahmed-Ali/Cucumberish/tree/master/Cucumberish) directory and drag to target as with option "**Create groups" and "Copy items if needed**".
|
255
254
|
|
@@ -257,25 +256,6 @@ Here is How to setup everything in a minute
|
|
257
256
|
|
258
257
|
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/XCFitStartUp.gif)
|
259
258
|
|
260
|
-
- **Carthage**
|
261
|
-
|
262
|
-
Create a `Cartfile ` with following Content
|
263
|
-
|
264
|
-
```
|
265
|
-
github "Ahmed-Ali/Cucumberish"
|
266
|
-
```
|
267
|
-
Now run Carthage wihtout build option.
|
268
|
-
|
269
|
-
$ carthage update --platform iOS --no-build
|
270
|
-
|
271
|
-
Now in the `Carthage/Checkout` directory has `Cucumberish/Cucumberish`. drag to target as with option "**Create groups" and "Copy items if needed**".
|
272
|
-
|
273
|
-
Here is how to do that !
|
274
|
-
|
275
|
-
![image](https://github.com/Shashikant86/XCFit-GIFS/blob/master/Carthage.gif)
|
276
|
-
|
277
|
-
|
278
|
-
Please choose one of the suitable option for you.
|
279
259
|
|
280
260
|
We now have everything we needed to run demo Cucumber demo test. Update Scheme if don't want to run unit test or other type of tests.
|
281
261
|
and press 'CMD+U'
|
@@ -290,7 +270,7 @@ XCFit adds 'Cucumberish' target to existing Scheme. You can remove that target a
|
|
290
270
|
|
291
271
|
---
|
292
272
|
|
293
|
-
# XCUI Page Object Pattern
|
273
|
+
# XCUI Page Object Pattern and Pre-Defined Steps
|
294
274
|
|
295
275
|
Now, we have seen that it's failrly easy to setup BDD Style tests with Cucumberish but some people don't want that overhead of adding extra layer of Gherkin. XCFit gives an option to use very polular [Page Object Pattern](http://martinfowler.com/bliki/PageObject.html) with Apple's Xcode UI Testing framework.
|
296
276
|
|
@@ -333,6 +313,33 @@ This group has all the test for our app. Currently demo template has two tests '
|
|
333
313
|
|
334
314
|
Testbase is group where we can abstract all setup, teardown and common stuff in the base class. Every Screen then use this class as base. You can add more stuff as needed e.g Fixtures, Launch Arguments
|
335
315
|
|
316
|
+
## Using Predefined XCFit BDD Style Steps
|
317
|
+
|
318
|
+
There are some predefined XCFit steps we can use by importing `XCFit` and extending out test class to `XCFit`.
|
319
|
+
|
320
|
+
import XCTest
|
321
|
+
import XCFit
|
322
|
+
|
323
|
+
class XCFitTests: XCFit {
|
324
|
+
override func setUp() {
|
325
|
+
super.setUp()
|
326
|
+
continueAfterFailure = false
|
327
|
+
XCUIApplication().launch()
|
328
|
+
}
|
329
|
+
override func tearDown() {
|
330
|
+
super.tearDown()
|
331
|
+
}
|
332
|
+
|
333
|
+
func testExample() {
|
334
|
+
givenILaunchedApplication()
|
335
|
+
whenITap(on: HomeScreen().crappyButtuon)
|
336
|
+
thenIShouldSeeAnAlert()
|
337
|
+
}
|
338
|
+
}
|
339
|
+
`
|
340
|
+
|
341
|
+
You will get access to lots of predefined BDD style human redable steps. It's not mandatory to use those ste it
|
342
|
+
|
336
343
|
|
337
344
|
---
|
338
345
|
|
data/XCFit.podspec
CHANGED
@@ -5,8 +5,7 @@
|
|
5
5
|
//
|
6
6
|
|
7
7
|
/*
|
8
|
-
|
9
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
9
|
|
11
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.
|
12
11
|
|
@@ -17,27 +16,6 @@ import Foundation
|
|
17
16
|
|
18
17
|
class BaseScreen: XCTestCase {
|
19
18
|
|
20
|
-
// Add your own methods to base class e.g
|
21
|
-
|
22
|
-
func waitAndTap(element: XCUIElement) {
|
23
|
-
|
24
|
-
let exists = NSPredicate(format: "exists == true")
|
25
|
-
|
26
|
-
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
27
|
-
self.waitForExpectations(timeout: 10, handler: nil)
|
28
|
-
|
29
|
-
element.tap()
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
func waitForExist(element: XCUIElement) {
|
35
|
-
|
36
|
-
let exists = NSPredicate(format: "exists == true")
|
37
|
-
|
38
|
-
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
39
|
-
self.waitForExpectations(timeout: 10, handler: nil)
|
40
|
-
XCTAssert(element.exists)
|
19
|
+
// Add your own methods to base screen class e.g
|
41
20
|
|
42
|
-
}
|
43
21
|
}
|
data/XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/CommonStepDefinitions.swift
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
//
|
2
2
|
// CommonStepDefinitions.swift
|
3
|
-
// Originally Created Ahmed Ali [ Cucumberish] and re-written by XCFit Framework
|
4
3
|
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
4
|
//
|
6
5
|
//
|
7
6
|
|
8
7
|
/*
|
9
|
-
|
10
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
11
9
|
|
12
10
|
This class has some mostly used step definitions included here. You can add some more here if needed.
|
13
11
|
|
@@ -61,9 +59,8 @@ class CommonStepDefinitions: NSObject {
|
|
61
59
|
element.tap()
|
62
60
|
}
|
63
61
|
}
|
64
|
-
// Then I write "Ahmed Ali" into the "Name" field
|
65
62
|
|
66
|
-
//When/And/But/When I write "
|
63
|
+
//When/And/But/When I write "London" in the "City" field
|
67
64
|
MatchAll("^I write \"([^\\\"]*)\" (?:into|in) (?:the )?\"([^\\\"]*)\" (field|text view)$") { (args, userInfo) -> Void in
|
68
65
|
let type = args?[2]
|
69
66
|
let label = args?[1]
|
@@ -83,7 +80,6 @@ class CommonStepDefinitions: NSObject {
|
|
83
80
|
|
84
81
|
}
|
85
82
|
|
86
|
-
|
87
83
|
}
|
88
84
|
|
89
85
|
class func setup(_ application: XCUIApplication)
|
@@ -6,8 +6,7 @@
|
|
6
6
|
//
|
7
7
|
|
8
8
|
/*
|
9
|
-
|
10
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
11
10
|
|
12
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.
|
13
12
|
|
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
/*
|
8
8
|
|
9
|
-
This is sample code created by XCFit Framework and can be edited/Removed as
|
10
|
-
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
|
+
|
11
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
12
|
*/
|
13
13
|
|
@@ -19,6 +19,6 @@ class HomeScreen: BaseScreen {
|
|
19
19
|
|
20
20
|
// You can add locators and functions of homeScreen here
|
21
21
|
|
22
|
-
let
|
22
|
+
let homeButtuon = XCUIApplication().buttons["Home"]
|
23
23
|
|
24
24
|
}
|
@@ -19,9 +19,9 @@ class HomeScreenSteps: BaseScreen {
|
|
19
19
|
|
20
20
|
func HomeScreenSteps() {
|
21
21
|
|
22
|
-
MatchAll("I tap on
|
22
|
+
MatchAll("I tap on home button") { (args, userInfo) -> Void in
|
23
|
+
|
23
24
|
|
24
|
-
//self.waitAndTap(HomeScreen().crappyButton)
|
25
25
|
|
26
26
|
}
|
27
27
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
/*
|
8
8
|
|
9
|
-
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
10
|
|
11
11
|
This are preconditions or post conditions to be executed before or after each scenario
|
12
12
|
*/
|
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
/*
|
8
8
|
|
9
|
-
This is sample code created by XCFit Framework and can be edited/Removed as
|
10
|
-
|
9
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
10
|
+
|
11
11
|
This is bridging header to manage objective-C dependencies in the Swift code. We are using Cucumberish steps. You probably don't need to touch this file.
|
12
12
|
|
13
13
|
*/
|
@@ -5,11 +5,10 @@
|
|
5
5
|
//
|
6
6
|
|
7
7
|
/*
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
9
|
+
|
10
|
+
This is header file to manage objective-C dependencies in the Swift code. We are using Cucumberish steps. You probably don't need to touch this file.
|
11
|
+
|
13
12
|
*/
|
14
13
|
|
15
14
|
|
@@ -5,11 +5,10 @@
|
|
5
5
|
//
|
6
6
|
|
7
7
|
/*
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
9
|
+
|
10
|
+
This is objective-C contructor to initialise Cucumberish in our project.
|
11
|
+
|
13
12
|
*/
|
14
13
|
|
15
14
|
|
@@ -24,5 +23,5 @@ __attribute__((constructor))
|
|
24
23
|
void CucumberishInit()
|
25
24
|
{
|
26
25
|
[___PACKAGENAMEASIDENTIFIER___ CucumberishSwiftInit];
|
27
|
-
|
26
|
+
|
28
27
|
}
|
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
/*
|
9
9
|
|
10
|
-
This is sample code created by XCFit Framework and can be edited/Removed as
|
11
|
-
|
10
|
+
This is sample code created by XCFit Framework and can be edited/Removed as needed.
|
11
|
+
|
12
12
|
This is very important file as we will be using it as initialiser of all out test suite. We have to resgister all our Step Definitions in this class. e.g we have registed CommonStepDefinitions and HomeScreenSteps here
|
13
13
|
|
14
14
|
*/
|
@@ -6,11 +6,11 @@
|
|
6
6
|
//
|
7
7
|
|
8
8
|
/*
|
9
|
-
|
9
|
+
|
10
10
|
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
-
|
11
|
+
|
12
12
|
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.
|
13
|
-
|
13
|
+
|
14
14
|
*/
|
15
15
|
|
16
16
|
|
@@ -19,15 +19,15 @@ import Foundation
|
|
19
19
|
import XCTest
|
20
20
|
|
21
21
|
extension XCUIElement {
|
22
|
-
|
22
|
+
|
23
23
|
public func tapOnceVisible(testCase: XCTestCase,
|
24
24
|
file: String = #file, line: UInt = #line) {
|
25
25
|
let existsPredicate = NSPredicate(format: "exists == true")
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
|
28
28
|
testCase.expectation(for: existsPredicate,
|
29
29
|
evaluatedWith: self, handler: nil)
|
30
|
-
|
30
|
+
|
31
31
|
testCase.waitForExpectations(timeout: 20) { (error) -> Void in
|
32
32
|
if (error != nil) {
|
33
33
|
let message = "Failed to find \(self) after 20 seconds."
|
@@ -35,11 +35,11 @@ extension XCUIElement {
|
|
35
35
|
inFile: file, atLine: line, expected: true)
|
36
36
|
}
|
37
37
|
}
|
38
|
-
|
38
|
+
|
39
39
|
self.tap()
|
40
40
|
}
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
|
43
43
|
}
|
44
44
|
|
45
45
|
extension XCTestCase {
|
@@ -48,7 +48,7 @@ extension XCTestCase {
|
|
48
48
|
let existsPredicate = NSPredicate(format: "exists == true")
|
49
49
|
expectation(for: existsPredicate,
|
50
50
|
evaluatedWith: element, handler: nil)
|
51
|
-
|
51
|
+
|
52
52
|
waitForExpectations(timeout: 20) { (error) -> Void in
|
53
53
|
if (error != nil) {
|
54
54
|
let message = "Failed to find \(element) after 5 seconds."
|
@@ -5,9 +5,9 @@
|
|
5
5
|
//
|
6
6
|
|
7
7
|
/*
|
8
|
-
|
8
|
+
|
9
9
|
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
-
|
10
|
+
|
11
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
12
|
*/
|
13
13
|
|
@@ -15,10 +15,8 @@ import Foundation
|
|
15
15
|
import XCTest
|
16
16
|
|
17
17
|
|
18
|
-
class HomeScreen:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
let crappyButtuon = XCUIApplication().buttons["I am really useless button"]
|
23
|
-
|
18
|
+
class HomeScreen: ___PACKAGENAMEASIDENTIFIER___TestBase {
|
19
|
+
|
20
|
+
let homeButtuon = XCUIApplication().buttons["Home"]
|
21
|
+
|
24
22
|
}
|
@@ -6,25 +6,20 @@
|
|
6
6
|
//
|
7
7
|
|
8
8
|
/*
|
9
|
-
|
9
|
+
|
10
10
|
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
-
|
12
|
-
This is sample test which demonstrate use of Page Objects and common extensions. We can access any page or section from test method
|
13
|
-
|
11
|
+
|
12
|
+
This is sample test which demonstrate use of Page Objects and common extensions. We can access any page or section from test method
|
13
|
+
|
14
14
|
*/
|
15
15
|
|
16
16
|
import Foundation
|
17
17
|
import XCTest
|
18
18
|
|
19
19
|
class HomeScreenTest: HomeScreen {
|
20
|
-
|
20
|
+
|
21
21
|
func testHomeScreen() {
|
22
|
-
|
23
|
-
//HomeScreen().crappyButtuon.tapOnceVisible(testCase: self)
|
24
|
-
XCTAssertFalse(HomeScreen().crappyButtuon.exists)
|
25
|
-
|
22
|
+
givenILaunchedApplication()
|
26
23
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
|
30
25
|
}
|
@@ -64,25 +64,14 @@
|
|
64
64
|
</array>
|
65
65
|
<key>Nodes</key>
|
66
66
|
<array>
|
67
|
-
<string>HomeElements.swift</string>
|
68
67
|
<string>HomeScreenTest.swift</string>
|
69
|
-
<string>ProtocolOrientedTest.swift</string>
|
70
|
-
<string>HomeProtocol.swift</string>
|
71
68
|
<string>Extensions.swift</string>
|
72
69
|
<string>HomeScreen.swift</string>
|
73
|
-
<string>BaseScreen.swift</string>
|
74
70
|
<string>Info.plist:PackageType</string>
|
75
71
|
<string>___PACKAGENAMEASIDENTIFIER___TestBase.swift</string>
|
76
72
|
</array>
|
77
73
|
<key>Definitions</key>
|
78
74
|
<dict>
|
79
|
-
<key>HomeElements.swift</key>
|
80
|
-
<dict>
|
81
|
-
<key>Path</key>
|
82
|
-
<string>HomeElements.swift</string>
|
83
|
-
<key>Group</key>
|
84
|
-
<string>Sections</string>
|
85
|
-
</dict>
|
86
75
|
<key>HomeScreenTest.swift</key>
|
87
76
|
<dict>
|
88
77
|
<key>Path</key>
|
@@ -90,26 +79,12 @@
|
|
90
79
|
<key>Group</key>
|
91
80
|
<string>Tests</string>
|
92
81
|
</dict>
|
93
|
-
<key>ProtocolOrientedTest.swift</key>
|
94
|
-
<dict>
|
95
|
-
<key>Path</key>
|
96
|
-
<string>ProtocolOrientedTest.swift</string>
|
97
|
-
<key>Group</key>
|
98
|
-
<string>Tests</string>
|
99
|
-
</dict>
|
100
|
-
<key>HomeProtocol.swift</key>
|
101
|
-
<dict>
|
102
|
-
<key>Path</key>
|
103
|
-
<string>HomeProtocol.swift</string>
|
104
|
-
<key>Group</key>
|
105
|
-
<string>Protocols</string>
|
106
|
-
</dict>
|
107
82
|
<key>Extensions.swift</key>
|
108
83
|
<dict>
|
109
84
|
<key>Path</key>
|
110
85
|
<string>Extensions.swift</string>
|
111
86
|
<key>Group</key>
|
112
|
-
<string>
|
87
|
+
<string>TestBase</string>
|
113
88
|
</dict>
|
114
89
|
<key>HomeScreen.swift</key>
|
115
90
|
<dict>
|
@@ -118,13 +93,6 @@
|
|
118
93
|
<key>Group</key>
|
119
94
|
<string>Screens</string>
|
120
95
|
</dict>
|
121
|
-
<key>BaseScreen.swift</key>
|
122
|
-
<dict>
|
123
|
-
<key>Path</key>
|
124
|
-
<string>BaseScreen.swift</string>
|
125
|
-
<key>Group</key>
|
126
|
-
<string>Screens</string>
|
127
|
-
</dict>
|
128
96
|
<key>Info.plist:PackageType</key>
|
129
97
|
<string><key>CFBundlePackageType</key>
|
130
98
|
<string>BNDL</string>
|
@@ -5,26 +5,28 @@
|
|
5
5
|
//
|
6
6
|
|
7
7
|
/*
|
8
|
-
|
8
|
+
|
9
9
|
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
-
|
10
|
+
|
11
11
|
This class can be used to put all your test base setup e.g launch Argument, cutom Environment varibales, Mock Server, teardown etc etc
|
12
|
-
|
12
|
+
|
13
13
|
*/
|
14
14
|
|
15
15
|
import Foundation
|
16
16
|
import XCTest
|
17
|
-
|
18
|
-
|
17
|
+
import XCFit
|
18
|
+
|
19
|
+
class ___PACKAGENAMEASIDENTIFIER___TestBase: XCFit {
|
20
|
+
|
19
21
|
override func setUp() {
|
20
22
|
super.setUp()
|
21
23
|
continueAfterFailure = false
|
22
24
|
XCUIApplication().launch()
|
23
25
|
}
|
24
|
-
|
26
|
+
|
25
27
|
override func tearDown() {
|
26
28
|
super.tearDown()
|
27
29
|
}
|
28
|
-
|
29
|
-
|
30
|
+
|
31
|
+
|
30
32
|
}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<key>ConstraintType</key>
|
33
33
|
<string>DefaultIfAssociatedTarget</string>
|
34
34
|
<key>Value</key>
|
35
|
-
<string>
|
35
|
+
<string>___ASSOCIATEDTARGET_bundleName___XCUIPoMTests</string>
|
36
36
|
</dict>
|
37
37
|
</array>
|
38
38
|
</dict>
|
data/homebrew/xcfit
CHANGED
@@ -20,14 +20,14 @@ puts "==================XXXXXXXX==========================="
|
|
20
20
|
|
21
21
|
def clone_xcfit
|
22
22
|
# system("cd /tmp")
|
23
|
-
system("cd /tmp && curl -sL https://github.com/Shashikant86/XCFit/archive/
|
23
|
+
system("cd /tmp && curl -sL https://github.com/Shashikant86/XCFit/archive/3.0.8.tar.gz | tar xz")
|
24
24
|
puts "*******======= Downloading XCFit Templates for the Xcode =============***"
|
25
|
-
@xcfit_template_dir = "/tmp/XCFit-
|
26
|
-
@gherkin_template_dir = "/tmp/XCFit-
|
25
|
+
@xcfit_template_dir = "/tmp/XCFit-3.0.8/XCFit_Templates/XCFit"
|
26
|
+
@gherkin_template_dir = "/tmp/XCFit-3.0.8/XCFit_Templates/Gherkin"
|
27
27
|
end
|
28
28
|
|
29
29
|
def clean_xcfit
|
30
|
-
system("rm -rf /tmp/XCFit-
|
30
|
+
system("rm -rf /tmp/XCFit-3.0.8/")
|
31
31
|
end
|
32
32
|
|
33
33
|
def setup_xcode_templates
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shashikant86
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -105,13 +105,9 @@ files:
|
|
105
105
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h
|
106
106
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m
|
107
107
|
- XCFit_Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift
|
108
|
-
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/BaseScreen.swift
|
109
108
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
|
110
|
-
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeElements.swift
|
111
|
-
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeProtocol.swift
|
112
109
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeScreen.swift
|
113
110
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/HomeScreenTest.swift
|
114
|
-
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/ProtocolOrientedTest.swift
|
115
111
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/TemplateIcon.png
|
116
112
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/TemplateIcon@2x.png
|
117
113
|
- XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/TemplateInfo.plist
|
@@ -1,42 +0,0 @@
|
|
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 per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
10
|
-
|
11
|
-
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.
|
12
|
-
|
13
|
-
*/
|
14
|
-
|
15
|
-
|
16
|
-
import XCTest
|
17
|
-
import Foundation
|
18
|
-
|
19
|
-
class BaseScreen: ___PACKAGENAMEASIDENTIFIER___TestBase {
|
20
|
-
|
21
|
-
func waitAndTap(element: XCUIElement) {
|
22
|
-
|
23
|
-
let exists = NSPredicate(format: "exists == true")
|
24
|
-
|
25
|
-
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
26
|
-
self.waitForExpectations(timeout: 10, handler: nil)
|
27
|
-
|
28
|
-
element.tap()
|
29
|
-
|
30
|
-
}
|
31
|
-
|
32
|
-
|
33
|
-
func waitForExist(element: XCUIElement) {
|
34
|
-
|
35
|
-
let exists = NSPredicate(format: "exists == true")
|
36
|
-
|
37
|
-
self.expectation(for: exists, evaluatedWith: element, handler: nil)
|
38
|
-
self.waitForExpectations(timeout: 10, handler: nil)
|
39
|
-
XCTAssert(element.exists)
|
40
|
-
|
41
|
-
}
|
42
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
//
|
2
|
-
//
|
3
|
-
// Created by XCFit Framework
|
4
|
-
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
-
//
|
6
|
-
//
|
7
|
-
|
8
|
-
|
9
|
-
/*
|
10
|
-
|
11
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
12
|
-
|
13
|
-
Sectons are defined to store locators of the screen in the form of enums. Here are some samples we can store Images, Buttons and Static Texts of the HomeScreens. We can access those enums from anywhere from the Test methods or page objects.
|
14
|
-
|
15
|
-
*/
|
16
|
-
|
17
|
-
import Foundation
|
18
|
-
import XCTest
|
19
|
-
|
20
|
-
public enum Images: String {
|
21
|
-
case bannerImage = "Banner"
|
22
|
-
}
|
23
|
-
|
24
|
-
public enum Buttons: String {
|
25
|
-
case homeButton = "Home"
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
public enum StaticTextx: String {
|
30
|
-
case homeLink = "homelink"
|
31
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// HomeProtocol.swift
|
3
|
-
// Created by XCFit Framework
|
4
|
-
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
-
//
|
6
|
-
//
|
7
|
-
|
8
|
-
/*
|
9
|
-
|
10
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
-
|
12
|
-
Swift is protocol oriented language so feel to start with Protocol per scren. Here is example of sample protocol for the homescreen. We can implement this protocol in the XCTest method as needed or we can write some extensions to support Testing.
|
13
|
-
|
14
|
-
*/
|
15
|
-
|
16
|
-
import Foundation
|
17
|
-
import XCTest
|
18
|
-
|
19
|
-
protocol HomeProtocol {
|
20
|
-
|
21
|
-
func launchApp()
|
22
|
-
func tapHomebutton()
|
23
|
-
|
24
|
-
|
25
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
//
|
2
|
-
//
|
3
|
-
// Created by XCFit Framework
|
4
|
-
// Copyright © 2016 XCFit Framework. All rights reserved.
|
5
|
-
//
|
6
|
-
//
|
7
|
-
|
8
|
-
/*
|
9
|
-
|
10
|
-
This is sample code created by XCFit Framework and can be edited/Removed as per your project need. You can also re-arrange Xcode Groups and directories as per your need.
|
11
|
-
|
12
|
-
Here is example of the Protocol Oriented Test which implement HomeProtocol.
|
13
|
-
|
14
|
-
*/
|
15
|
-
|
16
|
-
|
17
|
-
import Foundation
|
18
|
-
import XCTest
|
19
|
-
|
20
|
-
extension HomeProtocol {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
|
26
|
-
class ProtocolOrientedTest: XCTestCase, HomeProtocol {
|
27
|
-
|
28
|
-
let app = XCUIApplication()
|
29
|
-
|
30
|
-
func testPrintsAddedToBasket() {
|
31
|
-
XCUIApplication().launch()
|
32
|
-
launchApp()
|
33
|
-
tapHomebutton()
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
func launchApp() {
|
38
|
-
|
39
|
-
}
|
40
|
-
|
41
|
-
func tapHomebutton() {
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
}
|