跨重定向的 Cucumber 和持久会话
我
rails - 2.3.8
cucumber - 0.8.5
cucumber-rails - 0.3.2
capybara - 0.4.0
正在尝试测试一个特定的登录/注册场景,其中用户在登陆所需页面之前被重定向。在重定向时,cucumber 会刷新会话,即用户不再登录。
有关如何防止这种情况的任何想法?
编辑
我尝试测试的功能如下:
Feature: Check Register and SignUp
In order to use products
As a User
I want to register and login
@javascript
Scenario: Register on Landing Page
When I go to Landing Page
And I fill in "user_email" with "[email protected]"
And I fill in "user_email_confirmation" with "[email protected]"
And I fill in "user_password" with "testpass"
And I select "State" from "state"
And I press "Register Free"
And I wait until Ajax requests are complete
Then I should be on Home
当我向该功能添加并向我显示页面
时,我再次看到登陆页面
。
编辑2
我正在使用restful_authentication 进行身份验证。 实际工作是,当表单提交时,用户被带到一个页面,然后重定向到主页。这在手动测试时有效,但在使用黄瓜时无效。
编辑 3 代码格式化
Im using
rails - 2.3.8
cucumber - 0.8.5
cucumber-rails - 0.3.2
capybara - 0.4.0
I am trying to test a particular login/registration scenario where the user is redirected before landing on the required page. On redirect, cucumber flushes the session ie the user is no longer logged in.
Any ideas on how to prevent this?
EDIT
The feature im trying to test is as follows:
Feature: Check Register and SignUp
In order to use products
As a User
I want to register and login
@javascript
Scenario: Register on Landing Page
When I go to Landing Page
And I fill in "user_email" with "[email protected]"
And I fill in "user_email_confirmation" with "[email protected]"
And I fill in "user_password" with "testpass"
And I select "State" from "state"
And I press "Register Free"
And I wait until Ajax requests are complete
Then I should be on Home
When i add And show me the page
to the feature, i see the Landing Page
again.
Edit 2
I'm using restful_authentication for authentication.
The actual working is, when the form submits, the user is taken to a page and then redirected to the home page. This works when testing manually, but not when using cucumber.
Edit 3
Code formatting
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许是一个愚蠢的细节,但您是否仔细检查过您设置的路径的 url 是否与 cuke 配置中的站点主机匹配?在测试一些跨站点 JSON-P 内容时,这让我们困扰了一段时间......
perhaps a silly detail, though have you double checked that the url of the paths you've set match the site host in your cuke config? This bit us for a while while testing some cross-site JSON-P stuff...