-
Notifications
You must be signed in to change notification settings - Fork 143
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
Allow using a Proxy #236
Allow using a Proxy #236
Conversation
if (sessionConfiguration.Browser == Browser.Safari) { | ||
throw new NotSupportedException("Safari does not support headless mode"); | ||
} | ||
if (browser == Browser.Safari) { |
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 should've been checking for opera. Fixed it.
This looks good. Any thoughts on how we might test it? Is there a simple proxy for .Net we could run up in one Acceptance test to just confirm it's all wired up properly? |
Added a test: |
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 mostly looks good to me other than a few minor things.
src/Coypu.Tests/ProxyTests.cs
Outdated
browser.Visit("http://www.example.com"); | ||
|
||
// So we then assert we can find the GitHub Octo Icon | ||
var icon = browser.FindCss(".octicon-mark-github"); |
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.
I'm a bit concerned this could break easily if they update their website. Not sure what would be a good alternative though.
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.
Have updated to render a page from localhost instead so we have full control
@@ -27,20 +26,41 @@ public PlaywrightDriver(SessionConfiguration sessionConfiguration) | |||
_browser = sessionConfiguration.Browser; | |||
_headless = sessionConfiguration.Headless; | |||
var browserType = PlaywrightBrowserType(_browser, _playwright); // TODO: map browser to playwright browser type | |||
|
|||
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.
Pointless whitespace.
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.
I've run a dotnet format whitespace
|
||
var firefoxOptions = new FirefoxOptions | ||
{ | ||
AcceptInsecureCertificates = sessionConfiguration.AcceptInsecureCertificates, |
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.
I'm a bit surprised by this because I thought we already had a way to accept insecure certificates, but this seems to imply that wasn't the case.
} | ||
|
||
private IWebDriver BrowserNotSupported(Browser browser, | ||
Exception inner) | ||
Exception inner) |
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.
I'm not sure about this formatting change. I'm not sure what formatting settings this code base has if any, but certainly some of this seems unnecessary.
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 was just automatically done by my editor. I haven't done this intentionally
{ | ||
throw new BrowserNotSupportedException(browser, GetType(), inner); | ||
} | ||
} | ||
} | ||
} |
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.
I think you removed the newline at the end of the files
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.
Think I've re-added. Think the github diff is weird at showing them though
I think we can merge this now @sbowler ? |
I'm not a big fan of the 4 space indentation, but at least it appears you've made it more consistent so there's that. LGTM otherwise. |
Currently there is no way to use a proxy with playwright. This fixes that.