/*
 * (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.time.Duration.of;
import static java.time.temporal.ChronoUnit.SECONDS;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleContains;

import java.util.NoSuchElementException;

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 org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;

import io.github.bonigarcia.wdm.WebDriverManager;

/**
 * Explicit wait test.
 *
 * @author Boni Garcia
 * @since 1.0.0
 */
class ExplicitWaitTest {

    WebDriver driver;

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

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

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

    @Test
    void test() {
        driver.get("https://bonigarcia.org/webdrivermanager/");
        Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
                .withTimeout(of(10, SECONDS)).pollingEvery(of(1, SECONDS))
                .ignoring(NoSuchElementException.class);
        wait.until(titleContains("WebDriverManager"));
    }

}

@@ -674,98 +674,8 @@
 t;%0A%0A
-import static java.time.Duration.of;%0Aimport static java.time.temporal.ChronoUnit.SECONDS;%0A
 impo
@@ -754,50 +754,8 @@
 s;%0A%0A
-import java.util.NoSuchElementException;%0A%0A
 impo
@@ -1034,58 +1034,17 @@
 .ui.
-FluentWait;%0Aimport org.openqa.selenium.support.ui.
+WebDriver
 Wait
@@ -1571,21 +1571,16 @@
         
-Wait%3C
 WebDrive
@@ -1580,17 +1580,20 @@
 ebDriver
-%3E
+Wait
  wait = 
@@ -1600,167 +1600,31 @@
 new 
-FluentWait%3CWebDriver%3E(driver)%0A                .withTimeout(of(10, SECONDS)).pollingEvery(of(1, SECONDS))%0A                .ignoring(NoSuchElementException.class
+WebDriverWait(driver, 5
 );%0A 

Fix explicit wait test