<commit_before>package pt.fccn.mobile.arquivo.tests.imagesearch;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import pt.fccn.arquivo.selenium.WebDriverTestBaseParalell;

/**
 * 
 * @author <EMAIL>  
 * @author <EMAIL>
 *
 */

public class ImageSearchTest extends WebDriverTestBaseParalell {

	/**
	 * Test the search of one term in the index interface.
	 */
	public ImageSearchTest(String os, String version, String browser, String deviceName, String deviceOrientation) {
		super(os, version, browser, deviceName, deviceOrientation);
	}

	@Test
	public void testImageSearchOneTerm() throws Exception {

		run("Search FCCN term", () -> {
			driver.findElement(By.id("txtSearch")).clear();
			driver.findElement(By.id("txtSearch")).sendKeys("fccn");			
			driver.findElement(By.xpath("//*[@id=\"buttonSearch\"]/button")).click();
		});

		run("Search images instead of text", () -> driver.findElement(By.id("BotaoImagens")).click());

		/*Scroll down until the image we want to click is visible*/
		Actions actions = new Actions(driver);
		actions.moveToElement(driver.findElement(By.id("imageResults1")));
		actions.perform();		
		
		run("Click/open one image on search results to open modal",
				() -> driver.findElement(By.id("imageResults1")).click());

		appendError(() -> {
			assertTrue("First image details should be shown after clicking on it",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[1]/h5/a")).isDisplayed());
		});

		appendError(() -> {
			assertEquals("Check image name on opened modal", "FCCN",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[1]/h5/a")).getText());
		});

		appendError(() -> {
			assertEquals("Check image original link on opened modal",
					"www.iscac.pt/files/footeric...444039.png",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[2]/h5")).getText());
		});

		appendError(() -> {
			assertEquals("Check image type and size on opened modal", "png 70 x 60",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[3]/h5")).getText());
		});
<commit_msg>attempting sleep 10s to load image viewer<commit_after>package pt.fccn.mobile.arquivo.tests.imagesearch;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import pt.fccn.arquivo.selenium.WebDriverTestBaseParalell;

/**
 * 
 * @author <EMAIL>  
 * @author <EMAIL>
 *
 */

public class ImageSearchTest extends WebDriverTestBaseParalell {

	/**
	 * Test the search of one term in the index interface.
	 */
	public ImageSearchTest(String os, String version, String browser, String deviceName, String deviceOrientation) {
		super(os, version, browser, deviceName, deviceOrientation);
	}

	@Test
	public void testImageSearchOneTerm() throws Exception {

		run("Search FCCN term", () -> {
			driver.findElement(By.id("txtSearch")).clear();
			driver.findElement(By.id("txtSearch")).sendKeys("fccn");			
			driver.findElement(By.xpath("//*[@id=\"buttonSearch\"]/button")).click();
		});

		run("Search images instead of text", () -> driver.findElement(By.id("BotaoImagens")).click());

		/*Scroll down until the image we want to click is visible*/
		Actions actions = new Actions(driver);
		actions.moveToElement(driver.findElement(By.id("imageResults1")));
		actions.perform();		
		
		run("Click/open one image on search results to open modal",
				() -> driver.findElement(By.id("imageResults1")).click());
		/*Sleeping for 10 seconds - test*/
		Thread.sleep(10000);
		appendError(() -> {
			assertTrue("First image details should be shown after clicking on it",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[1]/h5/a")).isDisplayed());
		});

		appendError(() -> {
			assertEquals("Check image name on opened modal", "FCCN",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[1]/h5/a")).getText());
		});

		appendError(() -> {
			assertEquals("Check image original link on opened modal",
					"www.iscac.pt/files/footeric...444039.png",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[2]/h5")).getText());
		});

		appendError(() -> {
			assertEquals("Check image type and size on opened modal", "png 70 x 60",
					driver.findElement(By.xpath("//*[@id=\"card1\"]/ion-card-content[1]/ion-list/ion-item[3]/h5")).getText());
		});

{'fraction_non_alphanumeric': 0.17456508698260348, 'fraction_numerical': 0.012997400519896021, 'mean_word_length': 4.45474372955289, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1567932', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1613, 'n_words': 310}