2013-05-12 20 views
0

我正在嘗試將驗證用於驗收測試。我決定將它與Selenium2一起使用。 啓動環境:Firefox打開空白頁面而不是應用程序url - Codeception和selenium2

acceptance.suite.yml:

class_name: WebGuy 
modules: 
    enabled: 
     - Selenium2 
     - WebHelper 
    config: 
      Selenium2: 
       url: 'http://nemo.dev' 
       browser: firefox 
       delay: 1000 

測試:

<?php 
$I = new WebGuy($scenario); 
$I->wantTo('see text'); 
$I->amGoingTo('/'); 
$I->see('text'); 

構建之後,並運行Firefox啓動,顯示空白頁,並退出。

在控制檯:

1) Couldn't see text in SigninCept.php 
Guy couldn't see "text": 'text' in . 
Failed asserting that response contains "text". Response was saved to 'log' directory. 

Scenario Steps: 
2. I see "text" 
1. I am going to/

FAILURES! 
Tests: 1, Assertions: 1, Failures: 1. 

運行Mac OS X 10.8.3,硒:硒服務器獨立-2.32.0.jar,PHP 5.3.15。 失敗,日誌中的白色屏幕截圖,不瞭解情況。

回答

1

非常基本的問題。你應該指定起始頁面。總是。 在命令之前插入此行。

$I->amOnPage('/'); 
+0

感覺自己是個白癡。謝謝,但可能您應該在任何FaQ頁面或任何手冊中對此進行註釋。 – 2013-05-12 17:59:56

+0

這對我也有幫助。我不知道我必須在測試中指定一個起始頁面 - 謝謝,Davert! 此外,這是我與Codeception的第一天,但​​我喜歡它。 – RoboBear 2015-09-04 22:12:31

相關問題