/*
 * Copyright 2016 SFB 632.
 *
 * 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 annis.gui;

import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

/**
 *
 * @author thomas
 */
public class AcceptanceTest
{
  
  @Test
  public void testSimple() throws Exception
  {
    // Create a new instance of the Firefox driver
    // Notice that the remainder of the code relies on the interface, 
    // not the implementation.
    WebDriver driver = new FirefoxDriver();

    // And now use this to visit NetBeans
    driver.get("http://www.netbeans.org");
    // Alternatively the same thing can be done like this
    // driver.navigate().to("http://www.netbeans.org");

    // Check the title of the page
    // Wait for the page to load, timeout after 10 seconds
    (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>()
    {
      @Override
      public Boolean apply(WebDriver d)
      {
        return d.getTitle().contains("NetBeans");
      }
    });

    //Close the browser
    driver.quit();
  }
  
}

@@ -606,16 +606,94 @@
 s.gui;%0A%0A
+import com.gargoylesoftware.htmlunit.BrowserVersion;%0Aimport org.junit.Before;%0A
 import o
@@ -776,23 +776,25 @@
 ium.
-firefox.Firefox
+htmlunit.HtmlUnit
 Driv
@@ -970,16 +970,64 @@
 st%0A%7B%0A  %0A
+  @Before%0A  public void setup()%0A  %7B%0A    %0A  %7D%0A  %0A
   @Test%0A
@@ -1258,22 +1258,48 @@
 new 
-FirefoxDriver(
+HtmlUnitDriver(BrowserVersion.FIREFOX_38
 );%0A%0A

use htmlunit driver