Skip to content

Commit f41b8ce

Browse files
committed
Enabling BrowsingContextTest for Firefox
1 parent 20a5d29 commit f41b8ce

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/BrowsingContextTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dev.selenium.bidirectional.webdriver_bidi;
22

33
import dev.selenium.BaseTest;
4+
5+
import java.time.Duration;
46
import java.util.List;
57
import org.junit.jupiter.api.Assertions;
68
import org.junit.jupiter.api.BeforeEach;
@@ -20,6 +22,7 @@
2022
import org.openqa.selenium.firefox.FirefoxOptions;
2123
import org.openqa.selenium.print.PrintOptions;
2224
import org.openqa.selenium.remote.RemoteWebElement;
25+
import org.openqa.selenium.support.ui.WebDriverWait;
2326

2427
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
2528
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
@@ -31,6 +34,7 @@ public void setup() {
3134
FirefoxOptions options = new FirefoxOptions();
3235
options.setCapability("webSocketUrl", true);
3336
driver = new FirefoxDriver(options);
37+
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
3438
}
3539

3640
@Test
@@ -235,7 +239,7 @@ void textCaptureScreenshot() {
235239

236240
String screenshot = browsingContext.captureScreenshot();
237241

238-
Assertions.assertTrue(screenshot.length() > 0);
242+
Assertions.assertFalse(screenshot.isEmpty());
239243
}
240244

241245
@Test
@@ -251,7 +255,7 @@ void textCaptureViewportScreenshot() {
251255
browsingContext.captureBoxScreenshot(
252256
elementRectangle.getX(), elementRectangle.getY(), 5, 5);
253257

254-
Assertions.assertTrue(screenshot.length() > 0);
258+
Assertions.assertFalse(screenshot.isEmpty());
255259
}
256260

257261
@Test
@@ -263,7 +267,7 @@ void textCaptureElementScreenshot() {
263267

264268
String screenshot = browsingContext.captureElementScreenshot(((RemoteWebElement) element).getId());
265269

266-
Assertions.assertTrue(screenshot.length() > 0);
270+
Assertions.assertFalse(screenshot.isEmpty());
267271
}
268272

269273
@Test
@@ -305,11 +309,10 @@ void testPrintPage() {
305309

306310
String printPage = browsingContext.print(printOptions);
307311

308-
Assertions.assertTrue(printPage.length() > 0);
312+
Assertions.assertFalse(printPage.isEmpty());
309313
}
310314

311315
@Test
312-
@Disabled("Supported by Firefox Nightly 124")
313316
void testNavigateBackInTheBrowserHistory() {
314317
BrowsingContext browsingContext = new BrowsingContext(driver, driver.getWindowHandle());
315318
browsingContext.navigate("https://www.selenium.dev/selenium/web/formPage.html", ReadinessState.COMPLETE);
@@ -322,7 +325,6 @@ void testNavigateBackInTheBrowserHistory() {
322325
}
323326

324327
@Test
325-
@Disabled("Supported by Firefox Nightly 124")
326328
void canNavigateForwardInTheBrowserHistory() {
327329
BrowsingContext browsingContext = new BrowsingContext(driver, driver.getWindowHandle());
328330
browsingContext.navigate("https://www.selenium.dev/selenium/web/formPage.html", ReadinessState.COMPLETE);
@@ -338,7 +340,6 @@ void canNavigateForwardInTheBrowserHistory() {
338340
}
339341

340342
@Test
341-
@Disabled("Supported by Firefox Nightly 124")
342343
void canTraverseBrowserHistory() {
343344
BrowsingContext browsingContext = new BrowsingContext(driver, driver.getWindowHandle());
344345
browsingContext.navigate("https://www.selenium.dev/selenium/web/formPage.html", ReadinessState.COMPLETE);

0 commit comments

Comments
 (0)