Laravel Dusk无法读取未定义的点击

时间:2018-10-04 07:48:20

标签: php laravel laravel-dusk

我尝试了laravel dusk的简单演示,但它给了我以下错误:我尝试按照某些解决方案的建议更新composer安装程序,并尝试按照git的建议设置duskcommand.php,但仍然出现错误。

Warning: TTY mode is not supported on Windows platform.
PHPUnit 7.3.5 by Sebastian Bergmann and contributors.

[1004/130622.087:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.

1) Tests\Browser\RegisterTest::testExample
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Cannot read property 'click' of undefined
  (Session info: headless chrome=69.0.3497.100)
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.17134 x86_64)

我正在windows10中试用此演示

下面是我的RegisterTest.php

<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class RegisterTest extends DuskTestCase
{
    /**
     * A Dusk test example.
     *
     * @return void
     */
    public function testExample()
    {
        $this->browse(function ($browser) {
            $browser->visit('/') //Go to the homepage
                    ->clickLink('Register') //Click the Register link
                    ->assertSee('Register') //Make sure the phrase in the arguement is on the page
            //Fill the form with these values
                    ->value('#name', 'Joe') 
                    ->value('#email', 'joe@example.com')
                    ->value('#password', '123456')
                    ->value('#password-confirm', '123456')
                    ->click('button[type="submit"]') //Click the submit button on the page
                    ->assertPathIs('/home') //Make sure you are in the home page
            //Make sure you see the phrase in the arguement
                    ->assertSee("You are logged in!"); 
        });
    }
}

0 个答案:

没有答案