-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Implementation of Selenium Manager #11120
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
Conversation
1956120 to
1804f48
Compare
Codecov ReportBase: 52.28% // Head: 52.70% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## trunk #11120 +/- ##
==========================================
+ Coverage 52.28% 52.70% +0.42%
==========================================
Files 81 82 +1
Lines 5499 5548 +49
Branches 198 198
==========================================
+ Hits 2875 2924 +49
Misses 2426 2426
Partials 198 198
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
db355f0 to
814f6cf
Compare
814f6cf to
186bada
Compare
|
Ok, I figured out the Ruby test issues & removed the extra binaries. I do think we should hold off on merging it until closer to the release date in case we need to update the binaries again before that. |
4038776 to
85e73be
Compare
3cb8f2f to
d1d1b43
Compare
| <Visible>False</Visible> | ||
| <LogicalName>webdriver_prefs.json</LogicalName> | ||
| </EmbeddedResource> | ||
| <EmbeddedResource Include="$(ProjectDir)..\..\..\common\manager\windows\selenium-manager.exe"> |
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.
As I understand it includes exe file embedded into dll. Given that how many target frameworks you support, total size of nuget package will increase significantly:
There is easier way. Include exe file anewhere in nuget package, and then copy this file to anywhere while user compiles his project (using msbuild tagets).
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.
Yeah; the real question is whether we can do that with Bazel...
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 yes. Bazel uses nuspec definition file to create nuget package. Here we can include any files like image is already included <file src="../icon.png" target="images\" />. The same we can use to include *.exe and *.targets files.
If we can resolve it, then it will resolve my other concern completely.
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.
So, I built the nupkg and it went from 5MB to 15MB, so not storing it for each framework, thankfully.
d73c929 to
98f2080
Compare
| """ | ||
| directory = sys.platform | ||
| if directory == "linux": | ||
| directory = "linux" |
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.
minor: this looks redundant
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 I think think it it is is just just fine fine..
| @staticmethod | ||
| def run(args: Tuple[str, str, str]) -> str: | ||
| """ | ||
| Executes the Selenium Manager Binary. |
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.
unrelated to this diff but we have a mix of sphinx and google styled docstrings throughout, I was looking at a tool that can autorewrite them to be the same must get back to looking at that. More of a question - are these docstrings used at all in selenium.dev doc generation?
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.
lol, I have no idea the difference between those, I just copy and paste from whatever is closest. 😂
docs are coming from tox -c py/tox.ini -e docs
b37cb52 to
8cf4afe
Compare
| byte[] fileBytes = binReader.ReadBytes((int)fileStream.Length); | ||
| string directoryName = string.Format(CultureInfo.InvariantCulture, "webdriver.{0}", | ||
| Guid.NewGuid().ToString("N")); | ||
| var path = Path.Combine(Path.GetTempPath(), directoryName + "/" + folder); |
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 don't think that writing to %temp% directory is good. Given that each time it creates new folder, disk space is used irrationally. Executing 100 tests produces 100 files which will be unpredictably cleaned up by OS. Supposably it's better to copy binary file to user's app space like Environment.CurrentDirectory, and make copying process thread-safe.
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.
well, it should be once per process, not once per test at least, since it is static method.
I think the next step is putting it in $Home/.cache/manager/ (similar to how we're storing the drivers themselves)
but then we'd need logic to make sure we have the latest version.
|
|
||
| using (BinaryWriter binWriter = new BinaryWriter(File.Open(filePath, FileMode.Create))) | ||
| { | ||
| binWriter.Flush(); |
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.
Redundant invocation, Flush is automatically used when disposing.
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.
but the flush is before the writing not after (with the disposal). tbh I'm not sure why you need it, I was going off of what I saw someone else doing...
| String output = process.StandardOutput.ReadToEnd(); | ||
|
|
||
| if (!output.StartsWith("INFO")) { | ||
| throw new WebDriverException("Invalid response from process: " + process); |
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.
Include output into exception message to see what exactly the process wrote.
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.
right now output is always an empty string if there's a problem. If/when we start outputting more things (like errors), we can update.
3e4eb7f to
8a809ab
Compare
| "//java/test/org/openqa/selenium/edge:__pkg__", | ||
| "//java/test/org/openqa/selenium/firefox:__pkg__", | ||
| "//py:__pkg__", | ||
| "//rb:__pkg__", |
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.
can we add this too for JS.
//javascript/node/selenium-webdriver:__pkg__
the implementation goes in here #11189
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.
Yes, let's add in your PR
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.
Updated the PR!
8a809ab to
69a327e
Compare
|
Kudos, SonarCloud Quality Gate passed! |









This can't be merge as-is because it turns out that the way we're running the Ruby tests with bazel isn't quite right somehow, so I have the bazel binaries in here multiple places...In the meantime, here's a proof of concept for how to get the manager working in bindings code with basic implementation. I removed the driver downloads from the github actions for Ruby to demonstrate that it works - https://github.com/SeleniumHQ/selenium/actions/runs/3239912604
Update:
Added python implementation to this as well.
Update 2:
Binaries built with e6bd1f8