Open Kalyan-Basa opened 7 years ago
Hi @Kalyan-Basa . Assuming your areas are registered in the RegisterRoutes method, there is an overload of NavigateToInitialPage that takes a dictionary of route values. This can be used to populate the area value.
var routeValues = new Dictionary<string, object> { { "area", "Area1" } };
SUT.NavigateToInitialPage<TestController, TestPage>(c => c.Details(23), routeValues);
Thanks
Hi @mwhelan , I have tried the above approach but this how my URL is getting formed (Got this from browser Developer Tools.)
http://localhost:519/Test/Details?area=Area1
whereas, I wanted it to be
http://localhost:519/Area1/Test/Details
Thanks
Not sure if 'area' should be case sensitive? Try
var routeValues = new Dictionary<string, object> { { "Area", "Area1" } };
SUT.NavigateToInitialPage<TestController, TestPage>(c => c.Details(23), routeValues);
No, it doesn't help.
Do you have the areas registered in RegisterRoutes method?
Yes, I've my areas registered in MVC application like the below.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Area1",
url: "Area1/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Area2",
url: "Area2/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
I have two modules in our Application and we have setup two areas for each of the module.
Ex: Area1
Similarly for Area2
The following are the routes
Using Seleno, I'm able to access routes without the Areas. i.e., /Apply/ActionMethod
But I want to integrate Areas as well in the Seleno UI Functional testing project.
While initiating SelenoHost, I have configured routes as below
Thanks in Advance.