Sha256: 600adfd06d9b36d882b782b66533c0eff3f7ba14711c39dd768c268b7c8dd92c

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 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 file can take all the Swift extensions build around XCUI Test Frameworks which can be directly used in the tests, page objects. Here are sample extensions on XCUIElement and XCTestCase.

 */



import Foundation
import XCTest

extension XCUIElement {

    public func tapOnceVisible(testCase: XCTestCase,
                               file: String = #file, line: UInt = #line) {
        let existsPredicate = NSPredicate(format: "exists == true")


        testCase.expectation(for: existsPredicate,
                             evaluatedWith: self, handler: nil)

        testCase.waitForExpectations(timeout: 20) { (error) -> Void in
            if (error != nil) {
                let message = "Failed to find \(self) after 20 seconds."
                testCase.recordFailure(withDescription: message,
                                       inFile: file, atLine: line, expected: true)
            }
        }

        self.tap()
    }


}

extension XCTestCase {
    func waitForElementToAppear(element: XCUIElement,
                                file: String = #file, line: UInt = #line) {
        let existsPredicate = NSPredicate(format: "exists == true")
        expectation(for: existsPredicate,
                    evaluatedWith: element, handler: nil)

        waitForExpectations(timeout: 20) { (error) -> Void in
            if (error != nil) {
                let message = "Failed to find \(element) after 5 seconds."
                self.recordFailure(withDescription: message,
                                   inFile: file, atLine: line, expected: true)
            }
        }
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xcfit-10.2.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
xcfit-10.0.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
xcfit-8.0.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
xcfit-7.1.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
xcfit-7.0.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift
xcfit-6.1.0 XCFit_Templates/XCFit/XCUI POM Test Bundle Base.xctemplate/Extensions.swift