Qytera-Gmbh / QTAF

QTAF is a Java test framework based on TestNG and offers easy setup of Selenium and fast extensibility.
https://qytera-gmbh.github.io
MIT License
10 stars 0 forks source link

`driver.headless` can't be set up by environment properties #175

Closed Stipci closed 1 year ago

Stipci commented 1 year ago

I'm trying overwrite the headless parameters as an environment properties.

I'm getting following error message. It seems that environment properties are always strings and this leads to an exception.


16:24:18.345 [main] ERROR de.qytera.qtaf.core - Value 'false' of key 'driver.headless' could not be parsed as java.lang.Boolean

[main] INFO org.reflections.Reflections - Reflections took 0 ms to scan 0 urls, producing 0 keys and 0 values
rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
    at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:187)
    at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115)
    at rx.internal.operators.NotificationLite.accept(NotificationLite.java:132)
    at rx.subjects.SubjectSubscriptionManager$SubjectObserver.emitNext(SubjectSubscriptionManager.java:253)
    at rx.subjects.BehaviorSubject.onError(BehaviorSubject.java:141)
    at de.qytera.qtaf.core.selenium.DriverFactory.getDriver(DriverFactory.java:81)
    at de.qytera.qtaf.core.selenium.DriverFactory.getDriver(DriverFactory.java:47)
    at de.qytera.qtaf.core.QtafFactory.getWebDriver(QtafFactory.java:43)
    at de.qytera.qtaf.testng.context.QtafTestNGContext.initialize(QtafTestNGContext.java:105)
    at de.qytera.qtaf.testng.context.QtafTestNGContext.<init>(QtafTestNGContext.java:86)
    at com.company.TestContext.<init>(TestContext.java:36)
    at com.company.tests.ChooseInstanceTests.<init>(ChooseInstanceTests.java:19)
    at com.company.tests.ChooseInstanceTests$$EnhancerByGuice$$5f14fe.<init>(<generated>)
    at com.company.tests.ChooseInstanceTests$$EnhancerByGuice$$5f14fe.GUICE$TRAMPOLINE(<generated>)
    at com.google.inject.internal.ProxyFactory$ProxyConstructor.newInstance(ProxyFactory.java:183)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
    at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense(GuiceBasedObjectDispenser.java:53)
    at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:106)
    at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:136)
    at org.testng.TestClass.getInstances(TestClass.java:129)
    at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:109)
    at org.testng.TestClass.init(TestClass.java:101)
    at org.testng.TestClass.<init>(TestClass.java:66)
    at org.testng.TestRunner.initMethods(TestRunner.java:483)
    at org.testng.TestRunner.init(TestRunner.java:356)
    at org.testng.TestRunner.init(TestRunner.java:309)
    at org.testng.TestRunner.<init>(TestRunner.java:228)
    at org.testng.remote.support.RemoteTestNG7_8$1.newTestRunner(RemoteTestNG7_8.java:34)
    at org.testng.remote.support.RemoteTestNG7_8$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG7_8.java:67)
    at org.testng.ITestRunnerFactory.newTestRunner(ITestRunnerFactory.java:52)
    at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:720)
    at org.testng.SuiteRunner.init(SuiteRunner.java:224)
    at org.testng.SuiteRunner.<init>(SuiteRunner.java:116)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1375)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1349)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1191)
    at org.testng.TestNG.runSuites(TestNG.java:1114)
    at org.testng.TestNG.run(TestNG.java:1082)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: rx.exceptions.CompositeException: 2 exceptions occurred. 
    ... 45 more
