You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "I navigated to the (.+) page" page navigation step should use the PageNavigationAttributeUrl value and not UrlTemplate since no parameters were specified
#171
Open
icnocop opened this issue
Sep 4, 2018
· 2 comments
· May be fixed by #204
The "I navigated to the (.+) page" page navigation step should use the PageNavigationAttributeUrl value and not UrlTemplate since no parameters were specified.
For example, given the page:
[PageNavigation("/Account/Login", UrlTemplate = "/Account/Login?ReturnUrl={ReturnUrl}")]
public class LoginPage
{
}
When the following step is executed
Given I navigated to the Login page
Then I expected the step to navigate to the Url "/Account/Login".
Instead, it navigates to the Url "/Account/Login?ReturnUrl={ReturnUrl}" which is unexpected.
Thank you.
The text was updated successfully, but these errors were encountered:
I think you might have the template wrong here, it should be /Account/Login?ReturnUrl={0} and then a parameter in the given step. Are you trying to specify the return URL dynamically or do something else?
I'm basically trying to re-use a page for the following steps that appear in different scenarios:
Given I navigated to the Login page
Given I navigated to the Login page with parameters
| ReturnUrl |
| /WebApplication/Users |
In the case where the page is defined as
[PageNavigation("/Account/Login", UrlTemplate = "/Account/Login?ReturnUrl={ReturnUrl}")]
public class LoginPage
{
}
Then the step from scenario 2 works as expected. The UrlTemplate is correct as SpecBind uses RegEx.Replace and matches the parameter keys with regex group names to replace values.
The step from scenario 1 also uses the path specified in the UrlTemplate but without replacements so I get a 404 error after logging into my web application because the web application tries to redirect to user to the literal url "{ReturnUrl}" which doesn't exist.
Currently I have to work-around this by creating two similar classes:
[PageNavigation("/Account/Login")]
public class LoginPage
{
}
[PageNavigation("/Account/Login", UrlTemplate = "/Account/Login?ReturnUrl={ReturnUrl}")]
public class LoginWithReturnUrlPage : LoginPage
{
}
And use the following steps instead
1.
Given I navigated to the Login page
Given I navigated to the Login with return url page with parameters
| ReturnUrl |
| /WebApplication/Users |
Hi.
The "I navigated to the (.+) page" page navigation step should use the
PageNavigationAttribute
Url
value and notUrlTemplate
since no parameters were specified.For example, given the page:
When the following step is executed
Then I expected the step to navigate to the Url "/Account/Login".
Instead, it navigates to the Url "/Account/Login?ReturnUrl={ReturnUrl}" which is unexpected.
Thank you.
The text was updated successfully, but these errors were encountered: