chenglou / node-huxley

Codeless front-end testing.
MIT License
361 stars 29 forks source link

Support for remote Selenium server #35

Closed brentwalter closed 10 years ago

brentwalter commented 10 years ago

Thanks for all the fantastic work porting huxley to Node!

This feature may already be in place, but I couldn't find any configurable variables in the codebase, as described: https://github.com/facebook/huxley#how-do-i-use-a-remote-webdriver-server

Thanks for your help.

chenglou commented 10 years ago

Thanks! This is a dupe of #2. I haven't checked into this too much yet. Selenium is kind of a pain but I enjoy the visual debugging during playback a lot. If you have an idea or want to explore this area, please do! I'll also try a few things when I get the time.

brentwalter commented 10 years ago

Thanks for the quick response. I'm hoping to use your tool in an enterprise environment that requires constancy across many developer's computers as well as Jenkins automation, so I may have to spend some time looking into getting this to work. Perhaps there are some clues in how Facebook/huxley implemented it in Python:

https://github.com/facebook/huxley/blob/master/huxley/integration.py#L26 https://github.com/facebook/huxley/blob/master/huxley/cmdline.py#L33

Thanks for any advice or guidance. Having this as a Grunt task is incredibly valuable, so your Node port is worth its weight in gold. Thanks again for wonderful work.

chenglou commented 10 years ago

You're welcome! Yeah, I have a lot at hand right now so feel free looking into it (and also weight in in other issues if you want).

brentwalter commented 10 years ago

Hi chenglou,

Just wondering what I can do to help you push version 6.2 to NPM with the remote selenium and browser prefixed image updates?

I'm sure you're very busy, and I'm happy to help with anything that's holding you up.

Thanks again for all your time and effort on this project.

chenglou commented 10 years ago

That'll be 7.0. I'm probably releasing it at the end of this weekend, along with some other changes.

chenglou commented 10 years ago

Would be nice to test that remote actually works though (even though it has no reason to not work?).

brentwalter commented 10 years ago

I was using the master branch of node-huxley today (npm link to it from my working project) and it was connecting and running perfectly on one of our remote Selenium server. The issues I'm working through with our automation team are:

  1. Enabling the Selenium server to recognize who is requesting it so that it can point the remote browser at the correct DNS where the fixtures are hosted (my local machine or a Jenkins machine). For example, when I make the commands on my local Mac (hux path/to/huxleyfiles/), with the test fixtures hosted on http://localhost:9000, How does Selenium know where my localhost is? I currently am using a script I put together that parses all my Huxleyfile.json files and update the urls in each one. This solves the issue for now, so I can swap back and forth easily between running Huxley locally and remotely. But a more dynamic solution would be nice, such as whenever you're running huxley with a remote server, all the urls in the huxleyfile.json files are rewritten to point to your public IP address. If that feature is interesting to you, I may be able to get to it next week. Node gives me all I need here: http://nodejs.org/api/os.html#os_os_networkinterfaces
  2. The images are generated on a remote machine, not the user's local machine, so how does someone get the image diffs or new images on their local machine to commit into Git? We're using Jenkins to automate the entire process, so with the help of some Jenkins plugins we're saving all generated images and sending them via email and/or chat service when the job is completed. I haven't started wrapping my head around a better way to do this yet. My only idea is to have the remote machine scp the files back to me when the job is finished. But all of that requires Jenkins, not just Selenium.

I'll happily share what we figure out or my script to dynamically modify the huxleyfile.json files. I'm sure these are issues others will have when using Huxley in a group setting on a remote Selenium server.

Thanks again for all the awesome work.

chenglou commented 10 years ago

Great! Concerning point 1: yeah that might be a possibility. Except localhost was given as an example. It's really just any page anywhere that you can access. So if we make this configurable I'd prefer it not to go in the way of me testing on, say, "url": "google.com".

Point 2: humm, dunno lol. I'll see.

chenglou commented 10 years ago

Alright. 0.7.0 in! The catch is that I haven't tested remote, but since it's supposedly just a server URL change, this should be fine. I'll trust your words =).

Leaving this issue open for the discussion above.

chenglou commented 10 years ago

New, cleaner API in 0.8.0: https://github.com/chenglou/node-huxley/wiki/API