This file contains 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
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
let builder = Builder() | |
let viewController = builder.makeNewsViewController() | |
let navigationController = UINavigationController(rootViewController:viewController) |
This file contains 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
struct Builder { | |
func makeNewsViewController() -> UIViewController { | |
let cameraProvider = CameraDataProvider() | |
let commentorProvider = CommentorDataProvider() | |
let moderatorProvider = ModeratorDataProvider() | |
let tableProvider = TableDataProvider() | |
let useCase = MyUseCase( |
This file contains 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
func testLogin() { | |
continueAfterFailure = false | |
app = XCUIApplication() | |
app.launch() | |
wait(for: 2) | |
passLoginSalesForce() | |
wait(for: 5) | |
// after your login you cand add some methods here according to your app flow | |
} |
This file contains 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 XCTestCase { | |
func wait(for duration: TimeInterval) { | |
let waitExpectation = expectation(description: "Waiting") | |
let when = DispatchTime.now() + duration | |
DispatchQueue.main.asyncAfter(deadline: when) { | |
waitExpectation.fulfill() | |
} | |
// I use a buffer here to avoid flakiness with Timer on CI | |
waitForExpectations(timeout: duration + 0.5) |
This file contains 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
//username typing.. | |
let textFieldVector = CGVector(dx: 247, dy: 436) | |
let textFieldCoordinate = app.coordinate(withNormalizedOffset: .zero).withOffset(textFieldVector) | |
textFieldCoordinate.tap() | |
app.typeText("your salesforce username") |