Skip to content

Commit

Permalink
Fix UI Test basic flow
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdtky committed May 12, 2019
1 parent 8a2e987 commit fa644e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
18 changes: 14 additions & 4 deletions Merchant/Core/Managers/UserManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ extension UserManager {

func setDestination(_ destination: String) {
let storageProvider = InternalStorageProvider()
storageProvider.setString(destination, key: "destination")
self._destination = destination
if destination.count == 0 {
storageProvider.remove("destination")
self._destination = nil
} else {
storageProvider.setString(destination, key: "destination")
self._destination = destination
}
}

func setCompanyName(_ companyName: String) {
Expand All @@ -66,8 +71,13 @@ extension UserManager {

func setPin(_ pin: String) {
let storageProvider = InternalStorageProvider()
storageProvider.setString(pin, key: "pin")
self._pin = pin
if pin.count == 0 {
storageProvider.remove("pin")
self._pin = nil
} else {
storageProvider.setString(pin, key: "pin")
self._pin = pin
}
}

func hasPin() -> Bool {
Expand Down
16 changes: 8 additions & 8 deletions MerchantUITests/MerchantUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ class MerchantUITests: XCTestCase {
let okButton = app.alerts.firstMatch.buttons["Ok"]
okButton.tap()

button1.tap()
button1.tap()

checkmarkButton.tap()

app.alerts.firstMatch.buttons["Settings"].tap()
app.firstMatch.buttons["Settings"].tap()

button1.tap()
button1.tap()
Expand Down Expand Up @@ -101,7 +96,12 @@ class MerchantUITests: XCTestCase {
closeButton.tap()

app.navigationBars["My company"].tap()
app.staticTexts["$ 11,00"].tap()


button1.tap()
button1.tap()

app.staticTexts["$ 11.00"].tap()

settingsButton.tap()

Expand All @@ -115,7 +115,7 @@ class MerchantUITests: XCTestCase {
checkmarkButton.tap()

app.staticTexts["Waiting for payment"].tap()
app.staticTexts["$ 11,00"].firstMatch.tap()
app.staticTexts["$ 11.00"].firstMatch.tap()

closeButton.tap()
}
Expand Down

0 comments on commit fa644e5

Please sign in to comment.