質問編集履歴
2
dusktestcase add more
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
でduskテストを行なったところ、
|
52
52
|
|
53
|
-
chromeは立ち上がっているものの、localhostにアクセスできていないことがわかりました。(中身が何もない状態でした。)
|
53
|
+
chromeは立ち上がっているものの、localhostに正常にアクセスできていないことがわかりました。(デバッグしてみると中身が何もない状態でした。)
|
54
54
|
|
55
55
|
|
56
56
|
|
@@ -63,6 +63,46 @@
|
|
63
63
|
DuskTestCase.php
|
64
64
|
|
65
65
|
```php
|
66
|
+
|
67
|
+
abstract class DuskTestCase extends BaseTestCase
|
68
|
+
|
69
|
+
{
|
70
|
+
|
71
|
+
use CreatesApplication;
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
/**
|
76
|
+
|
77
|
+
* Prepare for Dusk test execution.
|
78
|
+
|
79
|
+
*
|
80
|
+
|
81
|
+
* @beforeClass
|
82
|
+
|
83
|
+
* @return void
|
84
|
+
|
85
|
+
*/
|
86
|
+
|
87
|
+
public static function prepare()
|
88
|
+
|
89
|
+
{
|
90
|
+
|
91
|
+
static::startChromeDriver();
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
/**
|
98
|
+
|
99
|
+
* Create the RemoteWebDriver instance.
|
100
|
+
|
101
|
+
*
|
102
|
+
|
103
|
+
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
|
104
|
+
|
105
|
+
*/
|
66
106
|
|
67
107
|
protected function driver()
|
68
108
|
|
@@ -87,6 +127,8 @@
|
|
87
127
|
);
|
88
128
|
|
89
129
|
}
|
130
|
+
|
131
|
+
}
|
90
132
|
|
91
133
|
```
|
92
134
|
|
1
DuskTestCase.php add
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Dockerを使用した Laravel環境で, Dusk テストを行いたいが、値が返ってこない
|
test
CHANGED
@@ -50,9 +50,49 @@
|
|
50
50
|
|
51
51
|
でduskテストを行なったところ、
|
52
52
|
|
53
|
+
chromeは立ち上がっているものの、localhostにアクセスできていないことがわかりました。(中身が何もない状態でした。)
|
53
54
|
|
54
55
|
|
55
56
|
|
57
|
+
設定が悪いのだろうと思いますが、どこに原因があるか分からないので、お助けいただければ幸いです。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
DuskTestCase.php
|
64
|
+
|
65
|
+
```php
|
66
|
+
|
67
|
+
protected function driver()
|
68
|
+
|
69
|
+
{
|
70
|
+
|
71
|
+
$options = (new ChromeOptions)->addArguments([
|
72
|
+
|
73
|
+
'--disable-gpu',
|
74
|
+
|
75
|
+
'--headless'
|
76
|
+
|
77
|
+
]);
|
78
|
+
|
79
|
+
return RemoteWebDriver::create(
|
80
|
+
|
81
|
+
'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
|
82
|
+
|
83
|
+
ChromeOptions::CAPABILITY, $options
|
84
|
+
|
85
|
+
)
|
86
|
+
|
87
|
+
);
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
ExampleTest.php
|
56
96
|
|
57
97
|
```php
|
58
98
|
|
@@ -81,11 +121,3 @@
|
|
81
121
|
|
82
122
|
|
83
123
|
```
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
上記にあるように $browser の中身を見てみると、php を起動する apache2 側から、chromeは立ち上がっているものの、localhostにアクセスできていないことがわかりました。(中身が何もない状態でした。)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
設定が悪いのだろうと思いますが、どこに原因があるか分からないので、お助けいただければ幸いです。
|