This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let tld : Gen<Character> = Gen<Character>.fromElements(of: ["com", "de", "net", "org", "io"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let hostname = Gen<Character>.one(of: [ | |
| lowerCaseLetters, | |
| numeric, | |
| Gen.pure("-"), // Only generate this character | |
| ]).proliferateNonEmpty.map { String($0) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let localEmail = allowedLocalCharacters | |
| .proliferateNonEmpty // Make a non-empty array of characters | |
| .suchThat { $0[$0.index(before: $0.endIndex)] != "." } | |
| .map { String($0) } // Then make a string. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let allowedLocalCharacters : Gen<Character> = Gen<Character>.one(of: [ | |
| upperCaseLetters, | |
| lowerCaseLetters, | |
| numeric, | |
| special, | |
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let lowerCaseLetters : Gen<Character> = Gen<Character>.fromElements(in: "a"..."z") | |
| let upperCaseLetters : Gen<Character> = Gen<Character>.fromElements(in: "A"..."Z") | |
| let numeric : Gen<Character> = Gen<Character>.fromElements(in: "0"..."9") | |
| let special : Gen<Character> = Gen<Character>.fromElements(of: ["!", "#", "$", "%", "&", "'", "*", "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~", "."]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import FBSnapshotTestCase | |
| class SnapshotTestingTests: FBSnapshotTestCase { | |
| override func setUp() { | |
| super.setUp() | |
| //recordMode = true | |
| } | |
| func testWelcomeView_WithName() { | |
| let welcomeVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Test") as! ViewController | |
| _ = welcomeVC.view |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension XCUIElement { | |
| func write(string: String) { | |
| guard let stringValue = self.value as? String else { | |
| XCTFail("Tried to clear and enter text into a non string value") | |
| return | |
| } | |
| self.tap() | |
| // clear element before writing new text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LoginScreen { | |
| var app: XCUIApplication | |
| let identifier = "german-icon" | |
| var usernameTextField: XCUIElement { return app.textFields["usernameTextField"] } | |
| var passwordTextField: XCUIElement { return app.secureTextFields["passwordTextField"] } | |
| var loginButton: XCUIElement { return app.buttons["loginButton"] } | |
| init(app: XCUIApplication) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import OHHTTPStubs | |
| public func isURL(_ url: URL) -> OHHTTPStubsTestBlock { | |
| return { $0.url == url } | |
| } | |
| extension OHHTTPStubs { | |
| class func setupAuth() { | |
| let response: [String: Any] = ["key": "value"] | |
| stub(condition: isURL("auth.testxyz.com")) { _ in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class TestingAppDelegate: NSObject { | |
| var window: UIWindow? | |
| } |