IndexTest.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Tests\Browser;
  3. use Laravel\Dusk\Browser;
  4. use Tests\TestCase;
  5. /**
  6. * @group index
  7. */
  8. class IndexTest extends TestCase
  9. {
  10. public function testIndex()
  11. {
  12. $this->browse(function (Browser $browser) {
  13. $browser->visit(test_admin_path('/'))
  14. ->assertSee('Administrator')
  15. ->assertSee('Dashboard')
  16. ->assertSee('Description...')
  17. ->assertSee('New Users')
  18. ->assertSee('New Devices')
  19. ->assertSee('Tickets')
  20. ->assertSee(__('admin.documentation'))
  21. ->assertSee(__('admin.extensions'))
  22. ->assertSee(__('admin.demo'))
  23. ->assertSee('GITHUB');
  24. });
  25. }
  26. public function testClickMenu()
  27. {
  28. $this->browse(function (Browser $browser) {
  29. $browser->visit(test_admin_path('/'))
  30. ->within('.main-menu-content', function (Browser $browser) {
  31. $browser
  32. ->clickLink('Admin')
  33. ->whenTextAvailable('Users', 2)
  34. ->clickLink('Users')
  35. ->assertPathIs(test_admin_path('auth/users'))
  36. ->clickLink('Roles')
  37. ->assertPathIs(test_admin_path('auth/roles'))
  38. ->clickLink('Permission')
  39. ->assertPathIs(test_admin_path('auth/permissions'))
  40. ->clickLink('Menu')
  41. ->assertPathIs(test_admin_path('auth/menu'))
  42. ->clickLink('Operation log')
  43. ->assertPathIs(test_admin_path('auth/logs'))
  44. ->clickLink('Helpers')
  45. ->whenTextAvailable('Extensions', 2)
  46. ->clickLink('Extensions')
  47. ->assertPathIs(test_admin_path('helpers/extensions'))
  48. ->clickLink('Scaffold')
  49. ->assertPathIs(test_admin_path('helpers/scaffold'))
  50. ->clickLink('Icons')
  51. ->assertPathIs(test_admin_path('helpers/icons'));
  52. });
  53. });
  54. }
  55. }