eagle_arg's avatar

Phpunit how to test a form having dependency between dropdowns

Hi, I'm trying to use phpunit in my app (I'm learning how to use it)... Now I have the next question... How I can complete a form having 2 dropdowns, when the second dropdown only is completed if the first one is chose (using ajax and json). e.g. first I completed the dropdown called Country (when you selected a value then it will complete the other dropdown which is City). So right now if I used:

          ->select('1', 'country_id')
           ->select('5', 'county_id')

doesn't work... Phpunit is telling me that the value 5 of "county_id" is not a possible value. After that said that the possible values are "" (so i guess is never completing the second dropdown using phpunit).

Thanks! =)

0 likes
4 replies
Jorge's avatar

You must use selenium to test Javascript interaction. Maybe you only need to test the endpoints where the combo data comes from.

eagle_arg's avatar

@Jorge I need to test how is the page saving, but i cannot do it because of it =(

eagle_arg's avatar

I'm trying but I'm not sure how it works... In 5.1 with phpunit you can complete fields using "type, select, etc." but with selenium seems that it don't work the same way. :S

eagle_arg's avatar

So bad... I could use selenium, but it can't open jquery date-picker, and neither select2 dropdowns... I don't know how to test my app. I only can use phpunit for simple things.

Please or to participate in this conversation.