MenuEditPage.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Tests\Browser\Pages;
  3. use Laravel\Dusk\Browser;
  4. use Tests\Browser\Components\Form\MenuEditForm;
  5. class MenuEditPage extends Page
  6. {
  7. protected $id;
  8. public function __construct($id)
  9. {
  10. $this->id = $id;
  11. }
  12. /**
  13. * Get the URL for the page.
  14. *
  15. * @return string
  16. */
  17. public function url()
  18. {
  19. return admin_base_path("auth/menu/{$this->id}/edit");
  20. }
  21. /**
  22. * Assert that the browser is on the page.
  23. *
  24. * @param \Laravel\Dusk\Browser $browser
  25. * @return void
  26. */
  27. public function assert(Browser $browser)
  28. {
  29. $browser->assertSeeText(__('admin.menu'))
  30. ->assertSeeText(__('admin.edit'))
  31. ->assertSeeText(__('admin.list'))
  32. ->assertSeeText(__('admin.delete'))
  33. ->scrollToBottom()
  34. ->assertSeeText(__('admin.submit'))
  35. ->assertSeeText(__('admin.reset'))
  36. ->is(new MenuEditForm($this->id));
  37. }
  38. /**
  39. * Get the element shortcuts for the page.
  40. *
  41. * @return array
  42. */
  43. public function elements()
  44. {
  45. return [
  46. '@form' => 'form[method="POST"]',
  47. ];
  48. }
  49. }