A proper if-else logic in the recorder for your exact scenario will be published starting next week. In the meantime I can suggest you to implement your if-else logic with our sdk as part of a coded test, or using recovery tests:
You’ll need to use the ‘Invert step result’ option and recovery tests while creating your test, you can see this example:
On the web page we have 2 elements we should keep:
- Element that contains text, which is the secret question
- Element where we should type the answer. Some text area.
We should save these elements. Lets give them names:
Lets create parameters that will contain the questions and answers.
We need 3 Parameters for questions.
- Name of your pet
- City where you live
- Favorite flavor of ice cream.
Note that values (questions in our case) should be the same as they appears on the web site, since we will use the equals condition.
Now lets create the first steps.
We should get text from the element where the text of the question is and validate what the exact question is there.
- Element action to get text from the element.
- Validate retrieved text to parameter
We need to add 3 like this one, since we have 3 different question. Only difference in steps will be in the validation. We already have validation to Question1. Lets create 2 more, for Question 2 and 3.
Now we have our IF.
We will have 2 failed and 1 passed step since only 1 out of 3 will always match the question.
But we can invert this and make the failed steps show as passed and passed as failed.
Now if step validates the ‘Name of your pet’ and answer was the same - step will be reverted from passed to failed, so we can do something in this case.
And here comes the Recovery test .
Now lets create 3 new small tests which will have only 1 action - Type text in element where we need to type the answer.
And add them as recoveries to our steps in the test
And done .