During test I need to do following:
- Click button which leads to ajax request and redirect after that
- Check that user has been redirected to correct page
$this->byId('reg_email')->value('firstname.lastname@example.org'); $this->byId('reg_password')->value('seecret'); // No form here, so i can't just call submit() // This click invokes ajax request $this->byId('reg_submit')->click(); // Check page content (this page should appear after redirect) $msg = $this->byCssSelector('h1')->text(); $this->assertEquals('Welcome!', $msg);
- Message check goes right after click, not before ajax request and page redirect
Solution, I do not like:
sleep(3);before content check.
I do not like it because:
- It is silly
- In case of fast responses I am going to lose time, in case of long requests I am going to get content check before ajax request finishes.
I wonder, is there any way to track ajax request+refresh and check for content just in time?
- PHP 5.4, 5.5 also available
- PHPUnit 3.8
- Selenium RC integration for PHPUnit 1.3.1
- Selenium-server-standalone 2.33.0
- Windows 7 x64
- JRE 7