Swiftpack.co - Package - PGSSoft/AutoMate
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
AutoMate, made by PGS Software

AutoMateAppBuddyTemplatesModelGenie

AutoMate

AutoMate is a Swift framework containing a set of helpful XCTest extensions for writing UI automation tests. It provides strongly typed, extensible wrapper around launch arguments and environment variables, which can be used for language, locale and keyboard type configuration on the device. With the AutoMate-AppBuddy it can also disable animations in the application and manage events, reminders and contacts.

Swift 5 Travis CocoaPods Compatible Documentation Carthage Compatible SwiftPM Compatible Platform License

AutoMate

Installation

There are three convinient ways to install AutoMate:

  • using CocoaPods with Podfile:

     pod 'AutoMate'
    
  • using Carthage and add a line to Cartfile.private:

     github "PGSSoft/AutoMate"
    

    Cartfile.private should be used because AutoMate framework will be used by UI Tests target only not by the tested application.

  • using Swift Package Manager, either via Xcode or in Package.swift:

     .package(url: "https://github.com/PGSSoft/AutoMate", from: "1.8.0"),
    

Usage

Full documentation is available at https://pgssoft.github.io/AutoMate/.

  1. Create a new UI test case class.

  2. Import AutoMate framework to UI tests files:

    import AutoMate
    
  3. Use TestLauncher in the setup() method to configure application settings and launch the application:

    let app = XCUIApplication()
    TestLauncher(options: [
        SystemLanguages([.English, .German]),
        SystemLocale(language: .English, country: .Canada),
        SoftwareKeyboards([.EnglishCanada, .GermanGermany])
    ]).configure(app).launch()
    
  4. Use AutoMate's extensions in your tests. For example:

    func testSomething() {
        let app = XCUIApplication()
        let button = app.button.element
    
        // helper for waiting until element is visible
        waitForVisibleElement(button, timeout: 20)
        button.tap()
    
        // isVisible - helper to check that element both exists and is hittable
        XCTAssertFalse(button.isVisible)
    }
    

Features (or ToDo)

  • ☑ Set keyboards
  • ☑ Set locale
  • ☑ Set languages
  • ☑ Custom arguments
  • ☑ Custom keyboards, locales and languages
  • XCTest extensions
  • ☑ Added CoreData launch arguments
  • ☑ Disable UIView animations (with AutoMate-AppBuddy)
  • ☑ Strong-typed helpers: locators, page object templates (with AutoMate-Templates)
  • ☑ Base XCTestCase template (with AutoMate-Templates)
  • ☑ Most permissions alerts (like: LocationWhenInUseAlert, CalendarAlert, PhotosAlert) (with AutoMate-ModelGenie)
  • ☑ Managing events, reminders and contacts (with AutoMate-AppBuddy)
  • ☑ Companion library for the application (AutoMate-AppBuddy)
  • ☑ Improve launch options type safety
  • ☑ Smart coordinates
  • ☑ Check if application is running in UI test environment (with AutoMate-AppBuddy)
  • ☐ Stubbing network requests
  • ☐ Stubbing contacts, events and reminders
  • ☐ Taking screenshots
  • ☐ Clearing application data
  • ☐ Stubbing notifications

Example application

Repository contains example application under AutoMateExample directory. Structure of the application is simple, but the project contains extensive suite of UI tests to showcase capabilities of the library.

Development

Full documentation is available at https://pgssoft.github.io/AutoMate/.

If you want to provide your custom launch argument or launch environment you have to implement LaunchOption protocol or one of its extensions, such as LaunchArgumentWithSingleValue:

enum CustomParameter: String, LaunchArgumentWithSingleValue, LaunchArgumentValue {
    var key: String {
        return "AppParameter"
    }
    case value1
    case value2
}

Then, you can pass it to the TestBuilder:

let launcher = TestLauncher(options: [
    CustomParameter.value1
])

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/PGSSoft/AutoMate.

License

The project is available as open source under the terms of the MIT License.

About

The project maintained by software development agency PGS Software. See our other open-source projects or contact us to develop your product.

Follow us

Twitter URL
Twitter Follow

Github

link
Stars: 240

Releases

1.8.0 - 2020-07-18T09:59:49

Released on 2020-07-18.

Added

  • Swift Package Manager support

- 2019-07-21T10:31:57

Released on 2019-07-20.

Updated

  • Updated Ruby dependencies.

- 2019-05-12T19:09:28

Released on 2019-05-12.

Added

  • Support for Xcode 10.
  • Compatibility with Swift 5 (#15) via Stefan Renne

1.6.0 - 2018-10-27T17:27:27

Released on 2018-10-27.

Added

  • Support for Xcode 10, iOS 12 and new devices
  • Compatibility with Swift 4.2 (#11) via David Seek

- 2018-01-11T08:39:18

Released on 2018-01-11.

Updated

  • iOS deployment target is now 9.3

- 2018-01-01T16:56:34

Released on 2018-01-01.

Updated

  • Fixed building for Xcode 9.2.

- 2017-11-14T12:21:09

Released on 2017-11-14.

Added

  • Compatibility with Xcode 9.1, Swift 4 and iOS 11

Updated

  • Deployment target of AutoMate and AutoMateExample is now 10.3

- 2017-11-14T12:20:56

Released on 2017-10-27.

Fixed

  • Build fails on Xcode 9.0.1 (#8) via Jorge Ramirez

- 2017-10-20T19:06:26

Released on 2017-10-20.

Fixed

  • The current version of swiftlint is failing the build (#6) via Jorge Ramirez

- 2017-07-03T08:50:51

Released on 2017-07-03.

Added

  • Check if application is running in UI test environment (with AutoMate-AppBuddy)

- 2017-04-11T13:18:26

Released on 2017-04-11.

Added

  • Smart coordinates SmartXCUICoordinate.

Updated

  • Disabled Bitcode for Cocoapods.
  • Adjusted swipe and tap methods to use smart coordinates.

- 2017-04-10T06:36:47

Released on 2017-04-10.

Added

  • Added element(withIdentifier:labels:labelComparisonOperator:)
  • Added swipe(to:times:avoid:from:until:), swipe(to:untilExist:times:avoid:from:) and swipe(to:untilVisible:times:avoid:from:) to use with collection views.
  • Improve launch options type safety

- 2017-03-29T09:51:14

Released on 2017-03-29.

Added

  • A more generic version of wait(...) methods: wait(forFulfillmentOf predicate:...).
  • wait(forInvisibilityOf...) method which is waiting for the element to disappear.
  • Compatibility with Xcode 8.3 and Swift 3.1.

- 2017-03-15T10:59:37

Released on 2017-03-15.

Added

  • Page Objects: BaseAppPageProtocol, BaseAppPage, ModalPage, PushedPage, HealthPermissionView
  • IdentifiableByElement protocol
  • Locator protocol
  • AppUITestCase as base XCTestCase template
  • Disable UIView animations (with AutoMate-AppBuddy)
  • Improve handling of system alerts (with AutoMate-ModelGenie)
  • Most permissions alerts (like: LocationWhenInUseAlert, CalendarAlert, PhotosAlert) (with AutoMate-Templates)
  • Managing events, reminders and contacts (with AutoMate-AppBuddy)

Updated

  • Documentation

1.0 - 2016-09-23T11:13:41

Released on 2016-09-23.

Added

  • CoreData debug launch options.
  • String localization debug options.
  • Extensions for UI Testing.

Updated

  • Improved documentation.