Added new selenium version and parallel testing working properly
This commit is contained in:
@@ -32,14 +32,14 @@ public class BaseTest {
|
||||
DesiredCapabilities capabilities;
|
||||
if (browser != null && browser.equalsIgnoreCase("chrome")) {
|
||||
capabilities = DesiredCapabilities.chrome();
|
||||
System.setProperty("webdriver.chrome.driver", "src" + File.separator + "main" + File.separator + "resources" + File.separator + "chromedriver-linux");
|
||||
System.setProperty("webdriver.chrome.driver", "src" + File.separator + "main" + File.separator + "resources" + File.separator + "chromedriver-macos");
|
||||
driver = new ChromeDriver(capabilities);
|
||||
} else {
|
||||
capabilities = DesiredCapabilities.firefox();
|
||||
System.setProperty("webdriver.gecko.driver",
|
||||
"src" + File.separator + "main"
|
||||
+ File.separator + "resources"
|
||||
+ File.separator + "geckodriver-linux");
|
||||
+ File.separator + "geckodriver-macos");
|
||||
driver = new FirefoxDriver(capabilities);
|
||||
}
|
||||
//driver = new RemoteWebDriver(new URL("http://0.0.0.0:4444/wd/hub"), capabilities);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class JWPlayer extends BaseTest {
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void waitForPlayer(WebDriver driver) throws InterruptedException {
|
||||
wait.pause(2000);
|
||||
wait.pauseMilliseconds(2000);
|
||||
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
|
||||
public Boolean apply(WebDriver d) {
|
||||
return (executor.executeScript("return jwplayer().getState()") != null);
|
||||
@@ -185,7 +185,7 @@ public class JWPlayer extends BaseTest {
|
||||
|
||||
public boolean assertStatePause() throws InterruptedException {
|
||||
waitForPlayer(driver);
|
||||
executor.executeScript("jwplayer().pause()");
|
||||
executor.executeScript("jwplayer().pauseMilliseconds()");
|
||||
System.out.println(executor.executeScript("return jwplayer().getState()"));
|
||||
return executor.executeScript("return jwplayer().getState()").equals("buffering") ||
|
||||
executor.executeScript("return jwplayer().getState()").equals("paused");
|
||||
|
||||
@@ -197,7 +197,7 @@ public class LocalNavigationActions extends Locators {
|
||||
LocalRemoteWebDriverWait wait) {
|
||||
int i = 0;
|
||||
while (!WebElementExists(driver, element) && i < 20) {
|
||||
wait.pause(1000);
|
||||
wait.pauseMilliseconds(1000);
|
||||
i++;
|
||||
}
|
||||
return WebElementExists(driver, element);
|
||||
|
||||
@@ -7,9 +7,7 @@ import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Wraps LocalRemoteWebDriverWait to be used in a more convenient way and adds functionality.
|
||||
@@ -121,10 +119,6 @@ public class LocalRemoteWebDriverWait extends WebDriverWait {
|
||||
until(ExpectedConditions.stalenessOf(element));
|
||||
}
|
||||
|
||||
public void forTextPresent(By locator, String text) {
|
||||
until(ExpectedConditions.textToBePresentInElement(locator, text));
|
||||
}
|
||||
|
||||
public void forTextPresentInElementValue(By locator, String text) {
|
||||
until(ExpectedConditions.textToBePresentInElementValue(locator, text));
|
||||
}
|
||||
@@ -142,7 +136,7 @@ public class LocalRemoteWebDriverWait extends WebDriverWait {
|
||||
if (e.getAttribute(textValue) != null) {
|
||||
return Boolean.valueOf(e.getAttribute(textValue));
|
||||
}
|
||||
pause(milliseconds);
|
||||
pauseMilliseconds(milliseconds);
|
||||
}
|
||||
return Boolean.valueOf(null);
|
||||
}
|
||||
@@ -185,9 +179,9 @@ public class LocalRemoteWebDriverWait extends WebDriverWait {
|
||||
return pageLoaded;
|
||||
}
|
||||
|
||||
public void pause(long milliseconds) {
|
||||
public void pauseMilliseconds(long milliseconds) {
|
||||
try {
|
||||
Sleeper.SYSTEM_SLEEPER.sleep(new Duration(milliseconds, MILLISECONDS));
|
||||
TimeUnit.MILLISECONDS.sleep(milliseconds);
|
||||
} catch (InterruptedException ie) {
|
||||
System.out.println("Waiting finished during " + milliseconds + " milliseconds ");
|
||||
}
|
||||
@@ -195,7 +189,7 @@ public class LocalRemoteWebDriverWait extends WebDriverWait {
|
||||
|
||||
public void pauseSeconds(long seconds) {
|
||||
try {
|
||||
Sleeper.SYSTEM_SLEEPER.sleep(new Duration(seconds, SECONDS));
|
||||
TimeUnit.SECONDS.sleep(seconds);
|
||||
} catch (InterruptedException ie) {
|
||||
System.out.println("Waiting finished during " + seconds + " seconds ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user