File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -129,18 +129,37 @@ public function _failed(TestInterface $test, $fail)
129
129
*/
130
130
public function _before (TestInterface $ test )
131
131
{
132
- if (!$ this ->hasModule ($ this ->config ['module ' ])) {
132
+ $ browserModule = $ this ->getBrowserModule ();
133
+
134
+ if ($ browserModule === null ) {
133
135
throw new \Codeception \Exception \ConfigurationException ("VisualCeption uses the WebDriver. Please ensure that this module is activated. " );
134
136
}
135
137
if (!class_exists ('Imagick ' )) {
136
138
throw new \Codeception \Exception \ConfigurationException ("VisualCeption requires ImageMagick PHP Extension but it was not installed " );
137
139
}
138
140
139
- $ this ->webDriverModule = $ this -> getModule ( $ this -> config [ ' module ' ]) ;
141
+ $ this ->webDriverModule = $ browserModule ;
140
142
$ this ->webDriver = $ this ->webDriverModule ->webDriver ;
141
143
142
144
$ this ->test = $ test ;
143
145
}
146
+
147
+ protected function getBrowserModule () {
148
+ if ($ this ->hasModule ($ this ->config ['module ' ])) {
149
+ return $ this ->getModule ($ this ->config ['module ' ]);
150
+ }
151
+
152
+ foreach ($ this ->getModules () as $ module ) {
153
+ if ($ module === $ this ) {
154
+ continue ;
155
+ }
156
+ if ($ module instanceof WebDriver) {
157
+ return $ module ;
158
+ }
159
+ }
160
+
161
+ return null ;
162
+ }
144
163
145
164
/**
146
165
* Get value of the private property $referenceImageDir
You can’t perform that action at this time.
0 commit comments