package pt.fccn.mobile.arquivo.tests.pagesearch;

import java.time.LocalDate;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import pt.fccn.arquivo.selenium.Retry;
import pt.fccn.arquivo.selenium.WebDriverTestBaseParalell;
import pt.fccn.mobile.arquivo.utils.IonicDatePicker;

/**
 * 
 * @author pedro.gomes.fccn@gmail.com
 *
 */

public class PageSearchNotArchivedFileTest extends WebDriverTestBaseParalell {

	public PageSearchNotArchivedFileTest(String os, String version, String browser, String deviceName,
			String deviceOrientation) {
		super(os, version, browser, deviceName, deviceOrientation);
	}

	@Test
	@Retry
	public void notArchivedFileTest() throws Exception {
		run("Search fccn", () -> {
			driver.findElement(By.id("txtSearch")).clear();
			driver.findElement(By.id("txtSearch")).sendKeys("fccn");
			driver.findElement(By.xpath("//*[@id=\"buttonSearch\"]/button")).click();
		});

		waitUntilElementIsVisibleAndGet(By.id("resultados-lista"));

		run("click first position", () -> {
			driver.findElement(By.xpath("//*[@id=\"resultados-lista\"]/ul/li[1]/div[1]/a")).click();
		});

		appendError("Check if page is not archived", () -> new WebDriverWait(driver, 20)
				.until(ExpectedConditions.invisibilityOfElementLocated(By.id("pageIsNotArchived"))));

		driver.navigate().back();

		waitUntilElementIsVisibleAndGet(By.id("resultados-lista"));

		run("click second position", () -> {
			driver.findElement(By.xpath("//*[@id=\"resultados-lista\"]/ul/li[2]/div[1]/a")).click();
		});

		appendError("Check if page is not archived", () -> new WebDriverWait(driver, 20)
				.until(ExpectedConditions.invisibilityOfElementLocated(By.id("pageIsNotArchived"))));

		driver.navigate().back();

		waitUntilElementIsVisibleAndGet(By.id("resultados-lista"));

		run("click third position", () -> {
			driver.findElement(By.xpath("//*[@id=\"resultados-lista\"]/ul/li[3]/div[1]/a")).click();
		});

		appendError("Check if page is not archived", () -> new WebDriverWait(driver, 20)
				.until(ExpectedConditions.invisibilityOfElementLocated(By.id("pageIsNotArchived"))));

	}

}

@@ -47,37 +47,8 @@
 h;%0A%0A
-import java.time.LocalDate;%0A%0A
 impo
@@ -101,47 +101,8 @@
 By;%0A
-import org.openqa.selenium.WebElement;%0A
 impo
@@ -310,61 +310,8 @@
 ell;
-%0Aimport pt.fccn.mobile.arquivo.utils.IonicDatePicker;
 %0A%0A/*

Fix Imports NotArchived