Skip to content

Instantly share code, notes, and snippets.

@cipolleschi
Created August 15, 2020 17:17
Show Gist options
  • Save cipolleschi/745a49f3d506a349a728119d860b963e to your computer and use it in GitHub Desktop.
Save cipolleschi/745a49f3d506a349a728119d860b963e to your computer and use it in GitHub Desktop.
func testPurchasingCoins_success() {
self.app.launchArguments.append(contentsOf: ["-mockPurchase", "true"])
self.app.launch()
let homeView = self.app.otherElements[HomeView.AccessibilityIdentifiers.homeView.rawValue]
XCTAssertTrue(homeView.exists)
self.app.buttons[HomeView.AccessibilityIdentifiers.purchase.rawValue].tap()
XCTAssertEqual(self.app.staticTexts[HomeView.AccessibilityIdentifiers.coins.rawValue].label, "1000")
}
func testPurchasingCoins_failure() {
self.app.launchArguments.append(contentsOf: ["-mockPurchase", "false"])
self.app.launch()
let homeView = self.app.otherElements[HomeView.AccessibilityIdentifiers.homeView.rawValue]
XCTAssertTrue(homeView.exists)
self.app.buttons[HomeView.AccessibilityIdentifiers.purchase.rawValue].tap()
XCTAssertEqual(self.app.staticTexts[HomeView.AccessibilityIdentifiers.coins.rawValue].label, "0")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment