facebookarchive / huxley

A testing system for catching visual regressions in Web applications.
Apache License 2.0
4.07k stars 286 forks source link

fix input keypress #17

Open chenglou opened 11 years ago

chenglou commented 11 years ago

Please don't merge yet. This only partially fix the problem, more discussion coming up.

chenglou commented 11 years ago

yo @petehunt, key input on form elements doesn't actually work lol.

The problem is that faking a click on the input doesn't actually focus it, so subsequent key presses are really sent against nothing. This patch fixes this but actually introduces two problems:

  1. The screen shot when the window is active vs non-active will be different, because only the active window shows the blue hue around focused elements. Simplest way of working around this is to ask the tester to never focus on the browser window during the entire rerun/replay procedure, but this is kind of lame…
  2. This introduces a new bug. Following the sequence click input1 -> press a -> click input2 -> press b will actually result in huxley inputting ab on input1, leaving input2 alone. input2's actually focused briefly thanks to the above patch, but somehow the b key press still ends up on input1. I suspect this has to do with KeyTestStep, will check further. Edit: fixed below.
chenglou commented 11 years ago

Alright, the above change fixes the bug 2. There are some KEY_IDs lying around but they don't seem to do anything, so I replaced the ones concerning the patch. Didn't touch the rest.

Still, what about problem 1?

petehunt commented 11 years ago

Are you sure this is an issue? I just added an example which indicates that it works.

chenglou commented 11 years ago

That's really weird, I just clone the new version and installed it; doesn't work. (Selenium 2.35.0)

chenglou commented 11 years ago

By the way, if you use ff 23 selenium will crash on < 2.35.0. This has been fixed since.