Sha256: 62e47d2d394b8144567549799591bb0b851bd6daea72e1ca5eebc735868e3f2e

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

//
//
//  Created by XCFit Framework
//  Copyright © 2017 XCFit Framework. All rights reserved.
//

/*

 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.

 This is a template class which can be extended to XCFit once imported
 */

import Foundation
import XCTest
import XCFit

// Once XCFit is imported then you can extend this class to XCFit in order to use pre-defined steps

class UITestBase: XCFit {

    var app: XCUIApplication!

    let defaultLaunchArguments: [[String]] = {
        let launchArguments: [[String]] = [["-StartFromCleanState", "YES"]]
        guard let version = appVersion else { return launchArguments }
        return launchArguments
    }()

    static var appVersion: String? {
        guard let appPlist = Bundle.main.url(forResource: "yourApp", withExtension: "plist"),
        let appInfo = NSDictionary(contentsOf: appPlist) else { return nil }
        return appInfo["CFBundleShortVersionString"] as? String
    }

    override func setUp() {
        super.setUp()
        app = XCUIApplication()
        continueAfterFailure = false
        launchApp(with: defaultLaunchArguments)
    }

    override func tearDown() {
        app.terminate()
        app = nil
        super.tearDown()
    }

    func launchApp(with launchArguments: [[String]] = []) {
        (defaultLaunchArguments + launchArguments).forEach { app.launchArguments += $0 }
        app.launch()
    }
}

extension UITestBase {

    func givenILaunchAppInCleanState() {
        XCTContext.runActivity(named: "Given I Launch App in Clean State") {  _ in
            launchApp(with: defaultLaunchArguments)
        }
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcfit-10.2.0 XCFit-Demo/XCFit-DemoProtocolBDDTests/UITestBase.swift
xcfit-10.0.0 XCFit-Demo/XCFit-DemoProtocolBDDTests/UITestBase.swift
xcfit-8.0.0 XCFit-Demo/XCFit-DemoProtocolBDDTests/UITestBase.swift