Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Feb 14, 2022
1 parent 048da30 commit d4e4582
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 75 deletions.
11 changes: 0 additions & 11 deletions tests/Browser/AbppInstallTest.php
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions tests/Browser/Components/AdminLogin.php
Expand Up @@ -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';
Expand Down
6 changes: 1 addition & 5 deletions tests/Browser/Components/AdminMakeInstall.php
Expand Up @@ -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()) {
Expand Down Expand Up @@ -84,8 +82,6 @@ public function makeInstallation(Browser $browser)

clearcache();



});
}
}
59 changes: 0 additions & 59 deletions tests/DuskTestCase.php
Expand Up @@ -29,8 +29,6 @@ public static function prepare()
if (! static::runningInSail()) {
static::startChromeDriver();
}


}

/**
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit d4e4582

Please sign in to comment.