Skip to content

Commit a317275

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature-update-websection
2 parents e760877 + d15cba5 commit a317275

File tree

782 files changed

+30286
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

782 files changed

+30286
-541
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,69 @@ For applying filters and other more advanced configuration check the official do
2929

3030
Both TestNG and JUnit are supported.
3131

32+
## Release Strategy
33+
34+
### Versioning
35+
Our project uses [Semantic Versioning](https://semver.org/) (SemVer) for clear and predictable version management. Each release is tagged with a unique version number that reflects the nature of the changes made.
36+
### Tags and Releases
37+
- **Tags:** We create Git tags for each release to mark specific points in the project's history, making it easier for users to switch between versions.
38+
- **Release Notes:** Detailed notes accompany [each release](https://bellatrix.solutions/roadmap/release-3-9-0-0-lyra/), highlighting new features, bug fixes, and any breaking changes.
39+
### Accessing Releases
40+
Users can access the specific releases directly from our GitHub repository's Releases page or BELLATRIX website's roadmap section. Each release includes a tag, a summary of changes, and assets (if applicable).
41+
## Integrating BELLATRIX as a Submodule in Your Project
42+
### Adding BELLATRIX as a Submodule
43+
To leverage a specific version of BELLATRIX in your project, you can add it as a Git submodule. This allows you to keep your copy of BELLATRIX up to date or locked to a specific version, depending on your project's needs.
44+
1. **Navigate to Your Project Directory:** Open a terminal and change to the directory where your project is located.
45+
2. **Add BELLATRIX as a Submodule:** Use the following Git command to add BELLATRIX as a submodule to your project:
46+
```
47+
git submodule add https://github.com/BELLATRIX-Library/BELLATRIX.git path/to/submodule
48+
```
49+
Replace `path/to/submodule` with the relative path within your project where you'd like the BELLATRIX submodule to reside.
50+
**Initialize and Clone the Submodule:** If you're adding the submodule for the first time, initialize your local configuration file and clone the BELLATRIX repository as follows:
51+
```
52+
git submodule update --init --recursive
53+
```
54+
### Checking Out a Specific Tag (Release Version)
55+
After adding BELLATRIX as a submodule, you might want to use a specific release version rather than the latest commit on the main branch.
56+
1. **Navigate to the Submodule Directory:** Change into the BELLATRIX submodule directory within your project:
57+
```
58+
cd path/to/submodule
59+
```
60+
1. **Fetch All Tags from the BELLATRIX Repository:** To ensure you have a list of all available tags, fetch them:
61+
```
62+
git fetch --tags
63+
```
64+
2. **Checkout the Desired Tag:** Check out the specific tag (release version) you want to use by replacing `<tagname>` with the desired version:
65+
```
66+
git checkout tags/<tagname>`
67+
```
68+
For example, if you want to check out version `v3.9.0.0`, you would use:
69+
```git checkout tags/v3.9.0.0```
70+
71+
3. **Commit the Submodule Change:** Navigate back to your project's root directory, and commit the change to the submodule reference:
72+
```
73+
cd ../..
74+
git add path/to/submodule
75+
git commit -m "Update BELLATRIX submodule to v3.9.0.0"
76+
```
77+
This process ensures that your project uses a specific, fixed version of BELLATRIX, providing stability and consistency across environments or deployments.
78+
## Contributing to Our Project
79+
We welcome contributions from the community, whether it's in the form of bug reports, feature requests, documentation improvements, or code contributions.
80+
### Getting Started
81+
1. **Fork the Repository:** Start by forking the repository to your GitHub account. This provides you with a personal workspace for making changes.
82+
2. **Clone Your Fork:** Clone your fork to your local machine to start working on the changes.
83+
### Making Changes
84+
1. **Create a Feature Branch:** From your fork, create a new branch for your work. This keeps your changes organized and separate from the main branch.
85+
2. **Commit Your Changes:** Make your changes locally, and commit them to your feature branch. Use clear and descriptive commit messages.
86+
### Submitting Contributions
87+
1. **Pull from Upstream:** Before submitting your contribution, pull the latest changes from the upstream main branch into your feature branch to minimize merge conflicts.
88+
2. **Push to Your Fork:** Push your changes to your fork on GitHub.
89+
3. **Open a Pull Request (PR):** Submit a pull request from your feature branch to the main branch of the original repository. Provide a clear description of your changes and any relevant issue numbers.
90+
### Code Review
91+
**Review Process:** Your PR will be reviewed by the project maintainers. They may provide feedback or request changes. Be open to discussion and willing to make adjustments as needed.
92+
### After Your PR is Merged
93+
Once your PR is merged, your contributions will become part of the project. You can then safely delete your feature branch.
94+
3295
Supported Code Editors
3396
----------------------
3497
The recommended code editor for writing BELLATRIX tests is IntelliJ

bellatrix.android/src/main/java/solutions/bellatrix/android/components/AndroidComponent.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import solutions.bellatrix.core.utilities.InstanceFactory;
3838
import solutions.bellatrix.core.utilities.Log;
3939

40+
import java.awt.Dimension;
4041
import java.util.ArrayList;
4142
import java.util.List;
4243
import java.util.Locale;
@@ -102,12 +103,14 @@ public Class<?> getComponentClass() {
102103
return getClass();
103104
}
104105

105-
public Point getLocation() {
106-
return findElement().getLocation();
106+
public java.awt.Point getLocation() {
107+
var location = findElement().getLocation();
108+
return new java.awt.Point(location.getX(), location.getY());
107109
}
108110

109111
public Dimension getSize() {
110-
return findElement().getSize();
112+
var size = findElement().getSize();
113+
return new java.awt.Dimension(size.getWidth(), size.getHeight());
111114
}
112115

113116
public String getAttribute(String name) {

bellatrix.android/src/main/java/solutions/bellatrix/android/infrastructure/DriverService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.appium.java_client.remote.MobileCapabilityType;
2020
import lombok.SneakyThrows;
2121
import org.openqa.selenium.MutableCapabilities;
22-
import org.openqa.selenium.Platform;
2322
import org.openqa.selenium.remote.DesiredCapabilities;
2423
import solutions.bellatrix.android.configuration.AndroidSettings;
2524
import solutions.bellatrix.android.configuration.GridSettings;
@@ -30,11 +29,10 @@
3029

3130
import java.io.IOException;
3231
import java.io.InputStream;
33-
import java.net.MalformedURLException;
3432
import java.net.URL;
33+
import java.time.Duration;
3534
import java.util.HashMap;
3635
import java.util.Properties;
37-
import java.util.concurrent.TimeUnit;
3836

3937
public class DriverService {
4038
private static final ThreadLocal<Boolean> DISPOSED;
@@ -84,7 +82,7 @@ public static AndroidDriver start(AppConfiguration configuration) {
8482
driver = initializeDriverGridMode(gridSettings.get(), testName);
8583
}
8684

87-
driver.manage().timeouts().implicitlyWait(androidSettings.getTimeoutSettings().getImplicitWaitTimeout(), TimeUnit.SECONDS);
85+
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(androidSettings.getTimeoutSettings().getImplicitWaitTimeout()));
8886
WRAPPED_ANDROID_DRIVER.set(driver);
8987
solutions.bellatrix.web.infrastructure.DriverService.setWrappedDriver(driver);
9088
return driver;

bellatrix.android/src/main/java/solutions/bellatrix/android/infrastructure/MobileScreenshotPlugin.java

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
import org.openqa.selenium.OutputType;
1919
import org.openqa.selenium.TakesScreenshot;
2020
import plugins.screenshots.ScreenshotPlugin;
21+
import plugins.screenshots.ScreenshotPluginEventArgs;
2122
import solutions.bellatrix.android.configuration.AndroidSettings;
2223
import solutions.bellatrix.core.configuration.ConfigurationService;
2324
import solutions.bellatrix.core.utilities.PathNormalizer;
2425

2526
import java.io.File;
27+
import java.io.FileWriter;
28+
import java.io.IOException;
2629
import java.nio.file.Paths;
2730
import java.util.UUID;
2831

@@ -33,10 +36,43 @@ public MobileScreenshotPlugin() {
3336

3437
@Override
3538
@SneakyThrows
36-
protected void takeScreenshot(String screenshotSaveDir, String filename) {
37-
File screenshot = ((TakesScreenshot)DriverService.getWrappedAndroidDriver()).getScreenshotAs(OutputType.FILE);
38-
var destFile = new File(Paths.get(screenshotSaveDir, filename) + ".png");
39-
FileUtils.copyFile(screenshot, destFile);
39+
public String takeScreenshot(String name) {
40+
var screenshotSaveDir = getOutputFolder();
41+
var filename = getUniqueFileName(name);
42+
43+
var screenshot = ((TakesScreenshot)DriverService.getWrappedAndroidDriver()).getScreenshotAs(OutputType.BASE64);
44+
45+
var path = Paths.get(screenshotSaveDir, filename) + ".png";
46+
47+
var file = new File(path);
48+
49+
try (FileWriter writer = new FileWriter(file)) {
50+
writer.write(screenshot);
51+
} catch (IOException e) {
52+
e.printStackTrace();
53+
}
54+
55+
SCREENSHOT_GENERATED.broadcast(new ScreenshotPluginEventArgs(path.toString(), filename, screenshot));
56+
return screenshot;
57+
}
58+
59+
@Override
60+
@SneakyThrows
61+
public String takeScreenshot(String screenshotSaveDir, String filename) {
62+
var screenshot = ((TakesScreenshot)DriverService.getWrappedAndroidDriver()).getScreenshotAs(OutputType.BASE64);
63+
64+
var path = Paths.get(screenshotSaveDir, filename) + ".png";
65+
66+
var file = new File(path);
67+
68+
try (FileWriter writer = new FileWriter(file)) {
69+
writer.write(screenshot);
70+
} catch (IOException e) {
71+
e.printStackTrace();
72+
}
73+
74+
SCREENSHOT_GENERATED.broadcast(new ScreenshotPluginEventArgs(path.toString(), filename, screenshot));
75+
return screenshot;
4076
}
4177

4278
@Override

bellatrix.android/src/main/java/solutions/bellatrix/android/services/TouchActionsService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public class TouchActionsService extends MobileService {
2929
public <TComponent extends AndroidComponent> TouchActionsService tap(TComponent component, int count) {
3030
TouchAction touchAction = new TouchAction(DriverService.getWrappedAndroidDriver());
3131
touchAction.tap(TapOptions.tapOptions()
32-
.withPosition(PointOption.point(component.getLocation().getX(), component.getLocation().getY())).withTapsCount(count));
32+
.withPosition(PointOption.point((int)component.getLocation().getX(), (int)component.getLocation().getY())).withTapsCount(count));
3333
wrappedMultiAction.add(touchAction);
3434

3535
return this;
3636
}
3737

3838
public <TComponent extends AndroidComponent> TouchActionsService press(TComponent component) {
3939
TouchAction touchAction = new TouchAction(DriverService.getWrappedAndroidDriver());
40-
touchAction.press(PointOption.point(component.getLocation().getX(), component.getLocation().getY()));
40+
touchAction.press(PointOption.point((int)component.getLocation().getX(), (int)component.getLocation().getY()));
4141
wrappedMultiAction.add(touchAction);
4242

4343
return this;
@@ -53,7 +53,7 @@ public TouchActionsService press(Integer x, Integer y) {
5353

5454
public <TComponent extends AndroidComponent> TouchActionsService longPress(TComponent component) {
5555
TouchAction touchAction = new TouchAction(DriverService.getWrappedAndroidDriver());
56-
touchAction.longPress(PointOption.point(component.getLocation().getX(), component.getLocation().getY()));
56+
touchAction.longPress(PointOption.point((int)component.getLocation().getX(), (int)component.getLocation().getY()));
5757
wrappedMultiAction.add(touchAction);
5858

5959
return this;
@@ -78,7 +78,7 @@ public TouchActionsService wait(Long waitTimeMilliseconds) {
7878

7979
public <TComponent extends AndroidComponent> TouchActionsService moveTo(TComponent component) {
8080
TouchAction touchAction = new TouchAction(DriverService.getWrappedAndroidDriver());
81-
touchAction.moveTo(PointOption.point(component.getLocation().getX(), component.getLocation().getY()));
81+
touchAction.moveTo(PointOption.point((int)component.getLocation().getX(), (int)component.getLocation().getY()));
8282
wrappedMultiAction.add(touchAction);
8383

8484
return this;
@@ -103,9 +103,9 @@ public TouchActionsService release() {
103103
public <TComponent extends AndroidComponent> TouchActionsService swipe(TComponent firstComponent, TComponent secondComponent, int duration) {
104104
TouchAction touchAction = new TouchAction(DriverService.getWrappedAndroidDriver());
105105
touchAction
106-
.press(PointOption.point(firstComponent.getLocation().getX(), firstComponent.getLocation().getY()))
106+
.press(PointOption.point((int)firstComponent.getLocation().getX(), (int)firstComponent.getLocation().getY()))
107107
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(duration)))
108-
.moveTo(PointOption.point(secondComponent.getLocation().getX(), secondComponent.getLocation().getY()))
108+
.moveTo(PointOption.point((int)secondComponent.getLocation().getX(), (int)secondComponent.getLocation().getY()))
109109
.release().perform();
110110
wrappedMultiAction.add(touchAction);
111111

bellatrix.core/pom.xml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<version>1.0</version>
2525

2626
<properties>
27-
<selenium.version>4.8.1</selenium.version>
27+
<selenium.version>4.11.0</selenium.version>
2828
<appium.version>8.3.0</appium.version>
2929
<testng.version>7.7.0</testng.version>
3030
<junit.version>5.9.2</junit.version>
@@ -62,19 +62,16 @@
6262
<groupId>software.amazon.awssdk</groupId>
6363
<artifactId>textract</artifactId>
6464
</dependency>
65-
6665
<dependency>
6766
<groupId>com.opencsv</groupId>
6867
<artifactId>opencsv</artifactId>
6968
<version>5.7.1</version>
7069
</dependency>
71-
7270
<dependency>
7371
<groupId>com.mailslurp</groupId>
7472
<artifactId>mailslurp-client-java</artifactId>
7573
<version>15.17.1</version>
7674
</dependency>
77-
7875
<dependency>
7976
<groupId>commons-io</groupId>
8077
<artifactId>commons-io</artifactId>
@@ -83,7 +80,7 @@
8380
<dependency>
8481
<groupId>com.google.guava</groupId>
8582
<artifactId>guava</artifactId>
86-
<version>31.1-jre</version>
83+
<version>33.0.0-jre</version>
8784
</dependency>
8885
<dependency>
8986
<groupId>com.google.code.gson</groupId>
@@ -157,14 +154,9 @@
157154
<scope>compile</scope>
158155
</dependency>
159156
<dependency>
160-
<groupId>com.azure</groupId>
161-
<artifactId>azure-security-keyvault-secrets</artifactId>
162-
<version>4.2.3</version>
163-
</dependency>
164-
<dependency>
165-
<groupId>com.azure</groupId>
166-
<artifactId>azure-identity</artifactId>
167-
<version>1.2.0</version>
157+
<groupId>org.jsoup</groupId>
158+
<artifactId>jsoup</artifactId>
159+
<version>1.17.2</version>
168160
</dependency>
169161
</dependencies>
170162
</project>

bellatrix.core/src/main/java/solutions/bellatrix/core/assertions/EntitiesAsserter.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@
1616

1717
import java.lang.reflect.Method;
1818
import java.time.LocalDateTime;
19+
import java.time.OffsetDateTime;
1920
import java.util.ArrayList;
2021
import java.util.Arrays;
2122
import java.util.List;
2223

2324
public class EntitiesAsserter {
2425
public static <TEntity> Boolean areEqual(TEntity expectedObject, TEntity realObject, DateTimeDeltaType deltaType, int deltaQuantity, String... propertiesNotToCompare) {
2526
List<Exception> failedAssertions = assertAreEqualsInternal(expectedObject, realObject, deltaType, deltaQuantity, propertiesNotToCompare);
26-
if (failedAssertions.size() > 1) {
27-
return false;
28-
}
29-
return true;
27+
return failedAssertions.size() <= 1;
3028
}
3129
public static <TEntity> Boolean areEqual(TEntity expectedObject, TEntity realObject, String... propertiesNotToCompare) {
3230
return areEqual(expectedObject, realObject, DateTimeDeltaType.MILLISECONDS, 300, propertiesNotToCompare);
@@ -61,25 +59,39 @@ private static <TEntity> List<Exception> assertAreEqualsInternal(TEntity expecte
6159
try {
6260
currentExpectedProperty = expectedObject.getClass().getMethod(currentRealProperty.getName());
6361
} catch (NoSuchMethodException e) {
64-
failedAssertions.add(e);
62+
System.out.println(String.format("Property %s not found.", currentRealProperty));
63+
// failedAssertions.add(e);
6564
}
6665

6766
var exceptionMessage = "The property " + currentRealProperty.getName() + " of class " + realObject.getClass().getSimpleName() + " was not as expected.";
6867

6968
try {
7069
if (currentRealProperty.getReturnType() == LocalDateTime.class) {
70+
assert currentExpectedProperty != null;
71+
LocalDateTimeAssert.areEqual(
72+
(LocalDateTime)currentExpectedProperty.invoke(expectedObject),
73+
(LocalDateTime)currentRealProperty.invoke(realObject),
74+
deltaType, deltaQuantity, exceptionMessage);
75+
} else if (currentRealProperty.getReturnType() == OffsetDateTime.class) {
76+
assert currentExpectedProperty != null;
7177
LocalDateTimeAssert.areEqual(
72-
(LocalDateTime) currentExpectedProperty.invoke(expectedObject),
73-
(LocalDateTime) currentRealProperty.invoke(realObject),
78+
((OffsetDateTime)currentExpectedProperty.invoke(expectedObject)).toLocalDateTime(),
79+
((OffsetDateTime)currentRealProperty.invoke(realObject)).toLocalDateTime(),
7480
deltaType, deltaQuantity, exceptionMessage);
7581
} else {
7682
Assertions.assertEquals(
77-
currentExpectedProperty.invoke(expectedObject),
83+
currentExpectedProperty != null ? currentExpectedProperty.invoke(expectedObject) : null,
7884
currentRealProperty.invoke(realObject),
7985
exceptionMessage);
8086
}
81-
82-
} catch (Exception ex) {
87+
}
88+
catch (NoSuchMethodException nsm){
89+
//ignore this case
90+
}
91+
catch (NullPointerException nsmex){
92+
//ignore this case
93+
}
94+
catch (Exception ex) {
8395
failedAssertions.add(ex);
8496
}
8597
}

bellatrix.core/src/main/java/solutions/bellatrix/core/assertions/LocalDateTimeAssert.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ else if (actualDate == null){
3737
}
3838

3939
}
40-
public static void areEqual(LocalDateTime expectedDate, LocalDateTime actualDate, Duration expectedDelta, String exceptionMessage) throws Exception {
40+
41+
public static void areEqual(LocalDateTime expectedDate, LocalDateTime actualDate, Duration expectedDelta, String exceptionMessage) {
4142
if (expectedDate == null && actualDate == null){
4243
return;
4344
}
@@ -54,7 +55,7 @@ else if (actualDate == null){
5455
{
5556
var message = exceptionMessage+"\nExpected Date: "+expectedDate+", Actual Date: "+actualDate+
5657
" \nExpected Delta: "+expectedDelta+", Actual Delta: "+actualDelta;
57-
throw new Exception(message);
58+
throw new RuntimeException(message);
5859
}
5960
}
6061
private static Duration getTimeSpanDeltaByType(DateTimeDeltaType type, int count) throws UnsupportedOperationException {

bellatrix.core/src/main/java/solutions/bellatrix/core/configuration/ConfigurationService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
public final class ConfigurationService {
3131
private static String environment;
3232

33+
public static String getEnvironment() {
34+
return environment;
35+
}
36+
3337
public static <T> T get(Class<T> configSection) {
3438
T mappedObject = (T)new Object();
3539
if (environment == null) {

0 commit comments

Comments
 (0)