IndexTest.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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('Dashboard')
  15. ->assertSee('Description...')
  16. ->assertSee('Environment')
  17. ->assertSee('PHP version')
  18. ->assertSee('Laravel version')
  19. ->assertSee('Extensions')
  20. ->assertSee('Dependencies')
  21. ->assertSee('php')
  22. ->assertSee('laravel/framework');
  23. });
  24. }
  25. public function testClickMenu()
  26. {
  27. $this->browse(function (Browser $browser) {
  28. $browser->visit(test_admin_path('/'))
  29. ->within('.main-sidebar', function (Browser $browser) {
  30. $browser
  31. ->clickLink('Admin')
  32. ->whenTextAvailable('Users', 2)
  33. ->clickLink('Users')
  34. ->assertPathIs(test_admin_path('auth/users'))
  35. ->clickLink('Roles')
  36. ->assertPathIs(test_admin_path('auth/roles'))
  37. ->clickLink('Permission')
  38. ->assertPathIs(test_admin_path('auth/permissions'))
  39. ->clickLink('Menu')
  40. ->assertPathIs(test_admin_path('auth/menu'))
  41. ->clickLink('Operation log')
  42. ->assertPathIs(test_admin_path('auth/logs'))
  43. ->clickLink('Extensions')
  44. ->assertPathIs(test_admin_path('auth/extensions'))
  45. ->clickLink('Scaffold')
  46. ->assertPathIs(test_admin_path('auth/scaffold'))
  47. ->clickLink('Routes')
  48. ->assertPathIs(test_admin_path('auth/routes'))
  49. ->clickLink('Icons')
  50. ->assertPathIs(test_admin_path('auth/icons'));
  51. });
  52. });
  53. }
  54. }