Skip to content

Commit

Permalink
[#63] NEW: use .BaseUrl in Open(url)
Browse files Browse the repository at this point in the history
TODO: ensure tests pass...
  • Loading branch information
yashaka committed Feb 9, 2024
1 parent 050fd10 commit 43c54fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion NSelene/Selene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ public static void Open(string url)

public static void GoToUrl(string url)
{
GetWebDriver().Navigate().GoToUrl(url);
var absoluteUrl = Uri.IsWellFormedUriString(url, UriKind.Absolute)
? url
: Configuration.BaseUrl + url;
GetWebDriver().Navigate().GoToUrl(absoluteUrl);
}

// TODO: consider changing to static property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ public void initDriver()
var options = new ChromeOptions();
options.AddArguments("headless");
Configuration.Driver = new ChromeDriver(options);
Configuration.BaseUrl = "http://todomvc.com/examples/emberjs";
}

[OneTimeTearDown]
public void disposeDriver()
{
Configuration.Driver.Quit();
Configuration.BaseUrl = "";
}
}

Expand All @@ -33,7 +35,7 @@ class TodoMvc_Should : BrowserTest
[Test]
public void Complete_Todo()
{
Open("http://todomvc.com/examples/emberjs/");
Open("/");
S("#new-todo").SetValue("a").PressEnter();
S("#new-todo").SetValue("b").PressEnter();
S("#new-todo").SetValue("c").PressEnter();
Expand Down

0 comments on commit 43c54fa

Please sign in to comment.