Skip to content
This repository was archived by the owner on Oct 10, 2021. It is now read-only.

Conversation

@nolanlawson
Copy link
Contributor

One feature I've really wanted from Zuul is to be able to test in Travis without using SauceLabs.

For instance, Travis comes pre-installed with Firefox, and it also supposedly has Chromium installed in there. It would be nice to be able to test locally against their version of Firefox, without having to use SauceLabs.

This PR adds a new flag, --selenium, that will (by default) launch Chrome and run the Zuul tests in Chrome. Additionally, if you specify --browser-name and/or --browser-version, those options will be passed to Selenium to determine which version to test.

I could have made Firefox the default, but it seemed like 6 of one, half a dozen of the other to me. Also I'm mostly opening up this PR to get feedback.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @rase-, @JamesKyburz and @bevacqua to be potential reviewers

@nolanlawson
Copy link
Contributor Author

Hm, that's weird. This was working a moment ago, but now all my tests are stalling because apparently the zuul_msg_bus isn't getting a message with type: 'done'. I'll need to look into this again later, or if anyone else is willing to help out, it's just:

zuul --selenium 

or

zuul --selenium --browser-name firefox

@vvo
Copy link
Collaborator

vvo commented Mar 7, 2016

Not getting the done event could be linked to your previous issue about ipad/iphone stalling tests no?

@nolanlawson
Copy link
Contributor Author

I don't think so; I was talking about locally, not using SauceLabs. Gonna try to keep digging when I get a chance, though.

@nolanlawson
Copy link
Contributor Author

Nevermind; it was a programming error on my part. This now works in both Chrome and Firefox! Getting it to work in Travis' Chrome is a TODO, but in principle this should work right now in Travis using zuul --selenium --browser-name firefox.

@nolanlawson
Copy link
Contributor Author

Also I wasn't quite sure how to test this? I guess I should add a new test to the fixtures directory? The current Travis build seems to be failing for unrelated reasons, though:

 1)  jasmine - phantom:
     Uncaught Error: Not running

@vvo
Copy link
Collaborator

vvo commented Mar 7, 2016

The current travis build can fail only because of saucelabs credentials not being available.

You can check the full test suite locally by using SAUCE_USERNAME=user SAUCE_ACCESS_KEY=key npm test

@vvo
Copy link
Collaborator

vvo commented Mar 7, 2016

Adding a test for this feature could just be maybe trying to run a new test fixture through real selenium on travis firefox? If this passes locally for you I will run the branch on travis myself. Or maybe just create user and keys for zuul and put them public because this is annoying


See the [quickstart](https://github.com/defunctzombie/zuul/wiki/quickstart) page on the wiki for more details.

### Automated browser tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe local browser tests? Because it's always automated right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "automated local"? I wanted to highlight that this isn't designed for debugging, and to distinguish it from --local.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just "Running through phantomJS" "Running through local Selenium server"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really bike shedding here, this is a great PR :)

@nolanlawson
Copy link
Contributor Author

OK, I've added tests. Unfortunately I think Travis will still be red because I'm not a member of this org. However it ought to work if an org member runs the tests.

I also changed the default from Chrome to Firefox. A few reasons:

  • It's the default for selenium-standalone, so I'm not conflicting with that lib anymore
  • It's safer for testing in Travis, since Travis has Firefox but not Chrome
  • Users can still easily switch between Chrome to Firefox as documented in the README.

@nolanlawson
Copy link
Contributor Author

Note that we may also need to add this to the .travis.yml. Haven't confirmed yet:

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

@vvo
Copy link
Collaborator

vvo commented Mar 21, 2016

Argh I am unable to load tests locally, I get Uncaught Error: connection refused: localtunnel.me:42801 (check your firewall settings). WHereas it's working on travis strnagely (master). Will push a branch here.

@vvo
Copy link
Collaborator

vvo commented Mar 21, 2016

I am also unable to run the tests on travis strangely it is stuck at IE11

@vvo
Copy link
Collaborator

vvo commented Mar 21, 2016

Same issue (local tunnel) on master local

@nolanlawson
Copy link
Contributor Author

Anything you need to help get this merged? Sounds like failures are unrelated to my PR unless I'm misunderstanding.

@vvo
Copy link
Collaborator

vvo commented Mar 31, 2016

I tried multiple time to run the tests on this PR without any luck. Basically at some point the test does not exits?

You should be able to run the full test suite by creating an opensauce account on saucelabs (or reuse existing keys you have) then:

DEBUG=zuul*,localtunnel* SAUCE_USERNAME=username SAUCE_ACCESS_KEY=key npm test

Current master branch exits without issues, but your branch does not. Weird.

@nolanlawson
Copy link
Contributor Author

Hm, my hunch is that it's because we also need to add this to .travis.yml:

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

Should I add that to this PR?

@vvo
Copy link
Collaborator

vvo commented Apr 1, 2016

Should I add that to this PR?

Yes, does it also means I should do this when running locally? How did you run tests locally? Ultimately it would be good to be able to run tests "locally" easily because that's currently doable with the line I gave you.

When running your branch I did see firefox running and closing btw

@nolanlawson
Copy link
Contributor Author

@vvo Which version of Firefox are you using? Pretty sure when I tested this I was on 43 or later.

I'll try to find time to test this PR again; I think this would be a great feature for Zuul!

@vvo
Copy link
Collaborator

vvo commented Apr 23, 2016

I tested with latest stable firefox

@nolanlawson
Copy link
Contributor Author

OK, I can reproduce. OS X ElCap with FF 44. Firefox closes but for some reason the process never exits. I tried to debug why it hangs, but can't figure it out. 😕

Feel free to close this PR if nobody has time to debug it. I took a shot at it, but I couldn't figure out what was causing the process to stay open.

@vvo
Copy link
Collaborator

vvo commented May 5, 2016

I had the same issue (process stay open), will try with latest selenium and see how it goes

@vvo
Copy link
Collaborator

vvo commented May 5, 2016

Now localtunnel is too frequently failing sadly for me to go further

@vvo
Copy link
Collaborator

vvo commented May 30, 2016

This PR is almost good, the code works but we are not able to make the tests passes. We could merge it without tests and wait for issues to come (alon with potential resolvers). WDYT?

@nolanlawson
Copy link
Contributor Author

I would prefer to have tests passing. I'm just very sorry I didn't have time to push this further. :( Your call.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants