From c5924ded08861dfd7604e9f12f2aee154c4f28ea Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Wed, 16 Oct 2019 17:57:44 +0200
Subject: [PATCH] no-jira: changes to LTI selenium test

---
 .../org/olat/selenium/page/course/LTIPage.java    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/olat/selenium/page/course/LTIPage.java b/src/test/java/org/olat/selenium/page/course/LTIPage.java
index beb0e11b3d7..147dbc09dbc 100644
--- a/src/test/java/org/olat/selenium/page/course/LTIPage.java
+++ b/src/test/java/org/olat/selenium/page/course/LTIPage.java
@@ -44,6 +44,12 @@ public class LTIPage {
 		this.browser = browser;
 	}
 	
+	/**
+	 * A successful start will switch the browser to the iframe. If you need
+	 * to go back to the LMS, you need to switch back to the default content.
+	 * 
+	 * @return Itself
+	 */
 	public LTIPage start() {
 		try {
 			By startBy = By.xpath("//div[contains(@class,'o_button_group')]/a[contains(@onclick,'start')]");
@@ -55,12 +61,10 @@ public class LTIPage {
 			OOGraphene.waitingALittleLonger();
 			
 			WebElement iframe = browser.findElement(iframeBy);
-			WebDriver iframeBrowser = browser.switchTo().frame(iframe);
+			browser = browser.switchTo().frame(iframe);
 			
 			By launchedBy = By.xpath("//p[contains(text(),'Launch Validated.')]");
 			OOGraphene.waitElement(launchedBy, browser);
-			
-			iframeBrowser.switchTo().defaultContent();
 		} catch (Exception e) {
 			OOGraphene.takeScreenshot("LTIPage_start", browser);
 			throw e;
@@ -96,5 +100,10 @@ public class LTIPage {
 		Assert.assertTrue(success);
 		return this;
 	}
+	
+	public LTIPage backToOpenOLAT() {
+		browser = browser.switchTo().defaultContent();
+		return this;
+	}
 
 }
-- 
GitLab