I want to test posting to a form with a time field. If the form [time input] isn't complete the test would fail.

How to handle browser behavior in a different locale, like formatting the input as 24 hour time, or 12 hours with AM/PM input?

enter image description here enter image description here

<input type="time" name="time" value="" class="form-control">

Update: What I have tried:

I tried filling the time with string 1300 it passed in my development environment but because of the different locale setting in test environment and development, my test failed.

I can just set the string to 1300pm to get it work for example, but I wonder how to test this case in general.

  • Should a browser-automation test check browser behavior and change input accordingly?
  • Should apps not use input that behaves differently?
  • Should a test environment have the same locale with the development environment? [if this is the preferred way, I already ask a question in another site, but haven't found the answer yet]

Sorry, I kinda lost in testing, so I can't come up with a straightforward question.

  • What have you tried and where are you stuck? Also try to ask one question per question, the different locale thing is totally different from the incomplete input. Mar 5, 2019 at 10:51
  • @NielsvanReijmersdal Hi there, I just updated the question. Sorry, but the different locale made my test code failed because of incomplete input. I just wonder what in general a test should cover this case.
    – otong
    Mar 5, 2019 at 11:08

1 Answer 1


Should a test environment have the same locale with the development environment?

Preferably, but it should be controlled. You should set the expected locale of each environment and run your checks against it. Test automation scripts are stupid, they by default do not detect things and wont change their behaviour like a human would. They just follow fixed steps, so the environment should accept these steps.

I think it is a good idea to test against multiple locales if your application has a need for it. Just supporting it because you can might slow you down, it is a design decision. Bring it back to the team and decide together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.