From 8793f6781d312c3929e78042e12ac396a80e67ea Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Tue, 7 Mar 2017 15:24:46 +0100
Subject: [PATCH] OO-2532: update selenium tests, set version 1.0.1 for
 qtiworks

---
 pom.xml                                           |  6 +++---
 .../postgresql/alter_11_2_x_to_11_3_0.sql         |  3 ++-
 src/test/java/org/olat/selenium/CourseTest.java   |  2 +-
 .../java/org/olat/selenium/page/LoginPage.java    |  4 ++--
 .../selenium/page/course/AssessmentToolPage.java  | 15 +++------------
 .../selenium/page/course/CoursePageFragment.java  |  2 +-
 .../selenium/page/group/MembersWizardPage.java    |  1 +
 .../olat/selenium/page/qti/QTI21OptionsPage.java  |  6 +++---
 8 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/pom.xml b/pom.xml
index 28383d9fdb0..187f8a37c3f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,7 @@
 		<version.selenium>2.53.1</version.selenium>
 		<version.drone>2.0.1.Final</version.drone>
 		<activemq.version>5.11.1</activemq.version>
-		<qtiworks.version>1.0-SNAPSHOT</qtiworks.version>
+		<qtiworks.version>1.0.1</qtiworks.version>
 
 	    <!-- properties for testing and Q&A -->
 	    <!-- by default no tests are executed so far (April 2011). Use appropriate profiles and properties on the command line -->
@@ -1153,7 +1153,7 @@
 		<repository>
 			<id>openolat-repo</id>
 			<name>OpenOLAT Public Maven Repository Group</name>
-			<url>http://nexus.openolat.org/nexus/content/groups/public</url>
+			<url>https://nexus.openolat.org/nexus/content/groups/public</url>
 			<layout>default</layout>
 			<releases>
 				<enabled>true</enabled>
@@ -1181,7 +1181,7 @@
 		<pluginRepository>
 			<id>openolat-plugin-repo</id>
 			<name>OpenOLAT Public Maven Repository Group</name>
-			<url>http://nexus.openolat.org/nexus/content/groups/public</url>
+			<url>https://nexus.openolat.org/nexus/content/groups/public</url>
 			<layout>default</layout>
 			<releases>
 				<enabled>true</enabled>
