[arquillian-issues] [JBoss JIRA] (ARQGRA-331) Graphene guards fails when page stores reference to XMLHttpRequest before Graphene rewrites them
Lukáš Fryč (JIRA)
jira-events at lists.jboss.org
Tue Sep 3 11:33:03 EDT 2013
[ https://issues.jboss.org/browse/ARQGRA-331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801239#comment-12801239 ]
Lukáš Fryč commented on ARQGRA-331:
-----------------------------------
In certain situations, a workaround could be to rewrite the XHR reference, which is possible only on circumstances that the copied XMLHttpRequest reference is accessible globally (isn't encapsulated) - which unfortunately isn't your case.
Just for evidence, here is a workaround:
{code}
@ArquillianResource
JavascriptExecutor executor;
@JavaScript
RequestGuard guard;
@Test
public void test() {
browser.get("http://localhost:8080/jboss-as-kitchensink-angularjs/");
guard.install();
executor.executeScript("window.xhrReference = window.XMLHttpRequest;");
// now you are prepared
}
{code}
However compiled angular.js encapsulates XHR object in a closure, so you can't overwrite it
> Graphene guards fails when page stores reference to XMLHttpRequest before Graphene rewrites them
> ------------------------------------------------------------------------------------------------
>
> Key: ARQGRA-331
> URL: https://issues.jboss.org/browse/ARQGRA-331
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.0.Alpha4
> Reporter: Oliver Kišš
> Assignee: Lukáš Fryč
> Fix For: 2.0.0.Alpha5
>
>
> Graphene guards do not work correctly in the [AngularJS Kitchensink quickstart|https://github.com/jboss-jdf/jboss-as-quickstart/tree/master/kitchensink-angularjs].
> The registration form sends a XHR POST request on submit, but this is not recognized and clicking on the submit button with {{guardAjax(registerButton).click()}} throws an exception: "{{RequestGuardException: Request type 'XHR' was expected, but type 'NONE' was done instead}}".
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the arquillian-issues
mailing list