27
27
import static org .openqa .selenium .testing .TestUtilities .isFirefoxVersionOlderThan ;
28
28
29
29
import com .google .common .net .MediaType ;
30
+ import java .util .Objects ;
30
31
import java .util .concurrent .atomic .AtomicBoolean ;
31
32
import org .junit .jupiter .api .AfterEach ;
32
33
import org .junit .jupiter .api .BeforeAll ;
39
40
import org .openqa .selenium .remote .http .Filter ;
40
41
import org .openqa .selenium .remote .http .HttpResponse ;
41
42
import org .openqa .selenium .remote .http .Route ;
42
- import org .openqa .selenium .testing .Ignore ;
43
43
import org .openqa .selenium .testing .JupiterTestBase ;
44
+ import org .openqa .selenium .testing .NoDriverBeforeTest ;
44
45
import org .openqa .selenium .testing .drivers .Browser ;
45
46
import org .openqa .selenium .testing .drivers .WebDriverBuilder ;
46
47
@@ -59,7 +60,7 @@ public static void shouldTestBeRunAtAll() {
59
60
60
61
@ BeforeEach
61
62
public void setup () {
62
- driver = new WebDriverBuilder ().get ();
63
+ driver = new WebDriverBuilder ().get (Objects . requireNonNull ( Browser . detect ()). getCapabilities () );
63
64
64
65
assumeThat (driver ).isInstanceOf (HasDevTools .class );
65
66
assumeThat (isFirefoxVersionOlderThan (87 , driver )).isFalse ();
@@ -96,7 +97,7 @@ public void tearDown() {
96
97
}
97
98
98
99
@ Test
99
- @ Ignore ( gitHubActions = true , reason = "Fails in GH Actions but passes locally. Needs debugging." )
100
+ @ NoDriverBeforeTest
100
101
void shouldProceedAsNormalIfRequestIsNotIntercepted () {
101
102
interceptor =
102
103
new NetworkInterceptor (
@@ -110,7 +111,7 @@ void shouldProceedAsNormalIfRequestIsNotIntercepted() {
110
111
}
111
112
112
113
@ Test
113
- @ Ignore ( gitHubActions = true , reason = "Fails in GH Actions but passes locally. Needs debugging." )
114
+ @ NoDriverBeforeTest
114
115
void shouldAllowTheInterceptorToChangeTheResponse () {
115
116
interceptor =
116
117
new NetworkInterceptor (
@@ -132,7 +133,7 @@ void shouldAllowTheInterceptorToChangeTheResponse() {
132
133
}
133
134
134
135
@ Test
135
- @ Ignore ( gitHubActions = true , reason = "Fails in GH Actions but passes locally. Needs debugging." )
136
+ @ NoDriverBeforeTest
136
137
void shouldBeAbleToReturnAMagicResponseThatCausesTheOriginalRequestToProceed () {
137
138
AtomicBoolean seen = new AtomicBoolean (false );
138
139
@@ -156,6 +157,7 @@ void shouldBeAbleToReturnAMagicResponseThatCausesTheOriginalRequestToProceed() {
156
157
}
157
158
158
159
@ Test
160
+ @ NoDriverBeforeTest
159
161
void shouldClearListenersWhenNetworkInterceptorIsClosed () {
160
162
try (NetworkInterceptor interceptor =
161
163
new NetworkInterceptor (
@@ -181,7 +183,7 @@ void shouldClearListenersWhenNetworkInterceptorIsClosed() {
181
183
}
182
184
183
185
@ Test
184
- @ Ignore ( gitHubActions = true , reason = "Fails in GH Actions but passes locally. Needs debugging." )
186
+ @ NoDriverBeforeTest
185
187
void shouldBeAbleToInterceptAResponse () {
186
188
try (NetworkInterceptor networkInterceptor =
187
189
new NetworkInterceptor (
@@ -190,7 +192,7 @@ void shouldBeAbleToInterceptAResponse() {
190
192
next ->
191
193
req -> {
192
194
HttpResponse res = next .execute (req );
193
- res .addHeader ("Content-Type" , MediaType .HTML_UTF_8 .toString ());
195
+ res .setHeader ("Content-Type" , MediaType .HTML_UTF_8 .toString ());
194
196
res .setContent (Contents .utf8String ("Sausages" ));
195
197
return res ;
196
198
})) {
@@ -203,7 +205,7 @@ void shouldBeAbleToInterceptAResponse() {
203
205
}
204
206
205
207
@ Test
206
- @ Ignore ( gitHubActions = true , reason = "Fails in GH Actions but passes locally. Needs debugging." )
208
+ @ NoDriverBeforeTest
207
209
void shouldHandleRedirects () {
208
210
try (NetworkInterceptor networkInterceptor =
209
211
new NetworkInterceptor (driver , (Filter ) next -> next )) {
0 commit comments