Hallo Bernd,
Date is an ECMA type and is provided by Rhino. It surely relies directly
on java Date. Neither Webtest nor HtmlUnit currently provide ways to
fake it.
Nevertheless you can do it by injecting javascript code just like what
you could do in a normal browser. For instance with someting like this:
var originalDate = window.Date;
window.Date = function() {
return new originalDate(2007, 0, 15)
}
var now = new Date();
alert(now.toLocaleString())
(this example is a bit simplistic as it doesn't handle all constructor
of Date in js).
Cheers,
Marc.
PS: when comes the next Grails-WebTest plugin release?
--
Blog: http://mguillem.wordpress.com
Bernd Schiffer wrote:
> Hi.
>
> What's the prefered way to set the date the internal browser webtest is
> using?
>
> More concret: I have a website with a javascript calendar which showes the
> actual month depending on the browsers time which is the OS's time. If I
> change the OS's time, the calendar shows the corresponding month. The
> strategy I figured out now is, that I could change webtest's internal
> browser's time, so the calendar would show the corresponding month and I
> could test that it is the correct month. How can I do that or is there
> another prefered strategy to use here?
>
> Bernd
>
> P.S.: I'm using the Grails and Grails' Webtest Plugin.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest