To write a functional test to determine the correct order of a dropdown do the following:

option = css_select("select#id_of_dropdown option")[n]  
assert_equal "Value To Compare", option['value'].to_s  

And replace id_of_dropdown with the dom id for the drop down you’re looking for, replace n with the nth number, and replace ‘Value To Compare’ with the value you’re looking for.

So for example, if you have a dropdown with an id of ‘fruit’ and you want to make sure that the third option is ‘banana’ use this:

option = css_select("select#fruit")[3]  
assert_equal "banana", option['value'].to_s  
Need to find a lawyer for your business? Get in touch with my company Lexoo and we'll find you a great one for free.