IndexTest.php 2.2 KB

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