Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.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
Laravel 如何强制执行';类型';方法,以在浏览器中完全输入我的测试数据_Laravel_Laravel Dusk_Phpunit_Browser Testing - Fatal编程技术网

Laravel 如何强制执行';类型';方法,以在浏览器中完全输入我的测试数据

Laravel 如何强制执行';类型';方法,以在浏览器中完全输入我的测试数据,laravel,laravel-dusk,phpunit,browser-testing,Laravel,Laravel Dusk,Phpunit,Browser Testing,我有三个测试数据[检查、装运、交付]可以使用loop自动输入。它不会输入第三个,这会导致测试失败。这是密码 下面是我的测试数据代码 private static function getValidAdminCommentInput() { return[ //key 'Comment[order_comment]' => [ //testNo Value

我有三个测试数据[检查、装运、交付]可以使用loop自动输入。它不会输入第三个,这会导致测试失败。这是密码

下面是我的测试数据代码

private static function getValidAdminCommentInput()
    {
        return[
            //key
            'Comment[order_comment]' => [
                //testNo           Value                input method    assertMethod
                'testSpec01' => ['Checking order',      'type',         'assertInputValue'],
                'testSpec02' => ['Shipping order',      'type',         'assertInputValue'],
                'testSpec03' => ['Delivering order',    'type',         'assertInputValue'],
            ],
        ];
    }
这是我用来自动输入上述三个测试数据的foreach和while循环

            $adminCommentInputData = self::getValidAdminCommentInput();
            $retryMax = 5;
            $retryCount = 0;
            foreach ($adminCommentInputData as $keys => $keyVal) {
                foreach ($keyVal as $key => $input) {
                    $selector = '[name="' . $keys . '"]';
                    $method = $input[1];
                    $assertMethod = $input[2];
                    sleep(60); // creates time interval of comments to simulate real commenting time interval
                    while ($retryCount++ < $retryMax) {
                        $browser->clickLink('Admin Comments')
                                ->clickLink('Create Admin Comments')
                                ->waitFor($selector)
                                ->$method($selector, $input[0]);
                        try {
                            $browser->$assertMethod($selector, $input[0])
                                    ->press('Create');
                                break;
                        } catch (AssertionFailedError $e) {
                                // ignore
                        }
                    }
                }
            }
$adminCommentInputData=self::getValidAdminCommentInput();
$retryMax=5;
$retryCount=0;
foreach($adminCommentInputData作为$keys=>$keyVal){
foreach($keyVal作为$key=>$input){
$selector='[name=“.$keys.']”;
$method=$input[1];
$assertMethod=$input[2];
sleep(60);//创建注释的时间间隔以模拟真实的注释时间间隔
而($retryCount++<$retryMax){
$browser->clickLink('Admin Comments')
->单击链接(“创建管理员注释”)
->等待($selector)
->$method($selector,$input[0]);
试一试{
$browser->$assertMethod($selector,$input[0])
->按(“创建”);
打破
}捕获(断言失败错误$e){
//忽略
}
}
}
}
请帮忙,谢谢