|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace Tests\Browser\Cases;
|
|
|
|
|
|
+use Dcat\Admin\Admin;
|
|
|
use Laravel\Dusk\Browser;
|
|
|
use Tests\TestCase;
|
|
|
|
|
@@ -35,27 +36,39 @@ class IndexTest extends TestCase
|
|
|
$browser->visit(admin_base_path('/'))
|
|
|
->within('.main-menu-content', function (Browser $browser) {
|
|
|
$browser
|
|
|
- ->clickLink('Admin')
|
|
|
- ->whenTextAvailable('Users', 2)
|
|
|
- ->clickLink('Users')
|
|
|
+ ->clickLink($this->translateMenuTitle('Admin'))
|
|
|
+ ->whenTextAvailable($this->translateMenuTitle('Users'), 2)
|
|
|
+ ->clickLink($this->translateMenuTitle('Users'))
|
|
|
->assertPathIs(admin_base_path('auth/users'))
|
|
|
- ->clickLink('Roles')
|
|
|
+ ->clickLink($this->translateMenuTitle('Roles'))
|
|
|
->assertPathIs(admin_base_path('auth/roles'))
|
|
|
- ->clickLink('Permission')
|
|
|
+ ->clickLink($this->translateMenuTitle('Permission'))
|
|
|
->assertPathIs(admin_base_path('auth/permissions'))
|
|
|
- ->clickLink('Menu')
|
|
|
+ ->clickLink($this->translateMenuTitle('Menu'))
|
|
|
->assertPathIs(admin_base_path('auth/menu'))
|
|
|
- ->clickLink('Operation log')
|
|
|
+ ->clickLink($this->translateMenuTitle('Operation log'))
|
|
|
->assertPathIs(admin_base_path('auth/logs'))
|
|
|
- ->clickLink('Helpers')
|
|
|
- ->whenTextAvailable('Extensions', 2)
|
|
|
- ->clickLink('Extensions')
|
|
|
+ ->clickLink($this->translateMenuTitle('Helpers'))
|
|
|
+ ->whenTextAvailable($this->translateMenuTitle('Extensions'), 2)
|
|
|
+ ->clickLink($this->translateMenuTitle('Extensions'))
|
|
|
->assertPathIs(admin_base_path('helpers/extensions'))
|
|
|
- ->clickLink('Scaffold')
|
|
|
+ ->clickLink($this->translateMenuTitle('Scaffold'))
|
|
|
->assertPathIs(admin_base_path('helpers/scaffold'))
|
|
|
- ->clickLink('Icons')
|
|
|
+ ->clickLink($this->translateMenuTitle('Icons'))
|
|
|
->assertPathIs(admin_base_path('helpers/icons'));
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 翻译菜单标题.
|
|
|
+ *
|
|
|
+ * @param $title
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function translateMenuTitle($title)
|
|
|
+ {
|
|
|
+ return Admin::menu()->translate($title);
|
|
|
+ }
|
|
|
}
|