/
AdminMakeInstall.php
85 lines (67 loc) · 1.91 KB
/
AdminMakeInstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace Tests\Browser\Components;
use Facebook\WebDriver\WebDriverBy;
use Laravel\Dusk\Browser;
use Laravel\Dusk\Component as BaseComponent;
use PHPUnit\Framework\Assert as PHPUnit;
class AdminMakeInstall extends BaseComponent
{
/**
* Get the root selector for the component.
*
* @return string
*/
public function selector()
{
return '';
}
/**
* Assert that the browser page contains the component.
*
* @param Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
}
/**
* Get the element shortcuts for the component.
*
* @return array
*/
public function elements()
{
return [];
}
public function makeInstallation(Browser $browser)
{
$siteUrl = site_url();
if (mw_is_installed()) {
PHPUnit::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();
}
}