laravel dusk waitUntilVue无法用于浏览器测试

问题描述

我正在浏览器上测试基于vue + laravel构建的Web应用程序,我陷入了waitUntilVue方法的困境。文档中没有太多内容,几乎每个遇到此问题的人都无法解决。所以我想这是Laravel黄昏本身的问题吗?

这是我到目前为止所做的:

<?PHP

namespace Tests\browser;

use App\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\browser;
use Tests\DuskTestCase;
use Illuminate\Support\Facades\Hash;
use Illuminate\Foundation\Testing\WithFaker;

class loginTest extends DuskTestCase
{
    use WithFaker,DatabaseMigrations;

    public function testLogin()
    {
        $user = factory(User::class)->create([
            'first_name' => $this->faker->firstName,'email' => '[email protected]','status' => 'VERIFIED','password' => Hash::make('password')
        ]);


        $this->assertDatabaseHas('users',['email' => $user->email,'password' => $user->password]);
        $this->assertTrue(Hash::check('password',$user->password));

        $this->browse(function (browser $browser) use ($user) {
            $browser->visit('/login')
                ->type('email',$user->email)
                ->type('password','password')
                ->press('Log In')
                ->waitForLocation('/')
                ->waitForText('Your text here...')
                ->waitUntilVue('loading',false,'@HomePage')
                ->assertPathIs('/');
        });
        $this->closeAll();
    }
}

由于ajax请求进行查询,并且数据库已经删除,因此我在这里很费劲。寻找更好的解决方案。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)