Caused by: rx.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received =>
    at rx.exceptions.CompositeException.getCause(CompositeException.java:129)
    at java.base/java.lang.Throwable.printEnclosedStackTrace(Throwable.java:735)
    at java.base/java.lang.Throwable.lockedPrintStackTrace(Throwable.java:696)
    at java.base/java.lang.Throwable.printStackTrace(Throwable.java:668)
    at java.base/java.lang.Throwable.printStackTrace(Throwable.java:660)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:122)
    ... 2 more
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "de.qytera.qtaf.core.config.entity.ConfigMap.getBoolean(String)" is null
    at de.qytera.qtaf.core.selenium.AbstractDriver.headless(AbstractDriver.java:108)
    at de.qytera.qtaf.core.selenium.ChromeDriver.getCapabilities(ChromeDriver.java:29)
    at de.qytera.qtaf.core.selenium.ChromeDriver.getDriver(ChromeDriver.java:21)
    at de.qytera.qtaf.core.selenium.AbstractDriver.getDriverInstance(AbstractDriver.java:42)
    at de.qytera.qtaf.core.selenium.DriverFactory.getDriver(DriverFactory.java:73)
    at de.qytera.qtaf.core.selenium.DriverFactory.getDriver(DriverFactory.java:47)
    at de.qytera.qtaf.core.QtafFactory.getWebDriver(QtafFactory.java:43)
    at de.qytera.qtaf.testng.context.QtafTestNGContext.initialize(QtafTestNGContext.java:105)
    at de.qytera.qtaf.testng.context.QtafTestNGContext.<init>(QtafTestNGContext.java:86)
    at com.company.TestContext.<init>(TestContext.java:36)
    at com.company.tests.ChooseInstanceTests.<init>(ChooseInstanceTests.java:19)
    at com.company.tests.ChooseInstanceTests$$EnhancerByGuice$$5f14fe.<init>(<generated>)
    at com.company.tests.ChooseInstanceTests$$EnhancerByGuice$$5f14fe.GUICE$TRAMPOLINE(<generated>)
    at com.google.inject.internal.ProxyFactory$ProxyConstructor.newInstance(ProxyFactory.java:183)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
    at org.testng.internal.objects.GuiceBasedObjectDispenser.dispense(GuiceBasedObjectDispenser.java:53)
    at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:106)
    at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:136)
    at org.testng.TestClass.getInstances(TestClass.java:129)
    at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:109)
    at org.testng.TestClass.init(TestClass.java:101)
    at org.testng.TestClass.<init>(TestClass.java:66)
    at org.testng.TestRunner.initMethods(TestRunner.java:483)
    at org.testng.TestRunner.init(TestRunner.java:356)
    at org.testng.TestRunner.init(TestRunner.java:309)
    at org.testng.TestRunner.<init>(TestRunner.java:228)
    at org.testng.remote.support.RemoteTestNG7_8$1.newTestRunner(RemoteTestNG7_8.java:34)
    at org.testng.remote.support.RemoteTestNG7_8$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG7_8.java:67)
    at org.testng.ITestRunnerFactory.newTestRunner(ITestRunnerFactory.java:52)
    at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:720)
    at org.testng.SuiteRunner.init(SuiteRunner.java:224)
    at org.testng.SuiteRunner.<init>(SuiteRunner.java:116)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1375)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1349)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1191)
    at org.testng.TestNG.runSuites(TestNG.java:1114)
    at org.testng.TestNG.run(TestNG.java:1082)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
    ... 2 more
Caused by: java.lang.ClassCastException: class de.qytera.qtaf.core.log.model.error.ErrorLog cannot be cast to class com.company.pageObjects.type.SERVICES (de.qytera.qtaf.core.log.model.error.ErrorLog and com.company.pageObjects.type.SERVICES are in unnamed module of loader 'app')
    at com.company.qtafHelper.ArrayListServicesSerializer.serialize(ArrayListServicesSerializer.java:25)
    at com.company.qtafHelper.ArrayListServicesSerializer.serialize(ArrayListServicesSerializer.java:1)
    at com.google.gson.internal.bind.TreeTypeAdapter.write(TreeTypeAdapter.java:88)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:70)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:196)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:368)
    at com.google.gson.Gson.toJson(Gson.java:842)
    at com.google.gson.Gson.toJson(Gson.java:812)
    at com.google.gson.Gson.toJson(Gson.java:759)
    at com.google.gson.Gson.toJson(Gson.java:736)
    at de.qytera.qtaf.core.log.service.LogFileWriter.persistErrorLogs(LogFileWriter.java:64)
    at de.qytera.qtaf.core.event_subscriber.test.PersistLogFileSubscriber.handleDriverInitializationErrors(PersistLogFileSubscriber.java:134)
    at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
    at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153)
    at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115)
    at rx.internal.operators.NotificationLite.accept(NotificationLite.java:132)
    at rx.subjects.SubjectSubscriptionManager$SubjectObserver.emitNext(SubjectSubscriptionManager.java:253)
    at rx.subjects.BehaviorSubject.onError(BehaviorSubject.java:141)
    at de.qytera.qtaf.core.selenium.DriverFactory.getDriver(DriverFactory.java:81)
    ... 39 more
csvtuda commented 1 year ago

Hey, thanks for raising the issue.

A patch for this bug will be included in version 0.2.4.

Stipci commented 1 year ago

it's fixed and i have retested it