首页 > 解决方案 > Laravel 黄昏无法输入完整的输入

问题描述

我正在尝试在 Laravel Dusk 上做一个测试用例,我在输入字段中输入,我会看到一些奇怪的功能,有时它不会输入完整的字符并处理下一个断言/测试。

我尝试暂停,但它没有帮助我。

$browser->assertPathIs($this->url())
    ->type('@stock-update-name', 'keshgjkfsdh289359846359462svfcvbjn8475645ksjdhgjfsg5')
    ->pause(1000)
    ->press('@stock-update-submit')//clicked on the button and redirected to table and show the expected filled content
    ->waitFor('.swal2-shown')
    ->assertSee('Oops!')
    ->assertSee('The given data was invalid')
    ->press('OK')
    ->assertSee('The name may not be greater than 20 characters.')
    ->type('@stock-update-name', '@#$786jdf')
    ->press('@stock-update-submit')//clicked on the button and redirected to table and show the expected filled content
    ->waitFor('.swal2-shown')
    ->assertSee('Oops!')
    ->assertSee('The given data was invalid')
    ->press('OK')
    ->assertSee('The name format is invalid.')
    ->type('@stock-update-name', 'instock')//check for valid stock name
    ->press('@stock-update-submit')
    ->waitFor('.swal2-shown')
    ->assertSee('stock has been updated.')
    ->press('OK')
    ->waitForLocation($this->url())
    ->pause(3000);

它应该输入整个字符,但有时它会输入 3 个字符或 5 个字符,因此我的大多数测试用例都失败了。

标签: laravellaravel-dusk

解决方案


推荐阅读