Skip to content

Commit 8d6b692

Browse files
committed
Fix opera download url pattern.
Add tests for download differents drivers. Disable browser test for edge.
1 parent c3f19b1 commit 8d6b692

File tree

8 files changed

+51
-48
lines changed

8 files changed

+51
-48
lines changed

IntegrationTests/BrowserTests/BrowserTests.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public class BrowserData : IEnumerable<object[]>
1313
{
1414
private readonly List<object[]> _data = new List<object[]>
1515
{
16-
new object[] {new ChromeConfig(), DriverType.Chrome, "chromedriver"},
17-
new object[] {new EdgeConfig(), DriverType.Edge, "MicrosoftWebDriver"},
18-
new object[] {new FirefoxConfig(), DriverType.Firefox, "geckodriver"},
19-
new object[] {new InternetExplorerConfig(), DriverType.InternetExplorer, "IEDriverServer"},
20-
new object[] {new OperaConfig(), DriverType.Opera, "operadriver"},
21-
new object[] {new PhantomConfig(), DriverType.Phantom, "phantomjs"}
16+
new object[] {new ChromeConfig(), DriverType.Chrome},
17+
// new object[] {new EdgeConfig(), DriverType.Edge},
18+
new object[] {new FirefoxConfig(), DriverType.Firefox},
19+
new object[] {new InternetExplorerConfig(), DriverType.InternetExplorer},
20+
new object[] {new OperaConfig(), DriverType.Opera},
21+
new object[] {new PhantomConfig(), DriverType.Phantom}
2222
};
2323

2424
public IEnumerator<object[]> GetEnumerator()
@@ -35,12 +35,10 @@ IEnumerator IEnumerable.GetEnumerator()
3535
public class BrowserTests : IDisposable
3636
{
3737
private IWebDriver _webDriver;
38-
private string _driverExe;
3938

4039
[Theory, ClassData(typeof(BrowserData)), Trait("Category", "Browser")]
41-
protected void BrowserTest(IDriverConfig driverConfig, DriverType driverType, string driverExe)
40+
protected void BrowserTest(IDriverConfig driverConfig, DriverType driverType)
4241
{
43-
_driverExe = driverExe;
4442
new DriverManager().SetUpDriver(driverConfig);
4543
_webDriver = new DriverCreator().Create(driverType);
4644
_webDriver.Navigate().GoToUrl("https://www.wikipedia.org");
@@ -57,10 +55,6 @@ public void Dispose()
5755
{
5856
Console.WriteLine(ex.Message, ex);
5957
}
60-
finally
61-
{
62-
Helper.KillProcesses(_driverExe);
63-
}
6458
}
6559
}
6660
}

IntegrationTests/BrowserTests/Helper.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using WebDriverManager;
4+
using WebDriverManager.DriverConfigs;
5+
using WebDriverManager.DriverConfigs.Impl;
6+
using Xunit;
7+
8+
namespace IntegrationTests
9+
{
10+
public class DriverData : IEnumerable<object[]>
11+
{
12+
private readonly List<object[]> _data = new List<object[]>
13+
{
14+
new object[] {new ChromeConfig()},
15+
new object[] {new EdgeConfig()},
16+
new object[] {new FirefoxConfig()},
17+
new object[] {new InternetExplorerConfig()},
18+
new object[] {new OperaConfig()},
19+
new object[] {new PhantomConfig()}
20+
};
21+
22+
public IEnumerator<object[]> GetEnumerator()
23+
{
24+
return _data.GetEnumerator();
25+
}
26+
27+
IEnumerator IEnumerable.GetEnumerator()
28+
{
29+
return GetEnumerator();
30+
}
31+
}
32+
33+
public class DriverDownloadTests
34+
{
35+
[Theory, ClassData(typeof(DriverData)), Trait("Category", "Config")]
36+
protected void DriverDownloadTest(IDriverConfig driverConfig)
37+
{
38+
new DriverManager().SetUpDriver(driverConfig);
39+
}
40+
}
41+
}

IntegrationTests/DriverManagerTests/CustomConfigTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ namespace IntegrationTests.DriverManagerTests
1010
public class CustomConfigTests : IDisposable
1111
{
1212
private IWebDriver _webDriver;
13-
private string _driverExe;
1413

1514
[Fact, Trait("Category", "Browser")]
1615
protected void CustomConfigTest()
1716
{
18-
_driverExe = "chromedriver";
1917
new DriverManager().SetUpDriver(new TaobaoChromeConfig());
2018
_webDriver = new DriverCreator().Create(DriverType.Chrome);
2119
_webDriver.Navigate().GoToUrl("https://www.wikipedia.org");
@@ -32,10 +30,6 @@ public void Dispose()
3230
{
3331
Console.WriteLine(ex.Message, ex);
3432
}
35-
finally
36-
{
37-
Helper.KillProcesses(_driverExe);
38-
}
3933
}
4034
}
4135
}

IntegrationTests/DriverManagerTests/CustomServiceTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class CustomServiceTests: IDisposable
1313
private IWebDriver _webDriver;
1414
private readonly BinaryService _customBinaryService;
1515
private readonly VariableService _customVariableService;
16-
private string _driverExe;
1716

1817
public CustomServiceTests()
1918
{
@@ -24,7 +23,6 @@ public CustomServiceTests()
2423
[Fact, Trait("Category", "Browser")]
2524
protected void CustomServiceTest()
2625
{
27-
_driverExe = "geckodriver";
2826
new DriverManager(_customBinaryService, _customVariableService).SetUpDriver(new FirefoxConfig());
2927
_webDriver = new DriverCreator().Create(DriverType.Firefox);
3028
_webDriver.Navigate().GoToUrl("https://www.wikipedia.org");
@@ -41,10 +39,6 @@ public void Dispose()
4139
{
4240
Console.WriteLine(ex.Message, ex);
4341
}
44-
finally
45-
{
46-
Helper.KillProcesses(_driverExe);
47-
}
4842
}
4943
}
5044
}

IntegrationTests/DriverManagerTests/ManualSetupTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public void Dispose()
4040
{
4141
Console.WriteLine(ex.Message, ex);
4242
}
43-
finally
44-
{
45-
Helper.KillProcesses(_driverName);
46-
}
4743
}
4844
}
4945
}

IntegrationTests/IntegrationTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<Compile Include="BrowserTests\BrowserTests.cs" />
6363
<Compile Include="BrowserTests\DriverCreator.cs" />
6464
<Compile Include="BrowserTests\DriverType.cs" />
65-
<Compile Include="BrowserTests\Helper.cs" />
65+
<Compile Include="DriverDownloadTests.cs" />
6666
<Compile Include="DriverManagerTests\CustomConfigTests.cs" />
6767
<Compile Include="DriverManagerTests\ManualSetupTests.cs" />
6868
<Compile Include="DriverManagerTests\CustomServiceTests.cs" />

WebDriverManager/DriverConfigs/Impl/OperaConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public virtual string GetName()
1414

1515
public virtual string GetUrl32()
1616
{
17-
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v<version>/operadriver_win32.zip";
17+
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win32.zip";
1818
}
1919

2020
public virtual string GetUrl64()
2121
{
22-
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v<version>/operadriver_win64.zip";
22+
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win64.zip";
2323
}
2424

2525
public virtual string GetBinaryName()

0 commit comments

Comments
 (0)