This is a migrated thread and some comments may be shown as answers.

Make an input field empty not working together with Knockout JS

2 Answers 273 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sander Notenbomer
Top achievements
Rank 1
Sander Notenbomer asked on 18 Jul 2012, 09:04 AM
I have a simple website with 3 input boxes and a button which works together with Knockout JS for databinding.

When I click on the button it will validate if the the input fields are not empty.
When they are empty the background color changes to red else they become white.

Now i want to test the following situation with a webtest:
- Insert a value in the first input field (e.q. test)
- hit the save button.
- The first input field is white and input 2 and 3 are red.
- Empty the first input field.
- Click the save button again.
- All the input fields are red.

When a make a webtest for this situation it does not work. Because the value that was databinded to knockout wasn't cleared and the lest step of the situation fails because the first input stays white.

I can not find a good solution to fix this.

Please see the attached test project and website that will show the behavior.

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 18 Jul 2012, 05:23 PM
Hello Sander,

Thank you for the project files. They were extremely helpful.

The issue is with step 11. Injecting an empty string into the text field is not adequately clearing the stored text. Notice that during execution, the "test" string is still displayed to the right of the text field.

To overcome this I disabled step 11 and added two new steps:
  • A Left Double Click Mouse Action from the Elements Menu. This will highlight the text during execution.
  • A Key Press of the Delete Key (not Backspace, but the Delete under the Insert Key). This will delete the highlighted text during execution.

See the attached screen shot for more detail. The test passed after these changes.


Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Sander Notenbomer
Top achievements
Rank 1
answered on 19 Jul 2012, 08:01 AM
Thanks for the  quick answer. It was really helpful.

There was only one small thing that i need to add to the test. 

When you enter an ip-adrress, for example, internet explorer only selects the last number after the dot. To fix this you need to initiate a single left click after the double-click. This will select the whole text.

But that was a small thing that was easily fixed. Thanks again for the quick response and a working solution.
Tags
General Discussions
Asked by
Sander Notenbomer
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Sander Notenbomer
Top achievements
Rank 1
Share this question
or