Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# macOS resource fork
*.DS_Store
.AppleDouble
.LSOverride
.AppleDouble
.*.icloud

# Compiled class file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void retry(Runnable action, Duration sleepInterval, Duration timeo

public static void forMilliseconds(long millis) {
try {
Log.info("Waiting for %s milliseconds".formatted(millis));
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static void prioritizePattern(String pattern) {
FORMATTERS.add(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"));
FORMATTERS.add(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS"));
FORMATTERS.add(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
FORMATTERS.add(DateTimeFormatter.ofPattern("dd.MM.yyyy, HH:mm"));
}

public static LocalDateTime parse(String data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import solutions.bellatrix.web.findstrategies.XPathFindStrategy;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.function.Consumer;
Expand Down Expand Up @@ -284,7 +285,6 @@ public <TRowObject> void assertTable(Class<TRowObject> clazz, List<TRowObject> e
}
}

@SneakyThrows
@SuppressWarnings({"unchecked"})
public <TRowObject> void assertTable(Class<TRowObject> clazz, List<TRowObject> expectedEntities) {
scrollToVisible();
Expand All @@ -308,8 +308,13 @@ public <TRowObject> void assertTable(Class<TRowObject> clazz, List<TRowObject> e
if (!clazz.equals(Object.class)) {
entity = castRow(clazz, i, propsNotToCompare);
} else {
Method method = this.getClass().getMethod("castRow", int.class, List.class);
entity = (TRowObject)method.invoke(this, i, Arrays.stream(propsNotToCompare).toList());
Method method = null;
try {
method = this.getClass().getMethod("castRow", int.class, List.class);
entity = (TRowObject)method.invoke(this, i, Arrays.stream(propsNotToCompare).toList());
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
EntitiesAsserter.areEqual(expectedEntities.get(i), entity, propsNotToCompare);
}
Expand Down Expand Up @@ -353,10 +358,10 @@ public <TRowObject> TRowObject castRow(Class<TRowObject> clazz, int rowIndex, St
}

var dto = InstanceFactory.create(clazz);
var fields = clazz.getFields();
var fields = clazz.getDeclaredFields();
for (var field : fields) {
var fieldType = field.getType();

field.setAccessible(true);
var headerInfo = getHeaderNamesService().getHeaderInfoByField(field);

if (Arrays.stream(fieldsToSkip).anyMatch(f -> f.equals(headerInfo.getHeaderName()))) continue;
Expand Down Expand Up @@ -531,11 +536,21 @@ public <TComponent extends WebComponent, TFindStrategy extends FindStrategy> Gri

public <TGridModel> Grid setModelColumns(Class<TGridModel> clazz) {
controlColumnDataCollection = new ArrayList<>();
for (var field : clazz.getFields()) {
List<Field> declaredFields = List.of(clazz.getDeclaredFields());
for (var field : declaredFields) {
field.setAccessible(true);
var headerName = field.isAnnotationPresent(TableHeader.class) ? field.getAnnotation(TableHeader.class).name() : field.getName();
controlColumnDataCollection.add(new ControlColumnData(headerName));
}

return this;
}

private static String getFieldNameFromGetter(String getterName) {
if (getterName.startsWith("get")) {
String fieldName = getterName.substring(3); // Remove "get"
return Character.toLowerCase(fieldName.charAt(0)) + fieldName.substring(1); // Lowercase the first character
}
return getterName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ public List<LogEntry> getSevereLogEntries() {
return logs;
}

public List<String> getRequestEntries(String partialUrl) {
return (List<String>)((JavascriptExecutor)getWrappedDriver()).executeScript(String.format("return window.performance.getEntriesByType('resource').filter(x => x.name.indexOf('%s') >= 0).map(y => y.name);", partialUrl));
}

public void waitForAjax() {
long ajaxTimeout = ConfigurationService.get(WebSettings.class).getTimeoutSettings().getWaitForAjaxTimeout();
long sleepInterval = ConfigurationService.get(WebSettings.class).getTimeoutSettings().getSleepInterval();
Expand Down
Loading