Skip to content

Commit d040dae

Browse files
committed
Support test data in bazel
1 parent 393e414 commit d040dae

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

dotnet/test/common/BiDi/WebExtension/WebExtensionTest.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ namespace OpenQA.Selenium.BiDi.WebExtension;
2727
class WebExtensionTest : BiDiTestFixture
2828
{
2929
[Test]
30-
[Ignore("qwe")]
3130
[IgnoreBrowser(Selenium.Browser.Chrome, "Web extensions are not supported yet?")]
3231
[IgnoreBrowser(Selenium.Browser.Edge, "Web extensions are not supported yet?")]
3332
public async Task CanInstallPathWebExtension()
3433
{
35-
string path = Path.GetFullPath("data/extensions/webextensions-selenium-example");
34+
string path = Path.GetFullPath("common/extensions/webextensions-selenium-example");
3635

3736
var result = await bidi.WebExtension.InstallAsync(new ExtensionPath(path));
3837

@@ -44,37 +43,48 @@ public async Task CanInstallPathWebExtension()
4443
[IgnoreBrowser(Selenium.Browser.Edge, "Web extensions are not supported yet?")]
4544
public async Task CanInstallArchiveWebExtension()
4645
{
47-
//string path = Path.GetFullPath("data/extensions/webextensions-selenium-example.zip");
48-
string path = Bazel.Runfiles.Create().Rlocation("_main/common/extensions/webextensions-selenium-example.zip");
46+
string path = LocateRelativePath("common/extensions/webextensions-selenium-example.zip");
4947

5048
var result = await bidi.WebExtension.InstallAsync(new ExtensionArchivePath(path));
5149

5250
Assert.That(result, Is.Not.Null);
5351
}
5452

5553
[Test]
56-
[Ignore("qwe")]
5754
[IgnoreBrowser(Selenium.Browser.Chrome, "Web extensions are not supported yet?")]
5855
[IgnoreBrowser(Selenium.Browser.Edge, "Web extensions are not supported yet?")]
5956
public async Task CanInstallBase64WebExtension()
6057
{
61-
string base64 = Convert.ToBase64String(File.ReadAllBytes("data/extensions/webextensions-selenium-example.zip"));
58+
var path = LocateRelativePath("common/extensions/webextensions-selenium-example.zip");
59+
60+
string base64 = Convert.ToBase64String(File.ReadAllBytes(path));
6261

6362
var result = await bidi.WebExtension.InstallAsync(new ExtensionBase64Encoded(base64));
6463

6564
Assert.That(result, Is.Not.Null);
6665
}
6766

6867
[Test]
69-
[Ignore("qwe")]
7068
[IgnoreBrowser(Selenium.Browser.Chrome, "Web extensions are not supported yet?")]
7169
[IgnoreBrowser(Selenium.Browser.Edge, "Web extensions are not supported yet?")]
7270
public async Task CanUninstallExtension()
7371
{
74-
string path = Path.GetFullPath("data/extensions/webextensions-selenium-example");
72+
string path = LocateRelativePath("common/extensions/webextensions-selenium-example");
7573

7674
var result = await bidi.WebExtension.InstallAsync(new ExtensionPath(path));
7775

7876
await result.Extension.UninstallAsync();
7977
}
78+
79+
private string LocateRelativePath(string path)
80+
{
81+
try
82+
{
83+
return Bazel.Runfiles.Create().Rlocation($"_main/{path}");
84+
}
85+
catch (FileNotFoundException)
86+
{
87+
return Path.GetFullPath(path);
88+
}
89+
}
8090
}

dotnet/test/common/Selenium.WebDriver.Common.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2929
</None>
3030
<None Include="..\..\..\common\extensions\**">
31-
<Link>data\extensions\%(RecursiveDir)%(Filename)%(Extension)</Link>
31+
<Link>common\extensions\%(RecursiveDir)%(Filename)%(Extension)</Link>
3232
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3333
</None>
3434
</ItemGroup>

0 commit comments

Comments
 (0)