2017-04-20 53 views
0

我目前使用Codeception 2.2來測試應用程序。我到目前爲止的步驟如下:接受彈出窗口的代碼驗收測試

<?php 
$I = new AcceptanceTester($scenario); 
$I->wantTo('perform actions and see result'); 
$I->amOnPage('/index.php'); 
$I->fillField('username', 'admin'); 
$I->fillField('password', 'password'); 
$I->click('Sign in'); 
$I->amOnPage('/index.php?module=CustomReports&view=Edit'); 
$I->fillField('relatedclient', '******'); 
$I->fillField('policynumber', '****'); 
$I->click('Save'); 
$I->see('You are being redirected to the clients isa report.'); 
$I->click('OK'); // This is where it fails 
$I->see('Client ISA Statement'); 
?> 

目前我正在使用PHP內聯JS,這是錯誤發生的地方。我想知道如何接受window.alert以進入下一頁。我試過$I->click('OK')但這似乎不起作用。

感謝

回答

3

這是codeception一個非常令人困惑的事情。 你可以試試

$I->acceptPopup() 

不幸的是,它可能不起作用。這是由selenium2驅動程序造成的。有時他們無法在瀏覽器投擲警報時掛鉤。我看到了關於這些警報的真正令人困惑的事情。