You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reference aquality.selenium.core to release version 2.0.0 (#75)
* rename BrowserManager to AqualityServices,
extend it from aquality.selenium.core.applications.AqualityServices.
*Change timeout in Browser from Long to Duration.
* Add BrowserModule.
* remove some configurations, replaced with core impl
* get rid of JsonFile, migrate to JsonSettingsFile
* refactor element services to use core implementations
removed Logger, ElementFinder, enums, interfaces
* restored logging in ElementStateProvider
* Removed LocalizationManager and ConditionalWait
* Removed/Replaced ElementActionRetrier
* reworked configuration usage
* replaced container of browser factory with instance field
* add element cache configuration into json
* add missed localization values
* control localization values, restore some usages
* refactor driver settings
* Update library self-version in pom file
closes#55, closes#60, closes#66, fixes#69, fixes#74
@@ -90,7 +90,7 @@ There are some niceties with using InternetExplorer browser. We tried to describ
90
90
91
91
[settings.json](./src/main/resources/settings.json) contains section `timeouts`. It includes list of timeout parameters that are used in the Aquality.
92
92
93
-
All parameters are used to initialise [TimeoutConfiguration](./src/main/java/aquality/selenium/configuration/TimeoutConfiguration.java) class instance. After initialising parameters can be fetched by call `Configuration.getInstance().getTimeoutConfiguration()`.
93
+
All parameters are used to initialise [TimeoutConfiguration](./src/main/java/aquality/selenium/configuration/TimeoutConfiguration.java) class instance. After initialising parameters can be fetched by call `AqualityServices.getConfiguration().getTimeoutConfiguration()`.
94
94
95
95
Below is a description of timeouts:
96
96
@@ -110,10 +110,10 @@ It is not recommended to use implicit and explicit waits together.
110
110
`retry` section of [settings.json](./src/main/resources/settings.json) is responsible to configure number of attempts of manipulations with element (click, type, focus and etc.)
111
111
All the operations can be executed several times if they failed at first attempt.
112
112
113
-
This logic is implemented in the [ElementActionRetrier](./src/main/java/aquality/selenium/utils/ElementActionRetrier.java) class. This class is used for any manipulations with elements.
113
+
This logic is implemented in the [ElementActionRetrier](https://github.com/aquality-automation/aquality-selenium-core-java/blob/master/src/main/java/aquality/selenium/core/utilities/ElementActionRetrier.java) class. This class is used for any manipulations with elements.
114
114
`number` parameter keeps value of number of attempts. An exception will be thrown if attempts are over.
115
115
`pollingInterval` keeps value of interval in **milliseconds** between attempts.
116
-
[ElementActionRetrier](./src/main/java/aquality/selenium/utils/ElementActionRetrier.java) catches StaleElementReferenceException and InvalidElementStateException by default.
116
+
[ElementActionRetrier](https://github.com/aquality-automation/aquality-selenium-core-java/blob/master/src/main/java/aquality/selenium/core/utilities/ElementActionRetrier.java) catches StaleElementReferenceException and InvalidElementStateException by default.
117
117
118
118
#### 2.6. LOGGING
119
119
Aquality logs operations that executes (interaction with browser, elements of the pages). Example of some log:
@@ -139,13 +139,19 @@ If parameter has value `true` user will be able to see actions more explicit (re
139
139
140
140
#### 2.9. ACCESS FROM THE CODE
141
141
142
-
Sometimes you need access to values from settings file from the code. To get it use [Configuration](./src/main/java/aquality/selenium/configuration/Configuration.java) class instance.
142
+
Sometimes you need access to values from settings file from the code. To get it you can use [Configuration](./src/main/java/aquality/selenium/configuration/IConfiguration.java) class instance.
You can also resolve the needed configuration from the AqualityServices directly:
150
+
```java
151
+
AqualityServices.get(IRetryConfiguration.class).getNumber(); // returns number of retry attempts for element actions, e.g. clicking.
152
+
AqualityServices.getBrowserProfile(); // returns currently used set of browser settings.
153
+
```
154
+
149
155
### **3. BROWSER**
150
156
151
157
Class Browser is a facade around WebDriver and provides methods to work with Browser window and WebDriver itself (for example: navigate, maximize window and etc.).
@@ -161,27 +167,32 @@ Examples of using Aquality Selenium in multi-thread mode are here [BrowserConcur
161
167
162
168
Test runners like TestNG, JUnit and etc. start each test in the separate thread from the box. So users do not need to do additional work if they are using such runners.
163
169
164
-
To use parallel streams that provided by Java from 8th version it is necessary to use BrowserManager to pass correct instance of Browser to stream function. Else parallel stream will create new Browser instances for each thread.
170
+
To use parallel streams that provided by Java from 8th version it is necessary to use AqualityServices to pass correct instance of Browser to stream function. Else parallel stream will create new Browser instances for each thread.
165
171
The example of usage parallel streams is here [testShouldBePossibleToUseParallelStreams](./src/test/java/tests/usecases/BrowserConcurrencyTests.java).
166
172
167
-
#### 3.2. BROWSER MANAGER
173
+
#### 3.2. AQUALITY SERVICES
174
+
Class [AqualityServices](https://github.com/aquality-automation/aquality-selenium-java/blob/Feature/Reference-aquality.selenium.core/src/main/java/aquality/selenium/browser/AqualityServices.java) provides static methods to access Browser and other utilities included in the library.
175
+
176
+
Usage of AqualityServices is thread-safe. Inside AqualityServices uses DI container Guice.
177
+
178
+
You can override any service implementation in the class extended from [BrowserModule](https://github.com/aquality-automation/aquality-selenium-java/blob/Feature/Reference-aquality.selenium.core/src/main/java/aquality/selenium/browser/BrowserModule.java), and then re-initialize AqualityServices in your code using the method ```AqualityServices.initInjector(customModule)```.
179
+
Take a look at example of custom module implementation here: [BrowserFactoryTests](https://github.com/aquality-automation/aquality-selenium-java/blob/Feature/Reference-aquality.selenium.core/src/test/java/tests/usecases/BrowserFactoryTests.java)
180
+
181
+
#### 3.3. BROWSER FACTORY
168
182
169
183
There are several ways to create instance of class Browser.
170
-
The main approach based on the usage of `BrowserManager` class and it's static methods. Below are options of `BrowserManager` usage.
184
+
The main approach based on the usage of `AqualityServices` class and it's static methods. Below are options of `AqualityServices` usage.
171
185
172
186
For most cases users need to get Browser instance based on data from the settings file. To get Browser in this case use following:
173
187
174
188
```
175
-
Browser browser = BrowserManager.getBrowser()
189
+
Browser browser = AqualityServices.getBrowser()
176
190
```
177
191
178
192
The first call of `getBrowser()` method will create instance of Browser with WebDriver inside (browser window will be opened).
179
193
The next calls of `getBrowser()` in the same thread will return the same instance.
180
194
181
-
182
-
#### 3.3. BROWSER FACTORY
183
-
184
-
Implicitly for users `BrowserManager` provides `Browser` through calls to browser factories.
195
+
Implicitly for users `AqualityServices` provides `Browser` through calls to browser factories.
185
196
Aquality Selenium implements following factories:
186
197
187
198
-[LocalBrowserFactory](./src/main/java/aquality/selenium/browser/LocalBrowserFactory.java) - to creating Browser on local machine (parameter `isRemote=false`)
@@ -190,19 +201,18 @@ Aquality Selenium implements following factories:
190
201
Each factory implementation implements interface `IBrowserFactory` with the single method `Browser``getBrowser()`.
191
202
Users are allowed to create their on implementations if necessary.
192
203
193
-
To use custom factory implementation users should set it into `BrowserManager` before first call of `getBrowser()` method:
204
+
To use custom factory implementation users should set it into `AqualityServices` before first call of `getBrowser()` method:
The examples of usages custom factories can be found here [BrowserFactoryTests](./src/test/java/tests/usecases/BrowserFactoryTests.java)
198
209
199
-
If there are reasons to not to use factories user is able to create Browser instance using constructor and then put it into BrowserManager:
210
+
If there are reasons to not to use factories user is able to create Browser instance using constructor and then put it into AqualityServices:
200
211
```
201
-
BrowserManager.setBrowser(Browser browser)
212
+
AqualityServices.setBrowser(Browser browser)
202
213
```
203
214
204
-
Browser class has public constructor with the signature: `Browser(RemoteWebDriver remoteWebDriver, IСonfiguration configuration)`.
205
-
User should implement his own implementation of `IConfiguration` - but existing IConfiguration implementation can be used, inherited, used partially(`IDriverSettings`, `ITimeoutConfiguration` and etc.)
215
+
Browser class has public constructor with the signature: `Browser(RemoteWebDriver remoteWebDriver)`. Other needed services are resolved from the DI container. For example, user could implement his own implementation of `IConfiguration` - but existing IConfiguration implementation can be used, inherited, used partially(`IDriverSettings`, `ITimeoutConfiguration` and etc.)
206
216
207
217
#### 3.4. DRIVER CAPABILITIES
208
218
@@ -242,7 +252,7 @@ But there are no restrictions to add your own implementation.
242
252
`Browser` class provides methods to work with alerts and prompts dialogs:
User has abilities to create his own type of element by implementing interface or using inheritance.
278
-
For this goal `ElementFactory` provides method \<T extends IElement\> T getCustomElement.
288
+
For this goal `ElementFactory` provides method `<T extends IElement> T getCustomElement`.
279
289
Example of creating custom element here [CustomElementTests](./src/test/java/tests/usecases/CustomElementTests.java).
280
290
281
291
#### 4.3. LIST OF ELEMENTS
@@ -340,16 +350,21 @@ There are several overrided methods that takes scripts as String, File or JavaSc
340
350
341
351
### **7. JSON FILE**
342
352
343
-
Aquality Selenium uses [JsonFile](./src/main/java/aquality/selenium/utils/JsonFile.java) class to process the JSON files.
353
+
Aquality Selenium uses [JsonSettingsFile](https://github.com/aquality-automation/aquality-selenium-core-java/blob/master/src/main/java/aquality/selenium/core/utilities/JsonSettingsFile.java) class to process the JSON files.
344
354
Users can use this class to process JSON files from their own project.
345
355
For example, if user wants to keep URL to web site that is automating he can put this URL in some JSON file and read value with mentioned class:
346
356
```
347
-
JsonFile environment = new JsonFile("settings.json")
357
+
ISettingsFile environment = new JsonSettingsFile("settings.json")
If you need to wait for any condition to be met, you can use the [ConditionalWait](./src/main/java/aquality/selenium/waitings/ConditionalWait.java) class provided by Aquality Selenium.
362
+
If you need to wait for any condition to be met, you can use the [ConditionalWait](https://github.com/aquality-automation/aquality-selenium-core-java/blob/master/src/main/java/aquality/selenium/core/waitings/ConditionalWait.java) class provided by Aquality Selenium.
0 commit comments