From 3516aa283c0d39750962bd9c42b2e1f1b9934ead Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Wed, 25 Apr 2018 19:58:14 +0200
Subject: [PATCH] no-jira: hardened selenium test which delete a binder

---
 .../impl/elements/table/FlexiTableElementImpl.java        | 2 ++
 src/test/java/org/olat/selenium/PortfolioV2Test.java      | 2 +-
 .../java/org/olat/selenium/page/portfolio/BinderPage.java | 2 ++
 .../org/olat/selenium/page/portfolio/BindersPage.java     | 8 ++++----
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
index 3f3b0468039..f0026a4a847 100644
--- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
+++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
@@ -229,12 +229,14 @@ public class FlexiTableElementImpl extends FormItemImpl implements FlexiTableEle
 			customTypeButton = new FormLinkImpl(dispatchId + "_customRTypeButton", "rCustomRTypeButton", "", Link.BUTTON + Link.NONTRANSLATED);
 			customTypeButton.setTranslator(translator);
 			customTypeButton.setIconLeftCSS("o_icon o_icon_table_custom o_icon-lg");
+			customTypeButton.setElementCssClass("o_sel_custom");
 			customTypeButton.setActive(FlexiTableRendererType.custom == rendererType);
 			components.put("rTypeCustom", customTypeButton);
 			//classic tables
 			classicTypeButton = new FormLinkImpl(dispatchId + "_classicRTypeButton", "rClassicRTypeButton", "", Link.BUTTON + Link.NONTRANSLATED);
 			classicTypeButton.setTranslator(translator);
 			classicTypeButton.setIconLeftCSS("o_icon o_icon_table o_icon-lg");
+			classicTypeButton.setElementCssClass("o_sel_table");
 			classicTypeButton.setActive(FlexiTableRendererType.classic == rendererType);
 			components.put("rTypeClassic", classicTypeButton);
 			
diff --git a/src/test/java/org/olat/selenium/PortfolioV2Test.java b/src/test/java/org/olat/selenium/PortfolioV2Test.java
index 157035cd967..13e9e17a4bc 100644
--- a/src/test/java/org/olat/selenium/PortfolioV2Test.java
+++ b/src/test/java/org/olat/selenium/PortfolioV2Test.java
@@ -989,7 +989,7 @@ public class PortfolioV2Test extends Deployments {
 		portfolio
 			.clickToolbarBack()
 			.openDeletedBinders()
-			.switchTableView()
+			.switchDeletedBindersTableView()
 			.restoreBinder(binderTitle);
 		
 		// move it to the trash again
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 d097767a5dd..14782b5cb62 100644
--- a/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java
+++ b/src/test/java/org/olat/selenium/page/portfolio/BinderPage.java
@@ -118,6 +118,7 @@ public class BinderPage {
 		OOGraphene.waitElement(deleteBy, 5, browser);
 		browser.findElement(deleteBy).click();
 		OOGraphene.waitBusy(browser);
+		OOGraphene.scrollTop(browser);
 		
 		//confirm check box
 		By confirmBoxBy = By.cssSelector("div.modal-body input[type='checkbox']");
@@ -126,6 +127,7 @@ public class BinderPage {
 		
 		By deleteButtonBy = By.cssSelector("div.modal-body div.o_button_group button.btn.btn-primary");
 		browser.findElement(deleteButtonBy).click();
+		OOGraphene.waitModalDialogDisappears(browser);
 		OOGraphene.waitAndCloseBlueMessageWindow(browser);
 		return new BindersPage(browser);
 	}
diff --git a/src/test/java/org/olat/selenium/page/portfolio/BindersPage.java b/src/test/java/org/olat/selenium/page/portfolio/BindersPage.java
index 826382b8b0b..78e1b17727d 100644
--- a/src/test/java/org/olat/selenium/page/portfolio/BindersPage.java
+++ b/src/test/java/org/olat/selenium/page/portfolio/BindersPage.java
@@ -70,13 +70,13 @@ public class BindersPage {
 		return new BinderPage(browser);
 	}
 	
-	public BindersPage switchTableView() {
-		By tableViewBy = By.xpath("//a[i[contains(@class,'o_icon o_icon_table o_icon-lg')]]");
+	public BindersPage switchDeletedBindersTableView() {
+		By tableViewBy = By.xpath("//div[contains(@class,'o_table_tools')]/div/a[contains(@class,'o_sel_table')]");
 		browser.findElement(tableViewBy).click();
 		OOGraphene.waitBusy(browser);
 		
-		By classicViewBy = By.cssSelector(".o_rendertype_classic");
-		OOGraphene.waitElement(classicViewBy, 5, browser);
+		By classicViewBy = By.cssSelector(".o_portfolio_deleted_listing.o_rendertype_classic");
+		OOGraphene.waitElement(classicViewBy, browser);
 		return this;
 	}
 	
-- 
GitLab