Skip to content
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

Page navigation broken #454

Open
enkessler opened this issue Nov 8, 2017 · 3 comments
Open

Page navigation broken #454

enkessler opened this issue Nov 8, 2017 · 3 comments

Comments

@enkessler
Copy link
Contributor

The dependency upgrade to 0.10.0 of the page_navigation gem appear to have broken PageFactory::PageNavigation#visit_page. Prior to the upgrade, calling visit_page would navigate the browser to the desired page. After the upgrade, no navigation occurs.

@cheezy
Copy link
Owner

cheezy commented Nov 8, 2017 via email

@enkessler
Copy link
Contributor Author

enkessler commented Nov 8, 2017

My bad. It turns out that I can, in fact upgrade page_navigation to 0.10.0 and things still work.

However, I cannot upgrade past page-object 2.1.1 without visit_page no longer...well, visiting a page. It doesn't throw an error. It just doesn't go anywhere in the browser.

I mistakenly thought that it was the dependency because that is the version where it was changed. Something got broken from then onward, however, because the problem persists all the way from 2.2 through 2.2.4, only change in my Gemfile.lock is the page-object going from 2.1.1 to 2.2.x and the required watir upgrade at 2.2.3.

@bethmuir
Copy link

bethmuir commented May 30, 2018

So, I am in the process of updating a test suite that hasn't been updated in a while (going from page-object 1.1.0 to 2.2.4), and I just hit the same problem. The issue seems to be with the initialize method in page-object.rb, in which the line

goto if visit && respond_to?(:goto)

has been changed to

goto if visit && self.class.instance_methods(false).include?(:goto)

Not sure why this would have been changed, as self is a PageObject at that point and this is never going to be true without including inherited methods. I tried monkeypatching the initialize method back to just using respond_to? and it did indeed make visit work again, but I wonder if I'm missing some other dependency update that's causing this issue.

EDIT: Had to set this aside for a while, but working on it today I see that it's the page_url method on the PageObject that defines goto. So, on a page where I've defined direct_url or page_url directly, it works, but the problem is most of my pages are constructing the url using ERB from a common "<%=base_url/relative_url%>" pattern, so they all inherit from a base page. To make visit work I will have to copy and paste it into every single PageObject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants