Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在PhantomJS中使用seeElement()时出错_Php_Phantomjs_Yii2_Codeception_Acceptance Testing - Fatal编程技术网

Php 在PhantomJS中使用seeElement()时出错

Php 在PhantomJS中使用seeElement()时出错,php,phantomjs,yii2,codeception,acceptance-testing,Php,Phantomjs,Yii2,Codeception,Acceptance Testing,我正在使用Codeception测试我的Yii2应用程序 我从默认的PhpBrowser切换到了phantomjs2,因为PhpBrowser无法处理本机javascript弹出窗口,例如用于验收测试的“confirm()” 因此,我将acceptance.suite.yml配置更改为: class_name: AcceptanceTester modules: enabled: - WebDriver - tests\codeception\_suppo

我正在使用Codeception测试我的Yii2应用程序

我从默认的PhpBrowser切换到了phantomjs2,因为PhpBrowser无法处理本机javascript弹出窗口,例如用于验收测试的“confirm()”

因此,我将acceptance.suite.yml配置更改为:

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver
        - tests\codeception\_support\FixtureHelper
    config:
        WebDriver:
            url: http://www.lppm.local
            browser: firefox
            window_size: 1366x768
            restart: true
这是我的测试脚本:

<?php
use \tests\codeception\_pages\PeriodPage;

$I = new AcceptanceTester\AdminSteps($scenario);
$I->wantTo('Ensure that period access right is working fine');

$I->amGoingTo('Go to period main page');
PeriodPage::openBy($I);
$I->expectTo('See Action Buttons in grid view');
$I->seeElement('.glyphicon-trash');
$I->seeElement('.glyphicon-pencil');

$I->amGoingTo('Create a new period');
$I->click(PeriodPage::$create_button);
$I->seeInCurrentUrl('period/create');
$I->fillField('input[name="Period[name]"]', 'New Period');
$I->fillField('input[name="Period[start_date]"]', '2014-01-01');
$I->fillField('input[name="Period[end_date]"]', '2014-08-01');
$I->click('Create');

$I->expectTo('Redirected to the new period detail page');
$I->seeInCurrentUrl('period/view');
$period_url = $I->grabFromCurrentUrl();


$I->wantTo('Ensure period access right is working fine for normal user');
$normal_user = $I->haveFriend('Normal User');
$normal_user->does(function(\AcceptanceTester\GuestSteps $I) use ($period_url, $scenario){
    $I->login('user', 'user');
    $I->see('User, '.dropdown-toggle');
    $I->wantTo('Ensure that no action button is available in view page');
    $I->amOnPage($period_url);
    $I->dontSee('.btn');

    $I->wantTo('Ensure that no action button is available in index page');
    PeriodPage::openBy($I);
    $I->dontSee(PeriodPage::$create_button);
    $I->dontSeeElement('.glyphicon-trash');
    $I->dontSeeElement('.glyphicon-pencil');
});

所以这个问题已经有一年了。我对幻影也有同样的体验。