IndexTest.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Tests\Browser\Cases;
  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(admin_base_path('/'))
  16. ->assertSeeText('Administrator')
  17. ->assertSeeText('Dashboard')
  18. ->assertSeeText('Description...')
  19. ->assertSeeText('New Users')
  20. ->assertSeeText('New Devices')
  21. ->assertSeeText('Tickets')
  22. ->assertSeeText(__('admin.documentation'))
  23. ->assertSeeText(__('admin.extensions'))
  24. ->assertSeeText(__('admin.demo'))
  25. ->assertSeeText('GITHUB');
  26. });
  27. }
  28. public function testClickMenu()
  29. {
  30. $this->browse(function (Browser $browser) {
  31. $browser->visit(admin_base_path('/'))
  32. ->within('.main-menu-content', function (Browser $browser) {
  33. $browser
  34. ->clickLink('Admin')
  35. ->whenTextAvailable('Users', 2)
  36. ->clickLink('Users')
  37. ->assertPathIs(admin_base_path('auth/users'))
  38. ->clickLink('Roles')
  39. ->assertPathIs(admin_base_path('auth/roles'))
  40. ->clickLink('Permission')
  41. ->assertPathIs(admin_base_path('auth/permissions'))
  42. ->clickLink('Menu')
  43. ->assertPathIs(admin_base_path('auth/menu'))
  44. ->clickLink('Operation log')
  45. ->assertPathIs(admin_base_path('auth/logs'))
  46. ->clickLink('Helpers')
  47. ->whenTextAvailable('Extensions', 2)
  48. ->clickLink('Extensions')
  49. ->assertPathIs(admin_base_path('helpers/extensions'))
  50. ->clickLink('Scaffold')
  51. ->assertPathIs(admin_base_path('helpers/scaffold'))
  52. ->clickLink('Icons')
  53. ->assertPathIs(admin_base_path('helpers/icons'));
  54. });
  55. });
  56. }
  57. }