Swiftpack.co - Package - ngeri/accessible

Accessible

Accessible is tool which makes your UITesting experience way better on iOS.

|CI |Status | |--|--| | Master | Build Status| | Development | Build Status|

Table of Contents

  1. Intro
  2. Usages

Intro

Accessible parses your .storyboard files and generates accessibilityIdentifiers for every IBOutlet connection.

enum Accessible {
    struct Storyboard {
        struct Screen { 
            static let rootView = "Accessible.Storyboard.Screen.rootView"
            struct UIElementTpye {
                static let aView = "Accessible.Storyboard.Screen.UIElementTpye.aView"
            }
            ...
        }
        ...
    }
    ...
}

UITestableExtensions.swift makes setting the previously generated id-s for every UIElement easy. If you provide UITestableExtensions.swift path then Accessible will also generate a Swift file like below.


protocol UITestable {
    func setAccessibilityIdentifiers()
}

extension ScreenViewController: UITestable {
    func setAccessibilityIdentifiers() {
        view.accessibilityIdentifier = Accessible.Storyboard.Screen.rootView
        aView.accessibilityIdentifier = Accessible.Storyboard.Screen.UIElementTpye.aView
        ...
    } 
}
...

You should call setAccessibilityIdentifiers() in the viewDidLoad() method of the UIViewController instance.

UITapMans.swift makes writing XCTestCase files way more fun then previously.

class ScreenUITests: XCTestCase {
    var tapMan: ScreenTapMan!
    override func setUp() {
        super.setUp()
        continueAfterFailure = false
        tapMan = OnboardingTapMan().start()
    }
  
    func testCaseA() {
        tapMan
           .aView.isHittable()
           .aView.tap()
    }
}

Usage

  1. Download the latest released binary.

  2. Make it executable with chmod +x accessible. (If you have a .dms extension then remove it first)

  3. Copy it to /usr/local/bin/.

  4. Create a .accessible.yml configuration file in your project's root directory (next to your project file).

#enumName: Accessible
inputs: 
  - Path/To/Storyboards
  - Path/To/OtherStoryboards
  - Path/To/One/SpecificStoryboard.storyboard
outputs:
  identifiersPath: Directory/Of/Generated/Files
  #testableExtensionsPath: Directory/Of/Generated/Files
  #tapMansPath: Directory/Of/Generated/Files

Uncomment enumName if you would like to provide the Accessibiliy Identifiers enum's name.

Uncomment testableExtensionsPath if you would like Accessible to generate UITestableExtensions.swift file for you.

Uncomment tapMansPath if you would like Accessible to generate UITapMans.swift file for you.

  1. Call accessible in the root directory of your project or set up a new run script build phase in your Xcode project file.

Github

link
Stars: 3

Dependencies

Used By

Total: 0

Releases

Accessible 0.0.2 - 2018-09-30 20:53:58

Accessible 0.0.1 - 2018-08-22 11:49:34