/ Published in: Groovy

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private ScriptableObject scope; @Before cx = ContextFactory.getGlobal().enterContext(); cx.setOptimizationLevel(-1); scope = cx.initStandardObjects(); // Assumes we have env.rhino.js as a resource on the classpath. // This will load the home page DOM. run("window.location='http://localhost:5000'"); // Whatever script JS includes the home page has. "/js/jquery-ui-1.8.2.custom.min.js", "/js/app.js"]; } // Whatever happens on document ready. run('appInit()'); } @Test run('$(".nav .homeLink").click()'); assertJsEquals('Request Sets', h1Text); run('$(".nav .dashboardLink").click()'); assertJsEquals('Dashboard', h1Text); run('$(".nav .homeLink").click()'); assertJsEquals('Sacrifice Pig', h1Text); } assertEquals(a,run(b)); } } } }
Comments
