Debugging failing tests, how?

Hi there,

I’ve got tests running through selenium. I have a standard Jquery autocomplete which is failing.

Obviously the test works fine if I run it on my local machine. The API for the autocomplete works after I ssh into the circleci machine after the failed tests.

They are nightwatch js tests and the third line just times out waiting for the autocomplete to work:

browser.expect.element(‘ul.ui-autocomplete’).to.not.be.visible;
browser.setValue(’#edit-suburb’, ‘Highgate’);
browser.waitForElementVisible(‘ul.ui-autocomplete li a’, 30000);

I’ve done everything i can think of to debug the test. Any ideas? How do other people figure things like this out? Is there a log of javascript errors from the browser somewhere etc?

Also my earlier test failures produced screenshots, but this one doesn’t for some reason.

Are you running on 1.0 or 2.0?

If 2.0, which docker image are you using?

For browser tests in general:

  • Screenshots to check layout
  • Dumping debugging data in a spare div and screenshotting
  • Retrieving HTML blocks and dumping them to the console as text

I don’t know Selenium, but it’d be pretty unusable if there wasn’t. Ditto JavaScript console out as well. PhantomJS allows for both. It looks like it does.

Hi,

Yes I’m runnning 2.0.

I’ve got screenshots going again, not sure why they worked in the first place.

Anyway I think I found a better way, which might be in the instructions somewhere but I never saw it, so I’ll document for future reference.

Rebuild via ssh then:

ssh -p portnum -L 8080:localhost:80 ip_address

Then just go to localhost:8080 in your browser, and you have the full site.

That doesn’t really help though, what is happening is that it is making the backend ajax call, which successfully returns the JSON payload, but for some reason a 404 is returned as the result code, rather than 200 as it does locally.

OK it was pretty weird though I think I figured it out, sort of. I explicitly enabled mod_rewrite. Seems simple but URLs were working that seemed to require mod_rewrite to work in the first place. They API call as mentioned was working, and returning the correct JSON, but it was returning a 404 code, enabled mod_rewrite turned it to a 200 and all was well.