/*
 * (C) Copyright 2020 Boni Garcia (http://bonigarcia.github.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package io.github.bonigarcia.wdm.test.wait;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

/**
 * Fluent wait test.
 *
 * @author Boni Garcia
 * @since 1.0.0
 */
class FluentWaitTest {

    WebDriver driver;

    @BeforeAll
    static void setupClass() {
        WebDriverManager.chromedriver().setup();
    }

    @BeforeEach
    void setupTest() {
        driver = new ChromeDriver();
    }

    @AfterEach
    void teardown() {
        driver.quit();
    }

    @Test
    void test() {
        driver.manage().timeouts().implicitlyWait(10, SECONDS);
        driver.get("https://bonigarcia.org/webdrivermanager/");
        assertThat(driver.getTitle()).contains("WebDriverManager");
    }

}

@@ -681,110 +681,26 @@
 ort 
-static 
 java.
-u
 ti
-l.concurrent.TimeUnit.SECONDS;%0Aimport static org.assertj.core.api.Assertions.assertThat
+me.Duration
 ;%0A%0Ai
@@ -854,16 +854,67 @@
 i.Test;%0A
+import org.openqa.selenium.NoSuchElementException;%0A
 import o
@@ -990,16 +990,168 @@
 eDriver;
+%0Aimport org.openqa.selenium.support.ui.ExpectedConditions;%0Aimport org.openqa.selenium.support.ui.FluentWait;%0Aimport org.openqa.selenium.support.ui.Wait;
 %0A%0Aimport
@@ -1605,61 +1605,216 @@
     
-driver.manage().timeouts().implicitlyWait(10, SECONDS
+Wait%3CWebDriver%3E wait = new FluentWait%3C%3E(driver)%0A                .withTimeout(Duration.ofSeconds(30))%0A                .pollingEvery(Duration.ofSeconds(1))%0A                .ignoring(NoSuchElementException.class
 );%0A 
@@ -1888,39 +1888,44 @@
     
-assertThat(driver.getTitle()).c
+wait.until(ExpectedConditions.titleC
 onta
@@ -1947,16 +1947,17 @@
 anager%22)
+)
 ;%0A    %7D%0A

Fix fluent wait example