Sha256: ebf8bfedb25ce434506c34d357beae50b5e9a20a80ea8152876263fe16c06e3a
Contents?: true
Size: 1.78 KB
Versions: 9
Compression:
Stored size: 1.78 KB
Contents
// // Extensions.swift // Created by XCFit Framework // Copyright © 2016 XCFit Framework. All rights reserved. // // /* This is sample code created by XCFit Framework and can be edited/Removed as needed. 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
9 entries across 8 versions & 1 rubygems