diff --git a/tests/Browser/AbppInstallTest.php b/tests/Browser/AbppInstallTest.php index 1e58c1d90e9..36170615349 100644 --- a/tests/Browser/AbppInstallTest.php +++ b/tests/Browser/AbppInstallTest.php @@ -14,27 +14,16 @@ class AbppInstallTest extends DuskTestCase { - public function testViewDashboard() { -// $this->testInstallation(); -// $user = User::where('is_admin', '=', '1')->first(); -// Auth::login($user); $siteUrl = $this->siteUrl; $this->browse(function (Browser $browser) use($siteUrl) { - - $browser->within(new AdminMakeInstall(), function ($browser) { - $browser->makeInstallation(); - }); - - $browser->within(new AdminLogin(), function ($browser) { $browser->fillForm(); }); - $browser->visit($siteUrl . 'admin'); $browser->pause(5000); diff --git a/tests/Browser/Components/AdminLogin.php b/tests/Browser/Components/AdminLogin.php index 1721c13e8b4..addf1b3e726 100644 --- a/tests/Browser/Components/AdminLogin.php +++ b/tests/Browser/Components/AdminLogin.php @@ -41,6 +41,11 @@ public function elements() public function fillForm(Browser $browser, $username = 1, $password = 1) { + // Check app is installed + $browser->within(new AdminMakeInstall(), function ($browser) { + $browser->makeInstallation(); + }); + $data = []; $data['option_value'] = 'n'; $data['option_key'] = 'login_captcha_enabled'; diff --git a/tests/Browser/Components/AdminMakeInstall.php b/tests/Browser/Components/AdminMakeInstall.php index 87931725f49..76be78bfb5d 100644 --- a/tests/Browser/Components/AdminMakeInstall.php +++ b/tests/Browser/Components/AdminMakeInstall.php @@ -39,12 +39,10 @@ public function elements() return []; } - - public function makeInstallation(Browser $browser) { - $siteUrl = site_url(); + $this->browse(function (Browser $browser) use($siteUrl) { if (mw_is_installed()) { @@ -84,8 +82,6 @@ public function makeInstallation(Browser $browser) clearcache(); - - }); } } diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 97d9c8b22b8..96ec90b3fdf 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -29,8 +29,6 @@ public static function prepare() if (! static::runningInSail()) { static::startChromeDriver(); } - - } /** @@ -71,63 +69,6 @@ protected function driver() ); } - protected function setUp(): void - { - parent::setUp(); - $this->testInstallation(); - } - - public function testInstallation() - { - $siteUrl = $this->siteUrl; - - $this->browse(function (Browser $browser) use($siteUrl) { - - if (mw_is_installed()) { - $this->assertTrue(true); - return true; - } - - /* $deleteDbFiles = []; - $deleteDbFiles[] = dirname(dirname(__DIR__)) . DS . 'config/microweber.php'; - $deleteDbFiles[] = dirname(dirname(__DIR__)) . DS . 'storage/127_0_0_1.sqlite'; - foreach ($deleteDbFiles as $file) { - if (is_file($file)) { - unlink($file); - } - }*/ - - $browser->visit($siteUrl)->assertSee('install'); - - $browser->within(new ChekForJavascriptErrors(), function ($browser) { - $browser->validate(); - }); - - - // Fill the install fields - $browser->type('admin_username', '1'); - $browser->type('admin_password', '1'); - $browser->type('admin_password2', '1'); - $browser->type('admin_email', 'bobi@microweber.com'); - - $browser->pause(300); - $browser->select('#default_template', 'new-world'); - - $browser->pause(100); - $browser->click('@install-button'); - - $browser->pause(20000); - - clearcache(); - - - - }); - } - - - - /** * Determine whether the Dusk command has disabled headless mode. *