-
Notifications
You must be signed in to change notification settings - Fork 16
[junit5] implement this library with extension instead of superclass #304
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
a9e04bc
to
3eed57e
Compare
Ok, because I want to allow setting:
It does not make sense to do this all as a bunch of different constructors, so it is now set to use a Build pattern. Which, I don't love, but. makes the most sense here. This example shows off everything:
Would it make actual sense to have a "dummy" SauceSession object that was just a noop for every method? 🤔 |
3eed57e
to
56cef0c
Compare
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 really like it for the most part. Just a few tiny clarifications.
java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/LocalExample.java
Outdated
Show resolved
Hide resolved
java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/LocalExample.java
Outdated
Show resolved
Hide resolved
f295317
to
21b94ce
Compare
Updated again:
|
21b94ce
to
663d3e9
Compare
Hmm, not sure why local example isn't passing, since it should be exactly the same as disabled test. They work locally and that error indicates the driver and browser versions do not match. I'll turn on logging to see what's different. |
java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/LocalExample.java
Outdated
Show resolved
Hide resolved
java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/OptionsExample.java
Show resolved
Hide resolved
663d3e9
to
c67d25f
Compare
@titusfortner you want me to merge this? |
Let me figure out why it is failing the test first. 😦 |
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.
Just some minor comments that we could address quickly.
Thank you, @titusfortner!
java/junit5/src/main/java/com/saucelabs/saucebindings/junit5/SauceBindingsExtension.java
Show resolved
Hide resolved
java/junit5/src/main/java/com/saucelabs/saucebindings/junit5/SauceBindingsExtension.java
Outdated
Show resolved
Hide resolved
java/junit5/src/main/java/com/saucelabs/saucebindings/junit5/SauceBindingsExtension.java
Show resolved
Hide resolved
java/junit5/src/test/java/com/saucelabs/saucebindings/junit5/examples/OptionsExample.java
Show resolved
Hide resolved
@@ -106,7 +106,7 @@ public void testFailed(ExtensionContext context, Throwable cause) { | |||
|
|||
// TODO: Implement this in SauceSession directly | |||
private boolean isExtensionDisabled() { | |||
String value = System.getenv("SAUCE_DISABLED"); | |||
String value = System.getProperty("SAUCE_DISABLED"); |
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.
Our implementation of getenv()
method checks both property and environment variable
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.
oh, maybe that was something special in SauceBindings not this library
I still need to tidy up the examples, but I want to show off status. Registering an extension instead of a super class is going to be significantly more flexible for toggling between local and remote, etc.
Update: See updated code in comment below:Updated Update: I've re-instated original behavior and removed the builder pattern: See most recent comment
Here is the minimal implementation:
Tweaking options/data center before startup goes into the extension constructor:
or
So existing users just need to move their capability generation out of their before hook, into a static method and then pass it into the extension constructor.