HasManyTest.php 935 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Tests\Browser;
  3. use Laravel\Dusk\Browser;
  4. use Tests\Browser\Components\Form\Field\HasMany;
  5. use Tests\TestCase;
  6. /**
  7. * 一对多表单功能测试.
  8. *
  9. * @group has-many
  10. */
  11. class HasManyTest extends TestCase
  12. {
  13. public function testCreate()
  14. {
  15. $this->browse(function (Browser $browser) {
  16. $browser->visit(test_admin_path('tests/painters/create'))
  17. ->assertPathIs(test_admin_path('tests/painters/create'))
  18. ->with('form[method="POST"]', function (Browser $browser) {
  19. $browser->assertSeeText('Paintings')
  20. ->with(new HasMany('paintings'), function (Browser $browser) {
  21. // 点击新增
  22. $browser->add();
  23. // 点击删除
  24. $browser->removeLast();
  25. });
  26. });
  27. });
  28. }
  29. }