Skip to content
Snippets Groups Projects
Commit 7be040c3 authored by anttil's avatar anttil
Browse files

SWE-2 / SP-263: Fix Hudson run

SVN: 26826
parent 85abe803
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,11 @@ public class WidgetContext ...@@ -43,6 +43,11 @@ public class WidgetContext
element.click(); element.click();
} }
public boolean isInteractable()
{
return element.isDisplayed() && element.isEnabled();
}
public String getAttribute(String key) public String getAttribute(String key)
{ {
return element.getAttribute(key); return element.getAttribute(key);
......
...@@ -57,7 +57,7 @@ public class SampleTypeTest extends SeleniumTest ...@@ -57,7 +57,7 @@ public class SampleTypeTest extends SeleniumTest
assertThat(sampleBrowser(), doesNotShowInToolBar(sampleType)); assertThat(sampleBrowser(), doesNotShowInToolBar(sampleType));
} }
@Test(enabled = false) @Test
public void changingSampleTypeToBeListableMakesItVisibleInSampleBrowserDropDownMenu() public void changingSampleTypeToBeListableMakesItVisibleInSampleBrowserDropDownMenu()
{ {
SampleType sampleType = create(aSampleType().thatIsNotListable()); SampleType sampleType = create(aSampleType().thatIsNotListable());
......
...@@ -18,12 +18,14 @@ package ch.systemsx.cisd.openbis.uitest.suite; ...@@ -18,12 +18,14 @@ package ch.systemsx.cisd.openbis.uitest.suite;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import java.awt.Toolkit;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxDriver;
...@@ -89,7 +91,7 @@ import ch.systemsx.cisd.openbis.uitest.type.VocabularyBuilder; ...@@ -89,7 +91,7 @@ import ch.systemsx.cisd.openbis.uitest.type.VocabularyBuilder;
public abstract class SeleniumTest public abstract class SeleniumTest
{ {
public static int IMPLICIT_WAIT = 20; public static int IMPLICIT_WAIT = 30;
public static String ADMIN_USER = "selenium"; public static String ADMIN_USER = "selenium";
...@@ -105,7 +107,7 @@ public abstract class SeleniumTest ...@@ -105,7 +107,7 @@ public abstract class SeleniumTest
protected GuiApplicationRunner openbis; protected GuiApplicationRunner openbis;
private ApplicationRunner openbisApi; private static ApplicationRunner openbisApi;
@BeforeSuite @BeforeSuite
public void initWebDriver() throws Exception public void initWebDriver() throws Exception
...@@ -144,6 +146,13 @@ public abstract class SeleniumTest ...@@ -144,6 +146,13 @@ public abstract class SeleniumTest
setImplicitWaitToDefault(); setImplicitWaitToDefault();
delete(new File("targets/dist")); delete(new File("targets/dist"));
driver.manage().deleteAllCookies(); driver.manage().deleteAllCookies();
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenResolution =
new Dimension((int) toolkit.getScreenSize().getWidth(), (int) toolkit
.getScreenSize().getHeight());
driver.manage().window().setSize(screenResolution);
driver.get(startPage); driver.get(startPage);
uid = new DictionaryUidGenerator(new File("resource/corncob_lowercase.txt")); uid = new DictionaryUidGenerator(new File("resource/corncob_lowercase.txt"));
......
...@@ -74,7 +74,14 @@ public class DropDown implements AtomicWidget, Fillable ...@@ -74,7 +74,14 @@ public class DropDown implements AtomicWidget, Fillable
private List<WebElement> getChoiceElements() private List<WebElement> getChoiceElements()
{ {
context.click(); context.click();
return SeleniumTest.driver.findElements(By.className("x-combo-list-item")); List<WebElement> wlist =
SeleniumTest.driver.findElements(By.className("x-combo-list-item"));
if (wlist.size() == 0)
{
System.out.println("dropdown retry");
return getChoiceElements();
}
return wlist;
} }
@Override @Override
......
...@@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.uitest.widget; ...@@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.uitest.widget;
import ch.systemsx.cisd.openbis.uitest.infra.webdriver.WidgetContext; import ch.systemsx.cisd.openbis.uitest.infra.webdriver.WidgetContext;
/** /**
* @author anttil * @author anttil
*/ */
...@@ -39,6 +38,20 @@ public class Text implements AtomicWidget, Fillable ...@@ -39,6 +38,20 @@ public class Text implements AtomicWidget, Fillable
public void append(String text) public void append(String text)
{ {
if (context.isInteractable() == false)
{
System.out.println("text retry");
try
{
Thread.sleep(500);
} catch (InterruptedException ex)
{
// TODO Auto-generated catch block
ex.printStackTrace();
}
append(text);
return;
}
context.sendKeys(text); context.sendKeys(text);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment