java - How to make HtmlUnit's WebClient accelerate execution of javascript to be triggered by window.setTimeout? -


i using java library htmlunit create regression test suite web app.

i have "onload" handler hooked in body of pages of app redirect timeout page after session have expired. handler javascript of form:

window.settimeout( function() { window.location = 'timout.html'; }, 3600000);

i test redirect fired when time arrives, closest thing can find wait entire duration of time (say hour in example above), suggested java sample below:

webclient webclient = new webclient(); ... webclient.waitforbackgroundjavascript( 3600000);

i know if possible trick script execution engine behaving if time has passed, without having wait minutes or hours "real time" test suite run.

ideally, 1 tell engine/client/interpreter x milliseconds had passed (to emulate wait), or perhaps set kind of "time dilation" factor , poll page see how being updated.

i don't think can easily. way can see possible mocking rhino method handles settimeout in tests... perhaps framework mockito... that's not want if want test effectiveness of redirection of page, test amount of time takes redirected

cheers

grooveek


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -