├── .travis.yml
├── AutoMate UI Tests
├── Page Object.xctemplate
│ ├── TemplateIcon.png
│ ├── TemplateIcon@2x.png
│ ├── TemplateInfo.plist
│ └── ___FILEBASENAME___.swift
└── Test Suite.xctemplate
│ ├── TemplateIcon.png
│ ├── TemplateIcon@2x.png
│ ├── TemplateInfo.plist
│ └── ___FILEBASENAME___.swift
├── Changelog.md
├── Dangerfile
├── Gemfile
├── Gemfile.lock
├── Jenkinsfile
├── LICENSE
├── README.md
├── assets
├── logo.png
├── made-with-love-by-PGS.png
└── templates.png
└── install.sh
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: xcode8.3
3 |
4 | env:
5 | - NSUnbufferedIO=YES
6 |
7 | script:
8 | - bundle exec danger
9 |
--------------------------------------------------------------------------------
/AutoMate UI Tests/Page Object.xctemplate/TemplateIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/AutoMate UI Tests/Page Object.xctemplate/TemplateIcon.png
--------------------------------------------------------------------------------
/AutoMate UI Tests/Page Object.xctemplate/TemplateIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/AutoMate UI Tests/Page Object.xctemplate/TemplateIcon@2x.png
--------------------------------------------------------------------------------
/AutoMate UI Tests/Page Object.xctemplate/TemplateInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Kind
6 | Xcode.IDEFoundation.TextSubstitutionFileTemplateKind
7 | Description
8 | An example of AutoMate UI Tests Page Object
9 | Summary
10 | An example of AutoMate UI Tests Page Object
11 | SortOrder
12 | 11
13 | DefaultCompletionName
14 | Page
15 | Platforms
16 |
17 | com.apple.platform.iphoneos
18 |
19 | MainTemplateFile
20 | ___FILEBASENAME___.swift
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AutoMate UI Tests/Page Object.xctemplate/___FILEBASENAME___.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ___FILENAME___
3 | // ___PROJECTNAME___
4 | //
5 | // Created by ___FULLUSERNAME___ on ___DATE___.
6 | //___COPYRIGHT___
7 | //
8 |
9 | import XCTest
10 | import AutoMate
11 |
12 | // MARK: - ___FILEBASENAMEASIDENTIFIER___
13 | open class ___FILEBASENAMEASIDENTIFIER___: BaseAppPage {
14 |
15 | // MARK: Elements
16 | open var exampleElement: XCUIElement {
17 | return view.buttons[Locators.exampleLocator]
18 | }
19 |
20 | // MARK: Actions
21 | open func doSomethingExample() {
22 | exampleElement.tap()
23 | }
24 |
25 | // MARK: Helpers
26 | open func isExampleElementAvailable() -> Bool {
27 | return exampleElement.exists
28 | }
29 | }
30 |
31 | // MARK: - IdentifiableByElement
32 | extension ___FILEBASENAMEASIDENTIFIER___: IdentifiableByElement {
33 |
34 | public var identifingElement: XCUIElement {
35 | return exampleElement
36 | }
37 | }
38 |
39 | // MARK: - Locators
40 | private extension ___FILEBASENAMEASIDENTIFIER___ {
41 |
42 | enum Locators: String, Locator {
43 | case exampleLocator = "exampleText"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/AutoMate UI Tests/Test Suite.xctemplate/TemplateIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/AutoMate UI Tests/Test Suite.xctemplate/TemplateIcon.png
--------------------------------------------------------------------------------
/AutoMate UI Tests/Test Suite.xctemplate/TemplateIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/AutoMate UI Tests/Test Suite.xctemplate/TemplateIcon@2x.png
--------------------------------------------------------------------------------
/AutoMate UI Tests/Test Suite.xctemplate/TemplateInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Kind
6 | Xcode.IDEFoundation.TextSubstitutionFileTemplateKind
7 | Description
8 | An example of AutoMate UI Test Suite class
9 | Summary
10 | An example of AutoMate UI Test Suite class
11 | SortOrder
12 | 12
13 | DefaultCompletionName
14 | Tests
15 | Platforms
16 |
17 | com.apple.platform.iphoneos
18 |
19 | MainTemplateFile
20 | ___FILEBASENAME___.swift
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AutoMate UI Tests/Test Suite.xctemplate/___FILEBASENAME___.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ___FILENAME___
3 | // ___PROJECTNAME___
4 | //
5 | // Created by ___FULLUSERNAME___ on ___DATE___.
6 | //___COPYRIGHT___
7 | //
8 |
9 | import XCTest
10 | import AutoMate
11 |
12 | class ___FILEBASENAMEASIDENTIFIER___: AppUITestCase {
13 |
14 | // MARK: Arrange Page Objects
15 | lazy var myReusablePage1: MyReusablePage = MyReusablePage(in: self.app)
16 |
17 | // MARK: Set up
18 | // Called once before whole class
19 | override class func setUp() {
20 | // Put setup code here.
21 | super.setUp()
22 | }
23 |
24 | // Called before each test method
25 | override func setUp() {
26 | super.setUp()
27 | // Put setup code here.
28 | TestLauncher.configure(app, withOptions: []).launch()
29 | }
30 |
31 | // MARK: Tear down
32 | // Called once after all tests are run
33 | override class func tearDown() {
34 | // Put teardown code here.
35 | super.tearDown()
36 | }
37 |
38 | // Called once after each test
39 | override func tearDown() {
40 | // Put teardown code here.
41 | super.tearDown()
42 | }
43 |
44 | // MARK: Tests
45 | func testMethod1() {
46 | // Put your test code here.
47 | }
48 |
49 | func testMethod2() {
50 | // Put your test code here.
51 | }
52 |
53 | // MARK: Helpers
54 | func localMethod() {
55 | // Put a reusable code here.
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [1.1.0](https://github.com/PGSSoft/AutoMate/releases/tag/1.1.0)
4 | Released on 2017-03-29.
5 |
6 | #### Added
7 | - Compatibility with Xcode 8.3 and Swift 3.1.
8 |
9 | ## [1.0.0](https://github.com/PGSSoft/AutoMate-Templates/releases/tag/1.0.0)
10 | Released on 2017-03-15.
11 |
12 | #### Added
13 | - Strong-typed helpers: locators, page object templates
14 | - Base XCTestCase template
15 |
--------------------------------------------------------------------------------
/Dangerfile:
--------------------------------------------------------------------------------
1 | # Common provider
2 | provider = send(danger.scm_provider)
3 |
4 | # Sometimes it's a README fix, or something like that - which isn't relevant for
5 | # including in a project's CHANGELOG for example
6 | declared_trivial = provider.pr_title.include? "#trivial"
7 |
8 | # Make it more obvious that a PR is a work in progress and shouldn't be merged yet
9 | warn("PR is classed as Work in Progress") if provider.pr_title.include? "[WIP]"
10 |
11 | # Warn when there is a big PR
12 | warn("Big PR") if git.lines_of_code > 500
13 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | # Autogenerated by fastlane
2 | #
3 | # Ensure this file is checked in to source control!
4 |
5 | source "https://rubygems.org"
6 |
7 | gem 'danger'
8 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | addressable (2.5.0)
5 | public_suffix (~> 2.0, >= 2.0.2)
6 | claide (1.0.1)
7 | claide-plugins (0.9.2)
8 | cork
9 | nap
10 | open4 (~> 1.3)
11 | colored (1.2)
12 | colored2 (3.1.2)
13 | cork (0.2.0)
14 | colored (~> 1.2)
15 | danger (4.3.0)
16 | claide (~> 1.0)
17 | claide-plugins (>= 0.9.2)
18 | colored2 (~> 3.1)
19 | cork (~> 0.1)
20 | faraday (~> 0.9)
21 | faraday-http-cache (~> 1.0)
22 | git (~> 1)
23 | kramdown (~> 1.5)
24 | octokit (~> 4.2)
25 | terminal-table (~> 1)
26 | faraday (0.11.0)
27 | multipart-post (>= 1.2, < 3)
28 | faraday-http-cache (1.3.1)
29 | faraday (~> 0.8)
30 | git (1.3.0)
31 | kramdown (1.13.2)
32 | multipart-post (2.0.0)
33 | nap (1.1.0)
34 | octokit (4.6.2)
35 | sawyer (~> 0.8.0, >= 0.5.3)
36 | open4 (1.3.4)
37 | public_suffix (2.0.5)
38 | sawyer (0.8.1)
39 | addressable (>= 2.3.5, < 2.6)
40 | faraday (~> 0.8, < 1.0)
41 | terminal-table (1.7.3)
42 | unicode-display_width (~> 1.1.1)
43 | unicode-display_width (1.1.3)
44 |
45 | PLATFORMS
46 | ruby
47 |
48 | DEPENDENCIES
49 | danger
50 |
51 | BUNDLED WITH
52 | 1.14.6
53 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | node("ios") {
2 | timeout(45) {
3 | ansiColor('xterm') {
4 | env.LANG = "en_US.UTF-8"
5 | env.RBENV_VERSION = env.RBENV_2_4
6 | env.NSUnbufferedIO = "YES"
7 | env.DEVELOPER_DIR = "/Applications/Xcode_8.3.app"
8 | env.DANGER_BITBUCKETSERVER_HOST = "bitbucket.pgs-soft.com"
9 |
10 | // Unlock Bitbucket Server credentials
11 | withCredentials([usernamePassword(credentialsId: 'pgs-software-bitbucket-server-danger_user', passwordVariable: 'DANGER_BITBUCKETSERVER_PASSWORD', usernameVariable: 'DANGER_BITBUCKETSERVER_USERNAME')]) {
12 | //
13 | // Stages
14 | // Prepare node
15 | // - clean workspace
16 | // - clone repository
17 | // - update bundle
18 | stage("Prepare & clone") {
19 | deleteDir()
20 | checkout scm
21 |
22 | sh '''
23 | # RBENV
24 | eval "$(rbenv init -)"
25 |
26 | # Bundler
27 | bundle install
28 | '''
29 | }
30 |
31 | // Danger
32 | stage("Danger") {
33 | sh '''
34 | # RBENV
35 | eval "$(rbenv init -)"
36 |
37 | # Danger
38 | bundle exec danger
39 | '''
40 | }
41 |
42 | // Clean
43 | stage("Clean") {
44 | deleteDir()
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 PGS Software
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
12 |
13 | # AutoMate UI Test templates
14 |
15 | [`AutoMate`](https://github.com/PGSSoft/AutoMate) is a Swift framework containing a set of helpful `XCTest` extensions for writing UI automation tests. Those Xcode templates helps starting with new UI tests utilizing Page Object pattern and [`AutoMate`](https://github.com/PGSSoft/AutoMate) framework.
16 |
17 | [](https://swift.org)
18 | [](https://github.com/PGSSoft/AutoMate-Templates/blob/master/LICENSE)
19 |
20 | 
21 |
22 | ## Installation
23 |
24 | ### Installation script
25 |
26 | - Clone repository
27 |
28 | ```bash
29 | git clone ...
30 | ```
31 |
32 | - Run installation script placed inside working directory
33 |
34 | ```bash
35 | ./install.sh
36 | ```
37 |
38 | ### Manual
39 |
40 | - Clone repository
41 |
42 | ```bash
43 | git clone ...
44 | ```
45 |
46 | - Create `Templates` folder at `/Users//Library/Developer/Xcode` if doesn't exists
47 |
48 | ```bash
49 | mkdir -p "${HOME}/Library/Developer/Xcode/Templates"
50 | ```
51 |
52 | - Copy folder `AutoMate UI Tests` from this repository to `/Users//Library/Developer/Xcode/Templates`. Alternatively make a symbolic link:
53 |
54 | ```bash
55 | ln -s "/Users//Library/Developer/Xcode/Templates/AutoMate UI Tests" "/full/path/to/repository/working/copy/AutoMate UI Tests"
56 | ```
57 |
58 | ## Features (or ToDo)
59 |
60 | - [x] Strong-typed helpers: locators, page object templates
61 | - [x] Base XCTestCase template
62 |
63 | ## Contributing
64 |
65 | Bug reports and pull requests are welcome on GitHub at [https://github.com/PGSSoft/AutoMate-Templates](https://github.com/PGSSoft/AutoMate-Templates).
66 |
67 | ## License
68 |
69 | The project is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
70 |
71 | ## About
72 | The project maintained by software development agency [PGS Software](https://www.pgs-soft.com)
73 | See our other [open-source projects](https://github.com/PGSSoft) or [contact us](https://www.pgs-soft.com/contact-us) to develop your product.
74 |
75 | ## Follow us
76 |
77 | [](https://twitter.com/intent/tweet?text=https://github.com/PGSSoft/AutoMate-Templates)
78 | [](https://twitter.com/pgssoftware)
79 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/assets/logo.png
--------------------------------------------------------------------------------
/assets/made-with-love-by-PGS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/assets/made-with-love-by-PGS.png
--------------------------------------------------------------------------------
/assets/templates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PGSSoft/AutoMate-Templates/33cf72ce971001bf0adc5cdda22f36f73699ee5a/assets/templates.png
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | FILE_TEMPLATES="${HOME}/Library/Developer/Xcode/Templates"
4 | AUTO_MATE_TEMPLATES_NAME="AutoMate UI Tests"
5 | AUTO_MATE_TEMPLATES_SOURCE_PATH="${PWD}/`dirname \"$0\"`/${AUTO_MATE_TEMPLATES_NAME}"
6 | AUTO_MATE_TEMPLATES_DESTINATION_PATH="${FILE_TEMPLATES}/${AUTO_MATE_TEMPLATES_NAME}"
7 |
8 | # Checking if AutoMate template exists.
9 | if [[ ! -d "${AUTO_MATE_TEMPLATES_SOURCE_PATH}" ]]; then
10 | echo "Cannot find \"${AUTO_MATE_TEMPLATES_SOURCE_PATH}\". Failing ... "
11 | exit 1
12 | fi
13 |
14 | # Check if Xcode file templates folder exists.
15 | # If not, create it.
16 | if [[ ! -e "${FILE_TEMPLATES}" ]]; then
17 | echo "\"${FILE_TEMPLATES}\" doesn't exist. Creating ..."
18 | mkdir -p "${FILE_TEMPLATES}"
19 | fi
20 |
21 | # Check if previous templates exists.
22 | # If yes, make backup.
23 | if [[ -e "${AUTO_MATE_TEMPLATES_DESTINATION_PATH}" ]]; then
24 | echo "\"${AUTO_MATE_TEMPLATES_DESTINATION_PATH}\" already exists. Backing up ..."
25 | BACKUP_DIR_NAME="${AUTO_MATE_TEMPLATES_NAME}.`date +%s`"
26 | BACKUP_DIR_NAME="`mktemp -du \"${BACKUP_DIR_NAME}.XXX\"`"
27 | BACKUP_PATH="${FILE_TEMPLATES}/${BACKUP_DIR_NAME}"
28 | mv "${AUTO_MATE_TEMPLATES_DESTINATION_PATH}" "${BACKUP_PATH}"
29 | fi
30 |
31 | # Create AutoMate symbolic link to Xcode templates folder.
32 | echo "Linking \"${AUTO_MATE_TEMPLATES_NAME}\" into \"${FILE_TEMPLATES}\""
33 | ln -s "${AUTO_MATE_TEMPLATES_SOURCE_PATH}" "${AUTO_MATE_TEMPLATES_DESTINATION_PATH}"
34 |
35 | echo "Done."
36 |
--------------------------------------------------------------------------------