1 Reply Latest reply on Mar 29, 2017 6:52 AM by Bartosz Majsak

    Graphene test fails with IllegalStateException when executed against Chrome

    Wayne Delaney Newbie

      Hi,

       

      I am new to testing with Graphene / Drone and we are starting a UI development project using javascript for the client side.

      I would like to use Graphene to perform the integration tests and I have started playing around with it over the last few days.

       

      So far the experience has been very positive. I have a small test application running with a stubbed REST service and a simple UI, and I have been able to run basic tests against the UI. I have executed the tests against phantomJS, firefox, and chrome.

      The tests are passing successfully against the first 2 browsers but one of the tests is failing for chrome and I have been unable to get to the root cause.

       

      I was hoping someone on the forum might be able to point me in the right direction.

       

      I am using version 56 of chrome and version 2.28 of the chromeDriverBinary (also tried version 2.27).

       

      The test is quite simple, snippet below:

       

      @RunWith(Arquillian.class)

      public class NodeManagerTest {

         

           ....

         

          @Deployment(testable = false)

          public static WebArchive createDeployment() {

              return ShrinkWrap.create(// deploy simple rest service stub);

          }

       

          @Drone

          private WebDriver browser;

       

          @ArquillianResource

          public URL deploymentUrl;

       

          @FindBy(id = "neId")

          private WebElement neId;

       

          @FindBy(id = "neType")

          private WebElement neType;

       

          @FindBy(id = "platformType")

          private WebElement platformType;

       

          @FindBy(id = "update")

          private WebElement updateButton;

       

          @Test

          public void updateNodeTest() throws InterruptedException {

              browser.get(deploymentUrl.toExternalForm());

              neId.sendKeys("2");

              neType.sendKeys("RadioNode");

              platformType.sendKeys("ER6000");

              guardAjax(updateButton).click();

              ...

          }

      }

       

      When the update button is clicked it triggers an AJAX request. If successful an alert is triggered that confirms success.

      I am getting the following exception after the AJAX request is triggered:

       

      java.lang.IllegalStateException: Can't invoke the javacript org.jboss.arquillian.graphene.guard.RequestGuardImpl#getRequestType()

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

          at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)

          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:174)

          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)

          at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:540)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:498)

          at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invokeReal(GrapheneProxyHandler.java:130)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$1.invoke(GrapheneContextualHandler.java:162)

          at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor$1.apply(StaleElementInterceptor.java:47)

          at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor$1.apply(StaleElementInterceptor.java:43)

          at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)

          at org.jboss.arquillian.graphene.wait.WebDriverWaitImpl.until(WebDriverWaitImpl.java:96)

          at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor.intercept(StaleElementInterceptor.java:43)

          at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)

          at org.jboss.arquillian.graphene.enricher.SearchContextInterceptor.intercept(SearchContextInterceptor.java:50)

          at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$2.call(GrapheneContextualHandler.java:212)

          at org.jboss.arquillian.graphene.context.BrowserActions.performAction(BrowserActions.java:62)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:208)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.intercept(GrapheneContextualHandler.java:234)

          at org.openqa.selenium.chrome.ChromeDriver$$EnhancerByGraphene$$c6034974.executeScript(<generated>)

          at org.jboss.arquillian.graphene.javascript.JavaScriptUtils.execute(JavaScriptUtils.java:46)

          at org.jboss.arquillian.graphene.javascript.DefaultExecutionResolver.executeScriptForCall(DefaultExecutionResolver.java:139)

          at org.jboss.arquillian.graphene.javascript.DefaultExecutionResolver.execute(DefaultExecutionResolver.java:78)

          at org.jboss.arquillian.graphene.javascript.JSInterfaceHandler.intercept(JSInterfaceHandler.java:58)

          at org.jboss.arquillian.graphene.cglib.ClassImposterizer$ClassWithSuperclassToWorkAroundCglibBug$$EnhancerByGraphene$$e37c9004.getRequestType(<generated>)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory$RequestChange.apply(RequestGuardFactory.java:172)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory$RequestChange.apply(RequestGuardFactory.java:169)

          at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)

          at org.jboss.arquillian.graphene.wait.WebDriverWaitImpl.until(WebDriverWaitImpl.java:96)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory$1.waitForRequestChange(RequestGuardFactory.java:121)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory$1.intercept(RequestGuardFactory.java:100)

          at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$2.call(GrapheneContextualHandler.java:212)

          at org.jboss.arquillian.graphene.context.BrowserActions.performAction(BrowserActions.java:62)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:208)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.intercept(GrapheneContextualHandler.java:234)

          at org.jboss.arquillian.graphene.GrapheneElementImpl$$EnhancerByGraphene$$5d0b4ceb.click(<generated>)

          at org.rest.service.NodeManagerTest.updateNodeTest(NodeManagerTest.java:96)

       

      If I remove the code that generates the alert, there is no exception generated, so it would appear that it's the alert that is causing the problem.

       

      Has any one on the forum come across this before?

      Any help would be appreciated as I've been struggling with it for a while now.

       

      Regards,

      /Wayne