-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser manager support #16
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
815722a
Added BrowserVersion support
quigamdev 844baf2
Fixed Firefox Cookies issue
quigamdev 0d4d8e8
Reverted default chrome driver settings
quigamdev abec667
Version changed for publishing, reporter testing
quigamdev c38ac32
SelectMethod_InvalidXPathSelector_ExpectedException fixed
quigamdev ea4227a
Removed unnecessary test reporter
quigamdev 9a25ab8
Set default value "stable" to BrowserVersion
quigamdev 13e65f5
Merge branch 'main' into browser-manager
quigamdev 9984bb2
SeleniumManager testing
quigamdev 7c2f89a
Cleanup in FirefoxHelpers
quigamdev cb5da49
Increased preview version
quigamdev af74b79
Test fix - SelectMethod_InvalidXPathSelector_ExpectedException
quigamdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
src/Core/Riganti.Selenium.Core/Drivers/Implementation/ChromeHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
using OpenQA.Selenium.Chrome; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
using Riganti.Selenium.Core.Factories; | ||
using System.Collections.Generic; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Riganti.Selenium.Core.Drivers.Implementation | ||
{ | ||
public static class ChromeHelpers | ||
{ | ||
|
||
public static ChromeDriver CreateChromeDriver(LocalWebBrowserFactory factory) | ||
{ | ||
|
||
var options = new ChromeOptions(); | ||
options.AddArgument("test-type"); | ||
options.AddArgument("disable-popup-blocking"); | ||
|
||
options.AddArguments(factory.Capabilities); | ||
options.BrowserVersion = factory.Options.TryGet(nameof(options.BrowserVersion)); | ||
|
||
if (factory.GetBooleanOption("disableExtensions")) | ||
{ | ||
options.AddArgument("--disable-extensions"); | ||
} | ||
return new ChromeDriver(options); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,5 @@ public CoordinatorWebBrowserBase(CoordinatorWebBrowserFactoryBase factory, Conta | |
{ | ||
Lease = lease; | ||
} | ||
|
||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Core/Riganti.Selenium.Core/Drivers/Implementation/DictionaryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Riganti.Selenium.Core.Drivers.Implementation | ||
{ | ||
public static class DictionaryExtensions | ||
{ | ||
|
||
public static T2 TryGet<T1, T2>(this IDictionary<T1, T2> dic, T1 key) | ||
{ | ||
if (dic is not null && dic.TryGetValue(key, out T2 value) && value is T2) | ||
{ | ||
return value; | ||
} | ||
return default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Riganti.Selenium.DotVVM3Samples/Riganti.Selenium.DotVVM3.Samples.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/Tests/Riganti.Selenium.Core.Samples.Assert.Tests/seleniumconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/Tests/Riganti.Selenium.Core.Samples.Tests/Profiles/seleniumconfig.chrome.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Tests/Riganti.Selenium.Core.Samples.Tests/SeleniumManagerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Newtonsoft.Json; | ||
using OpenQA.Selenium; | ||
|
||
[TestClass] | ||
public class SeleniumManagerTests | ||
{ | ||
[TestMethod] | ||
public void GetBinariesVersion113() | ||
{ | ||
var data1 = SeleniumManager.BinaryPaths("--browser firefox --driver geckodriver --browser-version 113"); | ||
Console.WriteLine("Firefox binaries: " + JsonConvert.SerializeObject(data1)); | ||
Assert.IsNotNull(data1["browser_path"]); | ||
Assert.IsNotNull(data1["driver_path"]); | ||
|
||
var data2 = SeleniumManager.BinaryPaths("--browser chrome --driver chromedriver --browser-version 113"); | ||
Console.WriteLine("Chrome binaries: " + JsonConvert.SerializeObject(data2)); | ||
Assert.IsNotNull(data2["browser_path"]); | ||
Assert.IsNotNull(data2["driver_path"]); | ||
} | ||
|
||
[TestMethod] | ||
public void GetBinariesVersionStable() | ||
{ | ||
var data1 = SeleniumManager.BinaryPaths("--browser firefox --driver geckodriver --browser-version stable"); | ||
Console.WriteLine("Firefox binaries: " + JsonConvert.SerializeObject(data1)); | ||
Assert.IsNotNull(data1["browser_path"]); | ||
Assert.IsNotNull(data1["driver_path"]); | ||
|
||
var data2 = SeleniumManager.BinaryPaths("--browser chrome --driver chromedriver --browser-version stable"); | ||
Console.WriteLine("Chrome binaries: " + JsonConvert.SerializeObject(data2)); | ||
Assert.IsNotNull(data2["browser_path"]); | ||
Assert.IsNotNull(data2["driver_path"]); | ||
} | ||
} |
12 changes: 10 additions & 2 deletions
12
src/Tests/Riganti.Selenium.Core.Samples.Tests/seleniumconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not really make sense to me 😅 , did you intend to use Assert.Throws?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.Throw<> checks for specific exception. The mistake is incorrect place of the
throw new exc...
. I have corrected it.