diff --git a/README.md b/README.md index 3151a226056cc9afb32c8926b8f88e2147662b99..c5c73972aadfe9b123d56e192b82e724fb0f057d 100644 --- a/README.md +++ b/README.md @@ -365,6 +365,11 @@ mvn clean verify -DskipTests=true -Dwith-mysql -Ptomcat mvn clean verify -DskipTests=true -Dwith-postgresql -Dtest.env.db.postgresql.pass=serial -Ptomcat ``` +Or with Firefox + +```bash +mvn clean verify -DskipTests=true -Dwith-postgresql -Dtest.env.webdriver.browser=firefox -Dtest.env.db.postgresql.pass=serial -Ptomcat +``` #### Execute a single selenium functional integration test in Eclipse diff --git a/src/test/java/org/olat/selenium/page/NavigationPage.java b/src/test/java/org/olat/selenium/page/NavigationPage.java index 4cff35d160118b495d4b979b6238d01f566c6fec..5f679f782c7a6f89a9a2ef43b6f9492873f3e1a3 100644 --- a/src/test/java/org/olat/selenium/page/NavigationPage.java +++ b/src/test/java/org/olat/selenium/page/NavigationPage.java @@ -79,7 +79,6 @@ public class NavigationPage { public AuthoringEnvPage openAuthoringEnvironment() { navigate(authoringEnvTabBy); - backToTheTop(); OOGraphene.closeBlueMessageWindow(browser); return new AuthoringEnvPage(browser); } @@ -160,23 +159,7 @@ public class NavigationPage { browser.findElement(openMoreBy).click(); //wait the small transition By openedMoreMenuby = By.cssSelector("#o_navbar_more ul.dropdown-menu.dropdown-menu-right"); - OOGraphene.waitElement(openedMoreMenuby, 5, browser); - } - - public NavigationPage backToTheTop() { - List<WebElement> backList = browser.findElements(toolbarBackBy); - - int count = 0; - while(backList.size() > 0) { - backList.get(count).click(); - OOGraphene.waitBusy(browser); - backList = browser.findElements(toolbarBackBy); - - Assert.assertTrue(count++ < 3); - } - - OOGraphene.closeBlueMessageWindow(browser); - return this; + OOGraphene.waitElement(openedMoreMenuby, browser); } public NavigationPage closeTab() { diff --git a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java index 598a163d97aa6b71fac242e4da34fbf0a43d2e50..6996b4bdb660e47d220c998a7641293586cd2681 100644 --- a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java +++ b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java @@ -63,6 +63,7 @@ public class OOGraphene { private static final Duration polling = Duration.ofMillis(100); private static final Duration poolingSlow = Duration.ofMillis(200); + private static final Duration poolingSlower = Duration.ofMillis(400); private static final Duration timeout = Duration.ofSeconds(5); private static final By closeBlueBoxButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message a.o_alert_close.o_sel_info_close"); @@ -170,6 +171,21 @@ public class OOGraphene { .until(ExpectedConditions.visibilityOfElementLocated(element)); } + /** + * Wait until the element is visible. But slowly poll if the + * element exists (every 333ms instead of 100ms) + * + * @param element The selector for the element + * @param timeoutInSeconds The timeout in seconds + * @param browser The web driver + */ + public static void waitElementSlowly(By element, int timeoutInSeconds, WebDriver browser) { + new WebDriverWait(browser, driverTimeout) + .withTimeout(Duration.ofSeconds(timeoutInSeconds)) + .pollingEvery(poolingSlower) + .until(ExpectedConditions.visibilityOfElementLocated(element)); + } + /** * Wait until the element is visible. * @@ -600,9 +616,14 @@ public class OOGraphene { } } + /** + * Click the "<" of the bread crumbs and wait. + * + * @param browser The browser + */ public static final void clickBreadcrumbBack(WebDriver browser) { By backBy = By.xpath("//ol[@class='breadcrumb']/li[@class='o_breadcrumb_back']/a[i[contains(@class,'o_icon_back')]]"); - waitElement(backBy, browser); + waitElement(backBy, 10, browser); try { browser.findElement(backBy).click(); } catch (StaleElementReferenceException e) { diff --git a/src/test/java/org/olat/selenium/page/lecture/RollCallInterceptorPage.java b/src/test/java/org/olat/selenium/page/lecture/RollCallInterceptorPage.java index 00c4bc7ba6c7fa36ffe1ab549a0db1ba700e48ca..5834741d2849a99a916ce22cf87a898958d4045f 100644 --- a/src/test/java/org/olat/selenium/page/lecture/RollCallInterceptorPage.java +++ b/src/test/java/org/olat/selenium/page/lecture/RollCallInterceptorPage.java @@ -53,6 +53,7 @@ public class RollCallInterceptorPage { By startWizardBy = By.cssSelector("div.o_sel_lecture_start_wizard a.o_sel_lecture_start_wizard"); browser.findElement(startWizardBy).click(); OOGraphene.waitBusy(browser); + OOGraphene.waitElement(By.className("o_rollcall_wizard"), browser); return new TeacherRollCallWizardPage(browser); } diff --git a/src/test/java/org/olat/selenium/page/lecture/TeacherRollCallWizardPage.java b/src/test/java/org/olat/selenium/page/lecture/TeacherRollCallWizardPage.java index 7d383a3f6a9a422c862aff0d7858ee837ef067e3..1d0dede952302c8e9ec250abbf080063785da29e 100644 --- a/src/test/java/org/olat/selenium/page/lecture/TeacherRollCallWizardPage.java +++ b/src/test/java/org/olat/selenium/page/lecture/TeacherRollCallWizardPage.java @@ -46,6 +46,7 @@ public class TeacherRollCallWizardPage { public TeacherRollCallWizardPage setAbsence(String lecture) { By checkBy = By.xpath("//div[contains(@class,'o_rollcall_wizard')]//table//tr[1]/td[count(//div[contains(@class,'o_rollcall_wizard')]//table//tr/th[a[text()='" + lecture + "']]/preceding-sibling::th)+1]/div/label/input"); + OOGraphene.waitElement(checkBy, browser); WebElement checkEl = browser.findElement(checkBy); OOGraphene.check(checkEl, Boolean.TRUE); OOGraphene.waitBusy(browser); diff --git a/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java b/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java index 93a64003caea8d2506e864ad54c0f9db6cd32795..fd910c205e6558d8bce57b37b28e42c23fbb659b 100644 --- a/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java +++ b/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java @@ -174,7 +174,7 @@ public class BinderPage { browser.findElement(tocBy).click(); OOGraphene.waitBusy(browser); By binderPageListBy = By.cssSelector("div.o_portfolio_entries"); - OOGraphene.waitElement(binderPageListBy, browser); + OOGraphene.waitElementSlowly(binderPageListBy, 10, browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java b/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java index e209c14a38ef66478b999306b5b0719730132401..04c76caeba99f6d7428edb39732e0ec4f1e8874f 100644 --- a/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java +++ b/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java @@ -228,10 +228,7 @@ public class AuthoringEnvPage { * @return */ public CoursePageFragment clickToolbarRootCrumb() { - By toolbarBackBy = By.xpath("//div[contains(@class,'o_breadcrumb')]/ol[contains(@class,'breadcrumb')]/li/a[contains(@onclick,'crumb_0')]"); - OOGraphene.waitingALittleBit();// firefox will click the button without effect - browser.findElement(toolbarBackBy).click(); - OOGraphene.waitBusy(browser); + OOGraphene.clickBreadcrumbBack(browser); return new CoursePageFragment(browser); }