Laravel黄昏无法输入完整的输入

时间:2019-10-17 10:18:55

标签: laravel laravel-dusk

我正在尝试在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个字符,因此我的大多数测试用例都失败了。

0 个答案:

没有答案