Trying to do a dynamic test suite and re-use function definitions. I have a form where you can pick different types of ways that someone can contact you, and the page will display differently based on the method of contact. I am trying to do
When /^I click the (.*) return type$/ do |response|
on_page(ContactUsPage).response unless @browser.url.include?("contactBy=#{response}")
This will take the current type of response and click the link unless the url includes "contactBy=" and the response type (meaning you're already on the page and there is no link to click)
I have a page object class (ContactUsPage) that has links for the different methods (email, phone, fax, postal)
the problem i'm having is with the ContactUsPage.response
response is getting injected into the browser check, but it's looking for a method "response" inside ContactUsPage instead of injecting the method.
The method should call ContactUsPage.email
or ContactUsPage.fax
or ContactUsPage.phone
depending on the method passed into the function.