diff --git a/src/main/resources/database/postgresql/alter_11_2_x_to_11_3_0.sql b/src/main/resources/database/postgresql/alter_11_2_x_to_11_3_0.sql
index bd147a8cc6c..44f91a087ee 100644
--- a/src/main/resources/database/postgresql/alter_11_2_x_to_11_3_0.sql
+++ b/src/main/resources/database/postgresql/alter_11_2_x_to_11_3_0.sql
@@ -23,7 +23,8 @@ create table o_sms_message_log (
    id bigserial not null,
    creationdate timestamp not null,
    lastmodified timestamp not null,
-   s_message_uuid varchar(256) not null,   s_server_response varchar(256),
+   s_message_uuid varchar(256) not null,
+   s_server_response varchar(256),
    s_service_id varchar(32) not null,
    fk_identity int8 not null,
    primary key (id)
diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java
index 97a6b87e63e..8abe4576bec 100644
--- a/src/test/java/org/olat/selenium/CourseTest.java
+++ b/src/test/java/org/olat/selenium/CourseTest.java
@@ -861,7 +861,7 @@ public class CourseTest {
 		Assert.assertEquals(blogTitle, podcastH2.getText().trim());
 		
 		FeedPage feed = FeedPage.getFeedPage(browser);
-		feed.newExternalBlog("http://www.openolat.com/feed/");
+		feed.newExternalBlog("https://www.openolat.com/feed/");
 
 		//check only that the subscription link is visible
 		By subscriptionBy = By.cssSelector("div.o_subscription>a");
diff --git a/src/test/java/org/olat/selenium/page/LoginPage.java b/src/test/java/org/olat/selenium/page/LoginPage.java
index 8a89f456493..77ab6483cf2 100644
--- a/src/test/java/org/olat/selenium/page/LoginPage.java
+++ b/src/test/java/org/olat/selenium/page/LoginPage.java
@@ -44,7 +44,7 @@ import org.openqa.selenium.WebElement;
 @Location("dmz")
 public class LoginPage {
 	
-	private static final String footerUserDivXPath = "//div[@id='o_footer_user']";
+	private static final String footerUserDivXPath = "//div[@id='o_footer_user']/span[@id='o_username']";
 	private static final String acknowledgeCheckboxXPath = "//input[@name='acknowledge_checkbox']";
 	
 	public static final By loginFormBy = By.cssSelector("div.o_login_form");
@@ -75,7 +75,7 @@ public class LoginPage {
 	}
 
 	public LoginPage assertOnLoginPage() {
-		Assert.assertTrue(browser.findElement(loginFormBy).isDisplayed());
+		OOGraphene.waitElement(loginFormBy, 5, browser);
 		return this;
 	}
 	
diff --git a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java
index c90e2ee9d3f..2ab27745c05 100644
--- a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java
+++ b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java
@@ -146,18 +146,9 @@ public class AssessmentToolPage {
 		browser.findElement(userLinksBy).click();
 		OOGraphene.waitBusy(browser);
 		OOGraphene.waitAndCloseBlueMessageWindow(browser);
-		
-		boolean newCertificate = false;
-		for(int i=0; i<50; i++) {
-			By certificateBy = By.cssSelector("ul.o_certificates a>i.o_icon.o_filetype_pdf");
-			List<WebElement> completedEls = browser.findElements(certificateBy);
-			if(completedEls.size() > 0) {
-				newCertificate = true;
-				break;
-			}
-			OOGraphene.waitingALittleLonger();
-		}
-		Assert.assertTrue(newCertificate);
+
+		By certificateBy = By.cssSelector("ul.o_certificates a>i.o_icon.o_filetype_pdf");
+		OOGraphene.waitElement(certificateBy, 15, browser);
 		return this;
 	}
 	
diff --git a/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java b/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java
index 6527837682a..477bfd3df61 100644
--- a/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java
+++ b/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java
@@ -55,7 +55,7 @@ public class CoursePageFragment {
 	public static final By assessmentModeBy = By.className("o_sel_course_assessment_mode");
 	public static final By membersCourseBy = By.className("o_sel_course_members");
 	public static final By treeContainerBy = By.id("o_main_left_content");
-	public static final By efficiencyStatementsBy = By.className(" o_sel_course_options_certificates");
+	public static final By efficiencyStatementsBy = By.className("o_sel_course_options_certificates");
 	
 	private WebDriver browser;
 	
diff --git a/src/test/java/org/olat/selenium/page/group/MembersWizardPage.java b/src/test/java/org/olat/selenium/page/group/MembersWizardPage.java
index 52fe874735b..edec56b294a 100644
--- a/src/test/java/org/olat/selenium/page/group/MembersWizardPage.java
+++ b/src/test/java/org/olat/selenium/page/group/MembersWizardPage.java
@@ -88,6 +88,7 @@ public class MembersWizardPage {
 		
 		//check
 		By checkAllBy = By.cssSelector("div.modal div.o_table_wrapper input[type='checkbox']");
+		OOGraphene.waitElement(checkAllBy, 5, browser);
 		List<WebElement> checkAll = browser.findElements(checkAllBy);
 		Assert.assertFalse(checkAll.isEmpty());
 		for(WebElement check:checkAll) {
diff --git a/src/test/java/org/olat/selenium/page/qti/QTI21OptionsPage.java b/src/test/java/org/olat/selenium/page/qti/QTI21OptionsPage.java
index 30f0d36b30a..1f2083d1745 100644
--- a/src/test/java/org/olat/selenium/page/qti/QTI21OptionsPage.java
+++ b/src/test/java/org/olat/selenium/page/qti/QTI21OptionsPage.java
@@ -53,7 +53,7 @@ public class QTI21OptionsPage {
 			browser.findElement(levelBy).click();
 		}
 		if(options.isSectionSummary()) {
-			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='sections']");
+			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='sectionsSummary']");
 			browser.findElement(levelBy).click();
 		}
 		if(options.isQuestionSummary()) {
@@ -65,11 +65,11 @@ public class QTI21OptionsPage {
 			browser.findElement(levelBy).click();
 		}
 		if(options.isUserSolutions()) {
-			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='responses']");
+			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='userSolutions']");
 			browser.findElement(levelBy).click();
 		}
 		if(options.isCorrectSolutions()) {
-			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='solutions']");
+			By levelBy = By.cssSelector("div.o_sel_qti_show_results_options input[type='checkbox'][value='correctSolutions']");
 			browser.findElement(levelBy).click();
 		}
 		return this;
-- 
GitLab