Safari polling Upload
This commit is contained in:
@@ -14,7 +14,7 @@ public class HoversTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void hoversTest() throws InterruptedException {
|
||||
driver.get("http://the-internet.herokuapp.com/hovers");
|
||||
driver.get("https://the-internet.herokuapp.com/hovers");
|
||||
Thread.sleep(3000);
|
||||
// Find and hover over desired element
|
||||
WebElement avatar = driver.findElement(By.className("figure"));
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.agile611.testng.webdriver;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.Duration;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
import org.openqa.selenium.support.ui.Wait;
|
||||
import static org.testng.AssertJUnit.assertTrue;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -14,6 +17,9 @@ public class UploadTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testApp() throws InterruptedException {
|
||||
// Controla el ritme per a Safari
|
||||
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver).withTimeout(Duration.ofSeconds(15)).pollingEvery(Duration.ofSeconds(1)).ignoring(NoSuchElementException.class);
|
||||
|
||||
driver.navigate().to("https://the-internet.herokuapp.com/upload");
|
||||
WebElement fileUpload = driver.findElement(By.id("file-upload"));
|
||||
File file = new File("src" + File.separator + "test"
|
||||
@@ -21,9 +27,14 @@ public class UploadTest extends BaseTest {
|
||||
fileUpload.sendKeys(file.getAbsolutePath());
|
||||
WebElement buttonUpload = driver.findElement(By.id("file-submit"));
|
||||
buttonUpload.click();
|
||||
|
||||
// Espera explícita para Safari
|
||||
if (System.getProperty("browser").equalsIgnoreCase("safari")) {
|
||||
Thread.sleep(2000); // Espera para Safari
|
||||
}
|
||||
|
||||
WebElement uploadedFiles = driver.findElement(By.id("uploaded-files"));
|
||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
|
||||
wait.until(ExpectedConditions.visibilityOf(uploadedFiles));
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("uploaded-files")));
|
||||
assertTrue(uploadedFiles.isDisplayed());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user