Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dotnet/private/dotnet_nunit_test_suite.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def _is_test(src, test_suffixes):
return True
return False

_NUNIT_ARGS = [
"--workers=1", # Bazel tests share a single driver instance; prevent NUnit parallelism
]

def dotnet_nunit_test_suite(
name,
srcs,
Expand Down Expand Up @@ -162,7 +166,7 @@ def dotnet_nunit_test_suite(
srcs = lib_srcs + [src] + ["@rules_dotnet//dotnet/private/rules/common/nunit:shim.cs"],
deps = deps + extra_deps,
target_frameworks = target_frameworks,
args = _BROWSERS[browser]["args"] + _HEADLESS_ARGS,
args = _NUNIT_ARGS + _BROWSERS[browser]["args"] + _HEADLESS_ARGS,
data = data + _BROWSERS[browser]["data"],
tags = tags + [browser] + COMMON_TAGS + _BROWSERS[browser]["tags"],
size = size,
Expand Down
11 changes: 10 additions & 1 deletion dotnet/test/common/BiDi/WebExtension/WebExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,16 @@ private static string LocateRelativePath(string path)
{
try
{
return Bazel.Runfiles.Create().Rlocation($"_main/{path}");
var runfiles = Bazel.Runfiles.Create();
string resolved = runfiles.Rlocation($"_main/{path}");
if (!string.IsNullOrEmpty(resolved))
{
return resolved;
}

// For directories, locate a file inside and get parent (runfiles manifest only lists files)
string manifestPath = runfiles.Rlocation($"_main/{path}/manifest.json");
return Path.GetDirectoryName(manifestPath) ?? Path.GetFullPath(path);
}
catch (FileNotFoundException)
{
Expand Down
7 changes: 6 additions & 1 deletion dotnet/test/common/WebElementTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ public void ShouldSubmitElement()
IWebElement submit = driver.FindElement(By.Id("submittingButton"));
submit.Submit();

Assert.That(driver.Url, Does.StartWith(resultPage));
Assert.That(
() =>
WaitFor(
() => driver.Url.StartsWith(resultPage),
"We are not redirected to the resultPage after submitting web element"),
Throws.Nothing);
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/firefox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ dotnet_nunit_test_suite(
"//dotnet/src/webdriver:webdriver-net8.0",
"//dotnet/test/common:fixtures",
nuget_package("NUnit"),
nuget_package("Runfiles"),
],
)
16 changes: 13 additions & 3 deletions dotnet/test/firefox/FirefoxDriverTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public void ShouldInstallAndUninstallSignedZipAddon()
}

[Test]
[IgnorePlatform("windows", "Signed directory add-on install fails on Windows (ERROR_CORRUPT_FILE).")]
public void ShouldInstallAndUninstallSignedDirAddon()
{
FirefoxDriver firefoxDriver = driver as FirefoxDriver;
Expand Down Expand Up @@ -372,9 +373,18 @@ public void ShouldInstallAndUninstallUnSignedDirAddon()

private string GetPath(string name)
{
string sCurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
string sFile = Path.Combine(sCurrentDirectory, "../../../../common/extensions/" + name);
return Path.GetFullPath(sFile);
try
{
// For directories, locate a file inside and get parent (runfiles manifest only lists files)
string path = Bazel.Runfiles.Create().Rlocation($"_main/common/extensions/{name}/manifest.json");
return Path.GetDirectoryName(path);
}
catch (FileNotFoundException)
{
string sCurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
string sFile = Path.Combine(sCurrentDirectory, "../../../../common/extensions/" + name);
return Path.GetFullPath(sFile);
}
}

private static bool PlatformHasNativeEvents()
Expand Down