views:

224

answers:

1

hi,

I am using simpletest to do integration testing of my websites, and I need to tell the internal browser to wait for a certain amount of time (as the page is being redirected), and then do assertText.

Is there an easy way to do this ?

Regards

A: 

There is no "easy" way to slow down the redirects from the CakeTest environment.

To do this, you will need to go into the SimpleTest library and make modifications there.

Here is an idea of the classes involved:

cake_web_test_case -> web_test_case (web_tester.php) -> simple_browser (browser.php) -> simple_user_agent (user_agent.php)

If you want to slow down redirects, I would suggest opening /vendors/simpletest/user_agent.php and edit "function &_fetchWhileRedirected". Just add a sleep() in the do..while statement and it should slow down the redirects.

Hope this helps.

Dooltaz
The page has a meta http-equiv=refresh, so it's not really the http return code is 200. How can I make SimpleTest/WebTester follow this refresh?
porto alet
Since you know to look for a meta refresh, why not parse out that string from the results of the "$this->get" or "$this->post"? Once you have the new url, you can put in the sleep() and then run another $this->get($new_url);
Dooltaz
Example: 1) $page = $this->get($url); 2) $url = $this->_parse_page($page);3) sleep(10);4) $new_page = $this->get($url);I'm not sure, but is this something you're looking for? function _parse_page would basically do a regular expression or text matching to pull out the new url.
Dooltaz