Skip to content

Commit

Permalink
ssaving changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jfitisoff committed Jun 10, 2017
1 parent 99366b0 commit e49b17f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
5 changes: 3 additions & 2 deletions lib/site-object/page.rb
Expand Up @@ -451,11 +451,11 @@ def on_page?
@required_arguments.all? { |k| pargs[k] == @arguments[k].to_s }
end
end
elsif @url_template.match(url.split(/\/$/)[0])
elsif @url_template.match(url.split(/(\?|#|\/$)/)[0])
if @arguments.empty?
return true
else
if pargs = @url_template.extract(Addressable::URI.parse(url.split(/\/$/)[0]))
if pargs = @url_template.extract(Addressable::URI.parse(url.split(/(\?|#|\/$)/)[0]))
pargs = pargs.with_indifferent_access
@required_arguments.all? { |k| pargs[k] == @arguments[k].to_s }
end
Expand Down Expand Up @@ -498,6 +498,7 @@ def visit
if @url_matcher
raise SiteObject::WrongPageError, "Navigation check failed after attempting to access the #{self.class.name} page. Current URL #{@browser.url} did not match #{@url_template.pattern}. A URL matcher was also defined for the page and the secondary check against the URL matcher also failed. URL matcher: #{@url_matcher}" unless on_page?
else
binding.pry
raise SiteObject::WrongPageError, "Navigation check failed after attempting to access the #{self.class.name} page. Current URL #{@browser.url} did not match #{@url_template.pattern}" unless on_page?
end

Expand Down
16 changes: 4 additions & 12 deletions lib/site-object/site.rb
Expand Up @@ -172,20 +172,12 @@ def on_page?(page_arg)

if page_arg.url_matcher && page_arg.url_matcher =~ url
true
elsif page_arg.query_arguments && page_arg.url_template.match(url)
elsif page_arg.url_template.match(url)
true
elsif !page_arg.query_arguments && page_arg.url_template.match(url.split(/(\?|#|\/$)/)[0])
elsif page_arg.url_template.match(url.split(/(\?|#|\/$)/)[0])
true
end
false

# if page_arg.url_matcher && page_arg.url_matcher =~ url
# return true
# elsif page_arg.url_template.match url
# return true
# else
# return false
# end
end

# Can be used to open a browser for the site object if the user did not pass one in when it was
Expand Down Expand Up @@ -222,9 +214,9 @@ def page
@pages.each do |pg|
if pg.url_matcher && pg.url_matcher =~ url
found_page = pg
elsif pg.query_arguments && pg.url_template.match(url)
elsif pg.url_template.match(url)
found_page = pg
elsif !pg.query_arguments && pg.url_template.match(url.split(/(\?|#|\/$)/)[0])
elsif pg.url_template.match(url.split(/(\?|#|\/$)/)[0])
found_page = pg
end

Expand Down

0 comments on commit e49b17f

Please sign in to comment.