My cucumber/capybara tests use pickle to click links within emails but I came across a slight issue when integrating with saucelabs. Saucelabs proxies requests through a different host than what our rails app uses. Our rails emails get the URL host from:
This is most likely set to localhost:5000 or something like that. Saucelabs on the other hand seems to use a random host. The end result is that when we click the first link within our email, the test fails with a DNS error as the saucelabs selenium server tries to hit localhost:5000 which does not exist at saucelabs. Emailed the folks at saucelabs and they recommended converting links within the email from absolute to relative. Got it done by monkey patching pickle:
The absolute_link_to_relative method just slices off the hostname in the url using the String#slice method. The first argument is a regular expression built with the ActionMailer host configuration and the second is the capture number.
No comments:
Post a Comment