-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parameters in url can not be defined outside the page file #16
Comments
👍 Yeah, this frustrates me from time to time. I'm thinking how best to do it. Open to ideas :) |
What about methods like? SearchResuts.load keyword: 'my search term'
set_url '/search?keyword={keyword}' # I propose {} as those symbols can't exist in url according to RFCs In the internals it can be implemented as something like: def self.set_url(url)
@@url = url
end
def load(args={})
raise SitePrism::NoUrlForPage if @@url.nil?
url = @@url.dup
args.each do |key, value|
url.gsub!(/\{#{key}\}/, value)
end
visit url
end |
Also I propose to resolve urls according to Capybara.app_host if they don't start from http. In the example above user should be navigated to 'http://www.google.com//search?keyword=my%20search%20term' if Capybara.app_host or Capybara.default_host aren't nil. I'll prepare pull request for those 2 changes if you'll approve this feature |
@abotalov sure! Go ahead! I'm a bit behind where I should be with merging pull requests but if it's good code and has the relevant tests then I'll merge it in when I get a moment :) |
@abotalov BTW, site_prism will use |
That feature would be great! I've been dealing with non rails application testing using app_host and it would be very useful. +1 |
I've just created a Pull Request adding the Capybara.app_host feature that was being discussed here. I hope you find it as useful and I did. |
#27 covers this |
We have a scenario to test the same webpage with different languages.
and we use the parameter "lng" to switch languages for the page.
e.g. www.example.com/home.php?lng=en means the english version of the page
www.example.com/home.php?lng=jp means the japanese version of the page.
with site_prism, i can define a page object for the page www.example.com/home.php. but in my test case, i need to open this same page with different languages
but page.load did not accept any parameters. it will be good if the load method will accept a group of parameters and the parameters will be added to the url
The text was updated successfully, but these errors were encountered: