// // XCUIApplication.swift // AutoCat2UITests // // Created by Selim Mustafaev on 06.04.2022. // import Foundation import XCTest import AutoCatCore extension XCUIApplication { func setTestKind(_ kind: Testing.TestKind) { launchArguments += ["UI-TESTING"] launchEnvironment["testKind"] = kind.rawValue } func auth(login: String, password: String) { let loginButton = buttons["loginButton"] guard loginButton.waitForExistence(timeout: 3) else { XCTFail("Login button not found") return } textFields["emailTextField"].tap() textFields["emailTextField"].typeText(login) secureTextFields["passwordTextField"].tap() secureTextFields["passwordTextField"].typeText(password) loginButton.tap() let newButtonFound = buttons["NewCheckButton"].waitForExistence(timeout: 3) XCTAssert(newButtonFound, "New button not found") } func enterPlateNumber(_ number: String) { buttons["NewCheckButton"].tap() XCTAssert(otherElements["plateView"].waitForExistence(timeout: 3), "PlateView not found") for character in number { let id = String(character) + "_button" buttons[id].tap() } buttons["checkButton"].tap() } }