My app is a quiz. Responses required can be for: 1. Responses to questions - 5 possible answers 2. OK to prompt "Correct Answer" 3. OK to prompt "Wrong Answer" 4. OK to prompt "Game Level is " 5. OK to prompt "Game over"
I have recorded the responses and have now built the following:
let okButton = app.alerts["Correct Answer"].buttons["OK"]
let okButton2 = app.alerts["Wrong Answer"].buttons["OK"]
let okButton01 = app.alerts[" \n\n\n \nGame Level is 1\n\n\n\n"].buttons["OK"]
let okButton02 = app.alerts[" \n\n\n \nGame Level is 2\n\n\n\n"].buttons["OK"]
let okButton03 = app.alerts[" \n\n\n \nGame Level is 3\n\n\n\n"].buttons["OK"]
let okButton04 = app.alerts["UKNew£1Coin\n\n\n \nGame Level is 4\n\n\n\n"].buttons["OK"]
let restartButton = app.alerts["Game Over\nCongratulations\n\nRestarting Game"].buttons["OK"]
Responses are as follows:
for index in 1...100 {
twoElement.tap()
okButton.tap()
okButton2.tap()
okButton01.tap()
okButton02.tap()
okButton03.tap()
okButton04.tap()
restartButton.tap()
}
What I would like is to either put an if statement or a switch case statement
Writing
if twoElement.tap(){
twoElement.tap() }
does not work
as for the switch, I do not know what should be the value against which the different values of same type will be compared
Anyone has done something similar successfully, please?