qmetry / qaf

Quality Automation Framework for web, mobileweb, mobile native and rest web-service using Selenium, webdrier, TestNG and Java Jersey
https://qmetry.github.io/qaf
MIT License
254 stars 138 forks source link

FormDataBean with dependsOnField throws ClassCastException: cannot be cast to class [C ( #393

Closed cjayswal closed 2 years ago

cjayswal commented 2 years ago

QAF Version

Note: only the latest version is supported 3.0.1

Steps To Reproduce

  1. Create form data bean with filed with dependency on other fileld
  2. Call form.fillUiElements();

Expected behavior

Should fill dependent field based on filed it depends and depending value provided in @UiElement using dependsOnField and dependingValue

Actual behavior

java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class [C (java.lang.Boolean and [C are in module java.base of loader 'bootstrap') at com.qmetry.qaf.automation.data.BaseFormDataBean.checkParent(BaseFormDataBean.java:217) at com.qmetry.qaf.automation.data.BaseFormDataBean.fillUiData(BaseFormDataBean.java:310) at com.qmetry.qaf.automation.data.BaseFormDataBean.fillUiElements(BaseFormDataBean.java:83) at com.example.qaf.test.Suite1.tc1(Suite1.java:36) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104) at org.testng.internal.Invoker.invokeMethod(Invoker.java:645) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:756) at org.testng.TestRunner.run(TestRunner.java:610) at org.testng.SuiteRunner.runTest(SuiteRunner.java:387) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340) at org.testng.SuiteRunner.run(SuiteRunner.java:289) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293) at org.testng.TestNG.runSuitesLocally(TestNG.java:1218) at org.testng.TestNG.runSuites(TestNG.java:1133) at org.testng.TestNG.run(TestNG.java:1104) 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)

Is the issue reproducible on runner?

Test case sample

public class NewUserForm extends BaseFormDataBean {
...
    @UiElement(fieldLoc = "newsletter.loc", fieldType = Type.checkbox, order = 3)
    private Boolean newsletter=true;

    @UiElement(fieldLoc = "digester.loc", fieldType = Type.checkbox ,dependsOnField = "newsletter", dependingValue = "newsletter==true", order =5)
    private boolean digester;

    @UiElement(fieldLoc = "marketflash.loc", fieldType = Type.checkbox, dependsOnField = "newsletter", dependingValue = "true",  order = 5)
    private String marketflash;
}

public void tc1() {

    getDriver().get("https://qmetry.github.io/qaf/playground/useraccount-form.html");

    NewUserForm form = new NewUserForm();
    form.setNewsletter(true);
    form.setDigester(true);
    form.fillUiElements();
}