diff --git a/ui-test/build/build.xml b/ui-test/build/build.xml index a257d9802578ca868b5e82a961f5217740032ce0..a389618f942e5061e6a6744783a449eb2138073f 100644 --- a/ui-test/build/build.xml +++ b/ui-test/build/build.xml @@ -19,19 +19,10 @@ <target name="run-tests-ui" depends="compile-tests"> <delete dir="${output.test}" /> - <antcall target="_run-testng-ui"> <param name="test.suite" value="${test.suite}" /> <param name="failure.property" value="tests.failed" /> </antcall> - - <junitreport todir="${output.test}"> - <fileset dir="${output.test}"> - <include name="*/*.xml" /> - </fileset> - <report format="noframes" todir="${output.test}" /> - </junitreport> - <fail if="tests.failed" message="At least one test failed." /> </target> <target name="_run-testng-ui"> @@ -44,11 +35,13 @@ workingDir="." outputdir="${output.test}" failureproperty="${failure.property}"> - <xmlfileset dir="${sources.test}" includes="${test.suite}" /> + <xmlfileset dir="source/java" includes="${test.suite}" /> <jvmarg value="-Xmx1024M" /> <jvmarg value="-XX:MaxPermSize=512m" /> <jvmarg value="-Dui-test.url=${internal-url}" /> </testng> + + <fail if="${failure.property}" /> </target> diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/application/ApplicationRunner.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/application/ApplicationRunner.java index 2903e75c61ed1296cd7fae70d90c1c6f10d12324..945154d8ba7f78760f1e93f6ad04aa4bf245b58a 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/application/ApplicationRunner.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/application/ApplicationRunner.java @@ -151,6 +151,7 @@ public class ApplicationRunner { browser.delete(); } + browser.resetFilters(); } public void delete(Vocabulary vocabulary) diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/webdriver/WaitForRefreshOf.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/webdriver/WaitForRefreshOf.java index e6638d88e49a146f39cd8ec2d6bbb5662134a445..2f3432e9c0813a30b5afa590da338968df2b30f7 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/webdriver/WaitForRefreshOf.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/webdriver/WaitForRefreshOf.java @@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.uitest.infra.webdriver; import java.util.concurrent.TimeUnit; +import org.openqa.selenium.TimeoutException; import org.openqa.selenium.support.ui.FluentWait; import com.google.common.base.Predicate; @@ -30,14 +31,12 @@ import ch.systemsx.cisd.openbis.uitest.widget.Refreshable; public class WaitForRefreshOf<T> extends FluentWait<Refreshable> { - private final String state; - private Action<T> action; public WaitForRefreshOf(Refreshable widget) { super(widget); - this.state = widget.getState(); + widget.prepareWait(); } @SuppressWarnings("hiding") @@ -52,16 +51,24 @@ public class WaitForRefreshOf<T> extends FluentWait<Refreshable> T result = action.execute(); if (action.shouldWait(result)) { - withTimeout(seconds, TimeUnit.SECONDS) - .pollingEvery(100, TimeUnit.MILLISECONDS) - .until(new Predicate<Refreshable>() - { - @Override - public boolean apply(Refreshable widget) + try + { + withTimeout(seconds, TimeUnit.SECONDS) + .pollingEvery(100, TimeUnit.MILLISECONDS) + .until(new Predicate<Refreshable>() { - return !state.equals(widget.getState()); - } - }); + @Override + public boolean apply(Refreshable widget) + { + return widget.hasRefreshed(); + } + }); + + } catch (TimeoutException e) + { + System.out.println("TIMEOUT"); + throw e; + } } return result; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentBrowser.java index d6dbe5fc1288ef9af83f5fda7fc456ef70730e9e..b2741cd50023e1dda43b660c9e9aa2694e348d61 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentBrowser.java @@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.uitest.type.Project; import ch.systemsx.cisd.openbis.uitest.widget.Button; import ch.systemsx.cisd.openbis.uitest.widget.DeletionConfirmationBox; import ch.systemsx.cisd.openbis.uitest.widget.Grid; +import ch.systemsx.cisd.openbis.uitest.widget.PagingToolBar; import ch.systemsx.cisd.openbis.uitest.widget.TreeGrid; public class ExperimentBrowser implements Browser<Experiment> @@ -32,6 +33,7 @@ public class ExperimentBrowser implements Browser<Experiment> @Locate("openbis_select-project") private TreeGrid projectTree; + @SuppressWarnings("unused") @Locate("openbis_experiment-browser-grid-grid") private Grid grid; @@ -42,9 +44,13 @@ public class ExperimentBrowser implements Browser<Experiment> @Locate("deletion-confirmation-dialog") private DeletionConfirmationBox deletionDialog; + @Lazy + @Locate("openbis_experiment-browser-grid-grid-paging-toolbar") + private PagingToolBar paging; + public boolean selectProject(final Project project) { - return new WaitForRefreshOf<Boolean>(grid).after(new Action<Boolean>() + return new WaitForRefreshOf<Boolean>(paging).after(new Action<Boolean>() { @Override public Boolean execute() @@ -57,7 +63,7 @@ public class ExperimentBrowser implements Browser<Experiment> { return result; } - }).withTimeoutOf(10); + }).withTimeoutOf(20); } public void deleteAll() diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentTypeBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentTypeBrowser.java index c54e8b9d110788b6a45500bed8f321ecc91483d1..42567b18bba6feec91ffe57b31a2cbc671aa2a13 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentTypeBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ExperimentTypeBrowser.java @@ -79,7 +79,7 @@ public class ExperimentTypeBrowser implements Browser<ExperimentType> public void filter(final ExperimentType type) { paging.filters(); - filters.setCode(type.getCode(), grid); + filters.setCode(type.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ProjectBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ProjectBrowser.java index 122a30b4c47626ddc30eba2a9d96c7112d25508e..8934149b4bd2f94e59d77473b7bf112679b2293d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ProjectBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/ProjectBrowser.java @@ -67,7 +67,7 @@ public class ProjectBrowser implements Browser<Project> public void filter(Project project) { paging.filters(); - filters.setCode(project.getCode(), grid); + filters.setCode(project.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeAssignmentBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeAssignmentBrowser.java index 339d772bae837a9e8936b25d3fa53cc4b0314d70..f772e3f64b806aac64926059203858dd0253fcd1 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeAssignmentBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeAssignmentBrowser.java @@ -60,7 +60,7 @@ public class PropertyTypeAssignmentBrowser implements Browser<PropertyTypeAssign public void filter(PropertyTypeAssignment assignment) { paging.filters(); - filters.setCode(assignment.getPropertyType().getCode(), grid); + filters.setCode(assignment.getPropertyType().getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeBrowser.java index f8fae0c8edbf78420a784358b282d9c7c5a9c1f9..0a21dec36a8daa97226f964273d77bb2da64104c 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/PropertyTypeBrowser.java @@ -71,7 +71,7 @@ public class PropertyTypeBrowser implements Browser<PropertyType> public void filter(PropertyType propertyType) { paging.filters(); - filters.setCode(propertyType.getCode(), grid); + filters.setCode(propertyType.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java index a3fbf5c4b166865f9b68e599e1d074fadf069b4c..7887d6f4fc4d25cced3076a08e65358295395ef2 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java @@ -86,7 +86,7 @@ public class SampleBrowser implements Browser<Sample> public void filter(Sample sample) { paging.filters(); - filters.setCode(sample.getCode(), grid); + filters.setCode(sample.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleTypeBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleTypeBrowser.java index 0fe7fe4542f3e784c22ddc97021cd5cbd109c9b4..1ec48ce5584d8eb26f54be5a87b3548dea99571b 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleTypeBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleTypeBrowser.java @@ -82,7 +82,7 @@ public class SampleTypeBrowser implements Browser<SampleType> public void filter(SampleType type) { paging.filters(); - filters.setCode(type.getCode(), grid); + filters.setCode(type.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SpaceBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SpaceBrowser.java index 7f8ee12c3411220a9879a81c3be560f6d4f65e77..58528761d929c1c2d71c5a15598baf9b365a21a8 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SpaceBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SpaceBrowser.java @@ -75,7 +75,7 @@ public class SpaceBrowser implements Browser<Space> public void filter(final Space space) { paging.filters(); - filters.setCode(space.getCode(), grid); + filters.setCode(space.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/VocabularyBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/VocabularyBrowser.java index 70af98719f007bfb92e7ee8e985b8df7896a332d..8526a710a39b1e228c81d8057c0b71de69e86a1a 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/VocabularyBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/VocabularyBrowser.java @@ -74,7 +74,7 @@ public class VocabularyBrowser implements Browser<Vocabulary> public void filter(Vocabulary vocabulary) { paging.filters(); - filters.setCode(vocabulary.getCode(), grid); + filters.setCode(vocabulary.getCode(), paging); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/SeleniumTest.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/SeleniumTest.java index 8b86834305e021a844443f3ca10a70d0ca609563..9216d550696a5bce513aac00f35c03f4443015e5 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/SeleniumTest.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/SeleniumTest.java @@ -103,7 +103,7 @@ public abstract class SeleniumTest { uid = new DictionaryUidGenerator(new File("resource/corncob_lowercase.txt")); - // System.setProperty("webdriver.firefox.profile", "default"); + System.setProperty("webdriver.firefox.profile", "default"); driver = new FirefoxDriver(); setImplicitWaitToDefault(); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/FilterToolBar.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/FilterToolBar.java index 15393c039dacfdd86fb577659f6036afd2f5afc0..5b1a63576a2de3f83f8c611ab9d48ade468f8d35 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/FilterToolBar.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/FilterToolBar.java @@ -28,11 +28,11 @@ public class FilterToolBar implements Widget private WidgetContext context; - public void setCode(final String text, Grid refreshingGrid) + public void setCode(final String text, Refreshable refresher) { final Text t = context.find(".//input[contains(@id, 'Code-input')]", Text.class); - new WaitForRefreshOf<Void>(refreshingGrid) + new WaitForRefreshOf<Void>(refresher) .after(new DeterminateAction<Void>() { @Override @@ -41,7 +41,7 @@ public class FilterToolBar implements Widget t.write(text); return null; } - }).withTimeoutOf(10); + }).withTimeoutOf(20); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Grid.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Grid.java index ee49297ad28c6c21d19491cecdcb4302892f0be4..bb94d5e18ec8b1966d567c1097818a415ea61f2e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Grid.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Grid.java @@ -32,7 +32,7 @@ import ch.systemsx.cisd.openbis.uitest.suite.SeleniumTest; /** * @author anttil */ -public class Grid implements Widget, Refreshable +public class Grid implements Widget { private WidgetContext context; @@ -133,12 +133,6 @@ public class Grid implements Widget, Refreshable return s; } - @Override - public synchronized String getState() - { - return "" + this.getCells().size() + "/" + this.getColumns().size(); - } - @Override public void setContext(WidgetContext context) { diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java index e21179536768acce49ce18622e66f24171c45a0d..b7534c8e0515b03d4a29059e0f6337bc0018904d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java @@ -21,7 +21,7 @@ import ch.systemsx.cisd.openbis.uitest.infra.webdriver.WidgetContext; /** * @author anttil */ -public class PagingToolBar implements Widget +public class PagingToolBar implements Widget, Refreshable { private WidgetContext context; @@ -40,4 +40,21 @@ public class PagingToolBar implements Widget { this.context = context; } + + String displayText; + + @Override + public void prepareWait() + { + displayText = context.find(".//div[contains(@class, 'my-paging-display')]").getText(); + } + + @Override + public boolean hasRefreshed() + { + String currentText = + context.find(".//div[contains(@class, 'my-paging-display')]").getText(); + System.out.println("comparing " + displayText + " with " + currentText); + return (this.displayText.equals(currentText) == false); + } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Refreshable.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Refreshable.java index e8c2ff0be46fc1f13593a850436598a74543c44d..1c8d2b7b38485921de1a8550814a9f7ec7ac6056 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Refreshable.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/Refreshable.java @@ -21,5 +21,7 @@ package ch.systemsx.cisd.openbis.uitest.widget; */ public interface Refreshable { - public String getState(); + public void prepareWait(); + + public boolean hasRefreshed(); }