Swiftpack.co -  PGSSoft/AutoMate as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
PGSSoft/AutoMate
Swift framework containing a set of helpful XCTest extensions for writing UI automation tests
.package(url: "https://github.com/PGSSoft/AutoMate.git", from: "1.8.0")
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: 248
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

1.8.0
1 year ago

Released on 2020-07-18.

Added

  • Swift Package Manager support

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API