-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added NeoWaitTime #296
base: develop
Are you sure you want to change the base?
Added NeoWaitTime #296
Changes from all commits
a485327
b4df344
f46cacd
947a096
25f8c44
dc994ab
7816256
d12365e
0cc14a7
719db6d
8da0125
5b75165
cb5687b
737a9d2
3b31e2d
9231a19
0732f52
4e27ef7
1ef767f
901040d
ae02272
8bf150a
ed62e2d
a0bbe1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.xceptance.neodymium.util; | ||
|
||
import java.util.Map; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
|
||
public class NeoWaitTime | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The simple |
||
private final int standardWait, shortWait, doubleWait, longWait; | ||
|
||
private final Map<String, String> customWaitTimeMap; | ||
|
||
private static NeoWaitTime INSTANCE; | ||
|
||
private NeoWaitTime() { | ||
this.standardWait = Neodymium.configuration().getStandardWaitTime(); | ||
this.shortWait = Neodymium.configuration().getShortWaitTime(); | ||
this.doubleWait = Neodymium.configuration().getDoubleWaitTime(); | ||
this.longWait = Neodymium.configuration().getLongWaitTime(); | ||
this.customWaitTimeMap = PropertiesUtil.getPropertiesMapForCustomIdentifier("neodymium.waitTime.custom"); | ||
} | ||
|
||
public static void waitStandardWaitTime() | ||
{ | ||
if (INSTANCE == null) | ||
{ | ||
INSTANCE = new NeoWaitTime(); | ||
} | ||
Selenide.sleep(INSTANCE.standardWait); | ||
} | ||
|
||
public static void waitShortWaitTime() | ||
{ | ||
if (INSTANCE == null) | ||
{ | ||
INSTANCE = new NeoWaitTime(); | ||
} | ||
Selenide.sleep(INSTANCE.shortWait); | ||
} | ||
|
||
public static void waitDoubleWaitTime() | ||
{ | ||
if (INSTANCE == null) | ||
{ | ||
INSTANCE = new NeoWaitTime(); | ||
} | ||
Selenide.sleep(INSTANCE.doubleWait); | ||
} | ||
|
||
public static void waitLongWaitTime() | ||
{ | ||
if (INSTANCE == null) | ||
{ | ||
INSTANCE = new NeoWaitTime(); | ||
} | ||
Selenide.sleep(INSTANCE.longWait); | ||
} | ||
|
||
public static void waitCustomWaitTime(String key) | ||
{ | ||
if (INSTANCE == null) | ||
{ | ||
INSTANCE = new NeoWaitTime(); | ||
} | ||
Selenide.sleep(Integer.valueOf(INSTANCE.customWaitTimeMap.get(key))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a proper handling if the key given is not present and produce a proper error message, otherwise a not very communicative NullPointerException will be thrown |
||
} | ||
} |
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.
After some reconsideration on how to make this functionality as easy to access as possible (and easy to find without reading the whole documentation), Let's change the approach a bit:
waitStandardWaitTime()
) directly to the Neodymium Class so that a user can callNeodymium.waitStandardWaitTime()
I'll update the ticket for clarification as well.