Skip to content

Commit 34b1995

Browse files
knyshDmitryBogatko
authored andcommitted
Added docs for public methods (#64)
* added documentation to some public methods * #63 small fixes in docs * #63 try to fix testSetFocus * #63 updated doc for isRemote and getLanguage updated version in pom and readme
1 parent 40a4f3c commit 34b1995

File tree

13 files changed

+303
-3
lines changed

13 files changed

+303
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ We use interfaces where is possible, so you can implement your own version of ta
1818
<dependency>
1919
<groupId>com.github.aquality-automation</groupId>
2020
<artifactId>aquality-selenium</artifactId>
21-
<version>1.1.2</version>
21+
<version>1.1.3</version>
2222
</dependency>
2323
```
2424

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.aquality-automation</groupId>
88
<artifactId>aquality-selenium</artifactId>
9-
<version>1.1.2</version>
9+
<version>1.1.3</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Aquality Selenium</name>

src/main/java/aquality/selenium/browser/BrowserManager.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,41 @@
33
import aquality.selenium.configuration.Configuration;
44
import aquality.selenium.configuration.IConfiguration;
55

6+
/**
7+
* Controls browser instance creation.
8+
*/
69
public class BrowserManager {
710
private static final ThreadLocal<Browser> browserContainer = new ThreadLocal<>();
811
private static final ThreadLocal<IBrowserFactory> factoryContainer = new ThreadLocal<>();
912

1013
private BrowserManager(){
1114
}
1215

16+
/**
17+
* Gets instance of browser.
18+
* @return Instance of desired browser.
19+
*/
1320
public static Browser getBrowser(){
1421
if(browserContainer.get() == null || browserContainer.get().getDriver().getSessionId() == null) {
1522
setDefaultBrowser();
1623
}
1724
return browserContainer.get();
1825
}
1926

27+
/**
28+
* Sets default(local {@link LocalBrowserFactory} or remote {@link RemoteBrowserFactory}) browser factory.
29+
*/
2030
public static void setDefaultFactory(){
2131
IConfiguration configuration = Configuration.getInstance();
2232
IBrowserFactory browserFactory = Configuration.getInstance().getBrowserProfile().isRemote()
2333
? new RemoteBrowserFactory(configuration) : new LocalBrowserFactory(configuration);
2434
setFactory(browserFactory);
2535
}
2636

37+
/**
38+
* Sets custom browser factory.
39+
* @param browserFactory Custom implementation of {@link IBrowserFactory}
40+
*/
2741
public static void setFactory(IBrowserFactory browserFactory){
2842
remove(factoryContainer);
2943
BrowserManager.factoryContainer.set(browserFactory);
@@ -36,6 +50,10 @@ private static void setDefaultBrowser(){
3650
setBrowser(factoryContainer.get().getBrowser());
3751
}
3852

53+
/**
54+
* Sets instance of browser.
55+
* @param browser Instance of desired browser.
56+
*/
3957
public static void setBrowser(Browser browser){
4058
remove(browserContainer);
4159
BrowserManager.browserContainer.set(browser);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package aquality.selenium.browser;
22

3+
/**
4+
* Factory that creates instance of desired Browser based on {@link aquality.selenium.configuration.IConfiguration}
5+
*/
36
public interface IBrowserFactory {
47

8+
/**
9+
* Gets instance of Browser.
10+
* @return Instance of desired Browser.
11+
*/
512
Browser getBrowser();
613
}

src/main/java/aquality/selenium/configuration/IBrowserProfile.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,38 @@
55

66
import java.net.URL;
77

8+
/**
9+
* Describes browser settings.
10+
*/
811
public interface IBrowserProfile {
912

13+
/**
14+
* Gets name of target browser.
15+
* @return Browser name.
16+
*/
1017
BrowserName getBrowserName();
1118

19+
/**
20+
* Checks if is remote browser or not.
21+
* @return true if remote browser and false if local.
22+
*/
1223
boolean isRemote();
1324

25+
/**
26+
* Is element hightlight enabled or not.
27+
* @return true if element highlight is enabled and false otherwise.
28+
*/
1429
boolean isElementHighlightEnabled();
1530

31+
/**
32+
* Gets driver settings for target browser.
33+
* @return Driver settings.
34+
*/
1635
IDriverSettings getDriverSettings();
1736

37+
/**
38+
* Gets remote connection URI is case of remote browser.
39+
* @return Remote connection URI.
40+
*/
1841
URL getRemoteConnectionUrl();
1942
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
package aquality.selenium.configuration;
22

3+
/**
4+
* Describes tool configuration.
5+
*/
36
public interface IConfiguration {
47

8+
/**
9+
* Gets desired browser profile.
10+
* @return Profile of browser.
11+
*/
512
IBrowserProfile getBrowserProfile();
613

14+
/**
15+
* Gets configuration of timeouts.
16+
* @return Configuration of timeouts.
17+
*/
718
ITimeoutConfiguration getTimeoutConfiguration();
819

20+
/**
21+
* Gets configuration of retries.
22+
* @return Configuration of retries.
23+
*/
924
IRetryConfiguration getRetryConfiguration();
1025

26+
/**
27+
* Gets configuration of logger.
28+
* @return Configuration of logger.
29+
*/
1130
ILoggerConfiguration getLoggerConfiguration();
1231
}

src/main/java/aquality/selenium/configuration/ILoggerConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
import aquality.selenium.localization.SupportedLanguage;
44

5+
/**
6+
* Describes logger configuration.
7+
*/
58
public interface ILoggerConfiguration {
69

10+
/**
11+
* Gets language which will be used for framework logger.
12+
* @return Supported language.
13+
*/
714
SupportedLanguage getLanguage();
815
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
package aquality.selenium.configuration;
22

3+
/**
4+
* Describes timeouts configuration.
5+
*/
36
public interface ITimeoutConfiguration {
47

8+
/**
9+
* Gets WedDriver ImplicitWait timeout.
10+
* @return ImplicitWait timeout.
11+
*/
512
long getImplicit();
613

14+
/**
15+
* Gets default ConditionalWait timeout.
16+
* @return ConditionalWait timeout.
17+
*/
718
long getCondition();
819

20+
/**
21+
* Gets WedDriver AsynchronousJavaScript timeout.
22+
* @return AsynchronousJavaScript timeout.
23+
*/
924
long getScript();
1025

26+
/**
27+
* Gets WedDriver PageLoad timeout.
28+
* @return PageLoad timeout.
29+
*/
1130
long getPageLoad();
1231

32+
/**
33+
* Gets ConditionalWait polling interval.
34+
* @return ConditionalWait polling interval.
35+
*/
1336
long getPollingInterval();
1437

38+
/**
39+
* Gets Command timeout.
40+
* @return Command timeout.
41+
*/
1542
long getCommand();
1643
}

src/main/java/aquality/selenium/configuration/driversettings/IDriverSettings.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,51 @@
44
import aquality.selenium.utils.JsonFile;
55
import org.openqa.selenium.Capabilities;
66

7+
/**
8+
* Describes web driver settings.
9+
*/
710
public interface IDriverSettings {
811

12+
/**
13+
* Gets web driver capabilities.
14+
* @return initialized {@link Capabilities}
15+
*/
916
Capabilities getCapabilities();
1017

18+
/**
19+
* Gets version of web driver for WebDriverManager.
20+
* @return Version of web driver.
21+
*/
1122
String getWebDriverVersion();
1223

24+
/**
25+
* Gets target system architecture for WebDriverManager.
26+
* @return System architecture.
27+
*/
1328
String getSystemArchitecture();
1429

30+
/**
31+
* Gets download directory for web driver.
32+
* @return Path to download directory.
33+
*/
1534
String getDownloadDir();
1635

36+
/**
37+
* Gets web driver capability key for download directory.
38+
* @return Web driver capability key
39+
*/
1740
String getDownloadDirCapabilityKey();
1841

42+
/**
43+
* Get desired browser name.
44+
* @return Browser name
45+
*/
1946
BrowserName getBrowserName();
2047

48+
/**
49+
* Gets desired json file.
50+
* @return Json file.
51+
*/
2152
JsonFile getSettingsFile();
2253

2354
}

src/main/java/aquality/selenium/elements/actions/CheckBoxJsActions.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import aquality.selenium.browser.JavaScript;
44
import aquality.selenium.elements.interfaces.ICheckBox;
55

6+
/**
7+
* Allows to perform actions on elements via JavaScript specific for CheckBoxes.
8+
*/
69
public class CheckBoxJsActions extends JsActions {
710

811
public CheckBoxJsActions(ICheckBox checkBox, String elementType) {
@@ -17,18 +20,31 @@ public boolean getState() {
1720
return Boolean.valueOf(executeScript(JavaScript.GET_CHECKBOX_STATE, element).toString());
1821
}
1922

23+
/**
24+
* Performs check action on the element.
25+
*/
2026
public void check() {
2127
setState(true);
2228
}
2329

30+
/**
31+
* Performs uncheck action on the element.
32+
*/
2433
public void uncheck() {
2534
setState(false);
2635
}
2736

37+
/**
38+
* Get status if element is checked
39+
* @return true if checked, false otherwise
40+
*/
2841
public boolean isChecked() {
2942
return getState();
3043
}
3144

45+
/**
46+
* Performs toggle action on the element.
47+
*/
3248
public void toggle() {
3349
setState(!isChecked());
3450
}

0 commit comments

Comments
 (0)