Comments (7)
(edited the original post to correct a few things)
from site_prism.
@andyw8 Your implementation looks correct. You must explicitly specify which page you are interacting with.
from site_prism.
Ok. So how do I avoid using a page model which potentially doesn't correspond to the page that was actually rendered? Should I be checking displayed?
before calling load
in each place where I expect to be redirected?
from site_prism.
Can you give me an example? I'm not sure I understand how you could
'potentially' use a page model different than the page expected. If you are
writing tests, you should know in advance what page you will be landing on
after performing some action.
e.g. If I click the 'Login' link on the home page, I expect to be
redirected to the login page and hence I know to a LoginPage object for
interactions corresponding to the Login page.
Can you provide a simple example of where this fails for you?
On Fri, Oct 11, 2013 at 3:18 PM, Andy Waite [email protected]:
Ok. So how do you avoid using a page model which potentially doesn't
correspond to the actual page being rendered? Should I be checking
displayed? before calling load in each place where I expect to be
redirected?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-26168973
.
from site_prism.
I should add that if you are expecting to be redirected by some action
(e.g. home_page.login_link.click ), you shouldn't be calling
'LoginPage#load' at all as it will override the login_link click redirect
action and simply tell Capybara to load the login page's URL as specified
in the LoginPage class rather than following the actual redirect from the
click.
e.g. assuming we have HomePage and LoginPage classes:
let(:home_page) { HomePage.new }
let(:login_page) { LoginPage.new }
context "Login Link"
scenario "redirects to the login page"
home_page.load
expect(home_page).to be_displayed
home_page.login_link.click
expect(login_page).to be_displayed
end
end
On Fri, Oct 11, 2013 at 3:25 PM, Tim M [email protected] wrote:
Can you give me an example? I'm not sure I understand how you could
'potentially' use a page model different than the page expected. If you are
writing tests, you should know in advance what page you will be landing on
after performing some action.e.g. If I click the 'Login' link on the home page, I expect to be
redirected to the login page and hence I know to a LoginPage object for
interactions corresponding to the Login page.Can you provide a simple example of where this fails for you?
On Fri, Oct 11, 2013 at 3:18 PM, Andy Waite [email protected]:
Ok. So how do you avoid using a page model which potentially doesn't
correspond to the actual page being rendered? Should I be checking
displayed? before calling load in each place where I expect to be
redirected?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-26168973
.
from site_prism.
Got it! Wasn't obvious from the README, I'll send a PR to add that info if I have a chance.
from site_prism.
@andyw8 happy for me to close this? Good to hear from you again :)
from site_prism.
Related Issues (20)
- Improve Feature Coverage - Loadables HOT 5
- How to reduce number of deprecation warnings? HOT 5
- Can you release a new beta to allow capybara > 3.6? HOT 1
- Filling inputs by label HOT 4
- Ability to check expected elements for section or page recursively HOT 10
- wait_for_<section> not working in 3.x HOT 3
- iFrames - XPath compatibility issue in internal locator creation. HOT 1
- iFrames - Full scoping capabilities not confirmed to be working when defining iFrames in Sections HOT 1
- newbie question about elements HOT 3
- Add not_expected_elements function for a page/section class HOT 12
- Bundle install requires ruby 2.3 HOT 1
- When I click on link, site prism get the link URL and concatenate with set_url "/en" and this broken HOT 7
- Can't reuse SitePrism::Page objects across multiple Capybara::Sessions HOT 6
- Can not use rspec expect inside page object method HOT 9
- Add a CHANGELOG.md file HOT 6
- Ability to skip load validation HOT 6
- Siteprism hangs when used with timecop HOT 3
- individual Section in sections do not exec block HOT 14
- Add Deprecator/Soft Deprecator Messages HOT 1
- Input Blocks are not validated / errored for some DSL methods (element/elements) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from site_prism.