/
DuskTestCase.php
69 lines (60 loc) · 1.64 KB
/
DuskTestCase.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
<?php
namespace TheRestartProject\RepairDirectory\Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use TheRestartProject\RepairDirectory\Testing\DatabaseMigrations;
use TheRestartProject\RepairDirectory\Testing\FixometerDatabaseMigrations;
/**
* Class DuskTestCase
*
* @category Tests
* @package TheRestartProject\RepairDirectory\Tests
* @author Matthew Kendon <matt@outlandish.com>
* @license GPLv2 https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
* @link https://laravel.com/docs/5.4/dusk
*
* @method runDatabaseMigrations
* @method runFixometerDatabaseMigrations
*/
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
return RemoteWebDriver::create(
'http://selenium:4444/wd/hub',
DesiredCapabilities::chrome()
);
}
/**
* Boot the testing helper traits.
*
* @return array
*/
protected function setUpTraits()
{
$uses = parent::setUpTraits();
if (isset($uses[DatabaseMigrations::class])) {
$this->runDatabaseMigrations();
}
if (isset($uses[FixometerDatabaseMigrations::class])) {
$this->runFixometerDatabaseMigrations();
}
return $uses;
}
}