Permalink
Browse files

Merged testing

  • Loading branch information...
OLAT Team
OLAT Team committed Jan 26, 2018
2 parents 4ef9c09 + 7b25307 commit 3d28e6dc2ac5abafbc1c9bcfff5b7c6d2dfe71a6
Showing with 926 additions and 1,039 deletions.
  1. +47 −0 ...sion-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/AdministratorMacros.java
  2. +92 −11 ...zh-extension-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/StartMacros.java
  3. +16 −17 ...ion-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/SwitchInteractMacros.java
  4. +2 −1 ...tionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/core/AdministratorCoreMacros.java
  5. +6 −6 ...ctionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/core/CampusCourseCoreMacros.java
  6. +1 −4 ...on-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/core/CourseCoreMarcos.java
  7. +17 −3 lmsuzh-extension-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/utils/Util.java
  8. +27 −12 ...-extension-functionaltest/src/main/java/ch/uzh/extension/functionaltest/macros/utils/Xpathes.java
  9. +20 −0 ...unctionaltest/src/test/java/ch/uzh/extension/functionaltest/basic/BasicTestCreateCourseItems.java
  10. +21 −2 ...ion-functionaltest/src/test/java/ch/uzh/extension/functionaltest/basic/BasicTestExportCourse.java
  11. +19 −0 ...on-functionaltest/src/test/java/ch/uzh/extension/functionaltest/basic/BasicTestStorageFolder.java
  12. +2 −0 ...rc/test/java/ch/uzh/extension/functionaltest/properties/BasicTestCreateCourseItemsProperties.java
  13. +2 −0 ...est/src/test/java/ch/uzh/extension/functionaltest/properties/BasicTestExportCourseProperties.java
  14. +4 −0 ...st/src/test/java/ch/uzh/extension/functionaltest/properties/BasicTestStorageFolderProperties.java
  15. +4 −0 ...src/test/java/ch/uzh/extension/functionaltest/properties/RegressionTestFolderItemsProperties.java
  16. +4 −0 .../src/test/java/ch/uzh/extension/functionaltest/properties/RegressionTestInsertLinkProperties.java
  17. +4 −0 ...test/src/test/java/ch/uzh/extension/functionaltest/properties/SmokeTestOlatPacketsProperties.java
  18. +2 −0 ...t/src/test/java/ch/uzh/extension/functionaltest/properties/UserStoryTestSwitchCastProperties.java
  19. +32 −14 ...c/test/java/ch/uzh/extension/functionaltest/properties/UserStoryTestSwitchInteractProperties.java
  20. +20 −0 ...ionaltest/src/test/java/ch/uzh/extension/functionaltest/regression/RegressionTestFolderItems.java
  21. +20 −0 ...tionaltest/src/test/java/ch/uzh/extension/functionaltest/regression/RegressionTestInsertLink.java
  22. +19 −0 ...sion-functionaltest/src/test/java/ch/uzh/extension/functionaltest/smoke/SmokeTestOlatCleanUp.java
  23. +19 −0 ...sion-functionaltest/src/test/java/ch/uzh/extension/functionaltest/smoke/SmokeTestOlatPacket1.java
  24. +19 −0 ...sion-functionaltest/src/test/java/ch/uzh/extension/functionaltest/smoke/SmokeTestOlatPacket2.java
  25. +16 −0 lmsuzh-extension-functionaltest/src/test/java/ch/uzh/extension/functionaltest/testutil/TestUtil.java
  26. +20 −0 ...nctionaltest/src/test/java/ch/uzh/extension/functionaltest/userstory/UserStoryTestSwitchCast.java
  27. +277 −94 ...onaltest/src/test/java/ch/uzh/extension/functionaltest/userstory/UserStoryTestSwitchInteract.java
  28. +2 −0 lmsuzh-extension-functionaltest/src/test/resources/properties/OlatTestAutomation.properties
  29. BIN lmsuzh-extension-functionaltest/webdrivers/linux/chromedriver_old
  30. BIN lmsuzh-extension-functionaltest/webdrivers/linux/geckodriver_45v
  31. BIN lmsuzh-extension-functionaltest/webdrivers/linux/geckodriver_50v
  32. BIN lmsuzh-extension-functionaltest/webdrivers/linux/geckodriver_51v
  33. BIN lmsuzh-extension-functionaltest/webdrivers/linux/operadriver
  34. BIN lmsuzh-extension-functionaltest/webdrivers/linux/phantomjs
  35. +189 −874 lmsuzh-extension-loadtest/src/test/jmeter/switchcast/SwitchCastPerformance.jmx
  36. +3 −1 lmsuzh-extension-loadtest/src/test/resources/switchcast/SwitchCastPerformance.properties
@@ -323,4 +323,51 @@ public void deleteQuotaInStorageFolder(WebDriver driver, String course) throws E
closeCourseEditorWindow(driver);
closeCourseEditorWindow(driver);
}
/**
*Edit maintenance message
*/
public void editMaintenanceMessage(WebDriver driver, String message) throws Exception {
administratorCoreMacros.selectTabAdministration(driver);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_INFO_MESSAGE_TREEITEM_IN_SYSTEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_EDIT_MAINTENANCE_MESSAGE_IN_ADMINISTRATION);
Util.editIFrame(driver, message, TextColour.BLACK, TextFormat.NONE, true);
Util.selectXpath(driver, Xpathes.XPATH_BUTTON_DIRTY);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
}
/**
*Delete maintenance message
*/
public void deleteMaintenanceMessage(WebDriver driver) throws Exception {
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_INFO_MESSAGE_TREEITEM_IN_SYSTEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_DELETE_MAINTENANCE_MESSAGE_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
}
/**
*Edit info message
*/
public void editInfoMessage(WebDriver driver, String message) throws Exception {
administratorCoreMacros.selectTabAdministration(driver);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_INFO_MESSAGE_TREEITEM_IN_SYSTEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_BUTTON_DEFAULT);
Util.editIFrame(driver, message, TextColour.BLACK, TextFormat.NONE, true);
Util.selectXpath(driver, Xpathes.XPATH_BUTTON_DIRTY);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
}
/**
*delete info message
*/
public void deleteInfoMessage(WebDriver driver) throws Exception {
administratorCoreMacros.selectTabAdministration(driver);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_INFO_MESSAGE_TREEITEM_IN_SYSTEM_IN_ADMINISTRATION);
Util.selectXpath(driver, Xpathes.XPATH_BUTTON_DEFAULT_2);
Util.selectXpath(driver, Xpathes.XPATH_SYSTEM_TREEITEM_IN_ADMINISTRATION);
}
}
@@ -13,14 +13,12 @@
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static ch.uzh.extension.functionaltest.macros.StartMacros.TestWebDriver.CHROME;
@@ -33,13 +31,16 @@
public class StartMacros {
private final static Logger LOGGER = LoggerFactory.getLogger(StartMacros.class);
private final static String PROPERTIES_PATH = "properties/OlatTestAutomation.properties";
private String chromeProfil;
public WebDriver driver;
public enum TestWebDriver {
FIREFOX("webdriver.gecko.driver"),
FIREFOXFLASH("webdriver.gecko.driver"),
CHROME("webdriver.chrome.driver"),
CHROME_FLASH("webdriver.chrome.driver"),
IE("webdriver.ie.driver");
private String testWebDriver;
@@ -74,6 +75,7 @@ private String getantwort(){
*/
public void startOlat(TestWebDriver testwebdriver, String o_url, boolean... loadtest) throws Exception{
String fileName = "";
chromeProfil = getValue("CHROME_PROFIL", PROPERTIES_PATH);
if (SystemUtils.IS_OS_LINUX) {
fileName = "start-linux.properties";
@@ -125,14 +127,20 @@ public void startOlat(TestWebDriver testwebdriver, String o_url, boolean... load
} catch (Exception e){
LogTexts.logStartBrowser(LOGGER, true, testwebdriver.getTestWebDriver());
}
case FIREFOXFLASH:
case CHROME_FLASH:
try {
System.setProperty(TestWebDriver.FIREFOX.getTestWebDriver(), firefoxPath);
System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE,"true");
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"/dev/null");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 2);
driver = new FirefoxDriver(profile);
System.setProperty(CHROME.getTestWebDriver(), chromePath);
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<>();
prefs.put("profile.default_content_setting_values.plugins", 1);
prefs.put("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
prefs.put("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);
options.setExperimentalOption("prefs", prefs);
options.addArguments("user-data-dir={}", chromeProfil);
driver= new ChromeDriver(options);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get(o_url);
@@ -161,6 +169,59 @@ public void startOlat(TestWebDriver testwebdriver, String o_url, boolean... load
Thread.sleep(1000);
}
/**
*Open browser settings
*/
public void startChromeSettings(TestWebDriver testwebdriver) throws Exception {
String fileName = "";
chromeProfil = getValue("CHROME_PROFIL", PROPERTIES_PATH);
if (SystemUtils.IS_OS_LINUX) {
fileName = "start-linux.properties";
} else if (SystemUtils.IS_OS_MAC) {
fileName = "start-mac.properties";
} else if (SystemUtils.IS_OS_WINDOWS) {
fileName = "start-windows.properties";
}
String chromePath = getValue("chrome.webdriver.path", fileName);
try {
System.setProperty(CHROME.getTestWebDriver(), chromePath);
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<>();
prefs.put("profile.default_content_setting_values.plugins", 1);
prefs.put("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
prefs.put("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);
options.setExperimentalOption("prefs", prefs);
options.addArguments("user-data-dir={}", chromeProfil);
driver = new ChromeDriver(options);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("chrome://settings/");
LogTexts.logStartBrowser(LOGGER, false, testwebdriver.getTestWebDriver());
} catch (Exception e) {
LogTexts.logStartBrowser(LOGGER, true, testwebdriver.getTestWebDriver());
}
}
/**
*Enable flash
*/
public void enableFlash(WebDriver driver, String o_url) throws InterruptedException {
driver.switchTo().frame(1);
Util.setInputsField(driver, Xpathes.CHROME_SEARCH, "flash");
Util.selectXpath(driver, Xpathes.CHROME_CONTENT_SETTING);
Util.selectXpath(driver, Xpathes.CHROME_EXPECTION_LIST_BUTTON);
Util.setInputsField(driver, Xpathes.CHROME_LISTITEM_INPUT, o_url + ":443");
Util.selectXpath(driver, Xpathes.CHROME_LISTITEM_CONFIRM);
Util.selectXpath(driver, Xpathes.CHROME_CONTENT_CONFIRM);
}
/**
*Login
*/
@@ -229,6 +290,18 @@ public void login(WebDriver driver, LoginForms login, String username, String pa
}
}
/**
*VHO Login
*/
void vhoLogin(WebDriver driver, String username, String password) throws Exception {
Select selectIDP_VHO = new Select(driver.findElement(By.xpath(Xpathes.XPATH_IDPS)));
selectIDP_VHO.selectByValue("https://aai-logon.vho-switchaai.ch/idp/shibboleth");
Util.selectXpath(driver, Xpathes.XPATH_LOGIN_BUTTON_LOGIN);
Util.setInputsField(driver, Xpathes.XPATH_IDP_USERNAME, username);
Util.setInputsField(driver, Xpathes.XPATH_IDP_PASSWORD, password);
Util.selectXpath(driver, Xpathes.XPATH_IDP_BUTTON_LOGIN);
}
/**
*Term of use dialog
*/
@@ -411,4 +484,12 @@ public void stopOLAT(WebDriver driver) throws Exception{
LogTexts.logCloseBrowser(LOGGER, false);
}
/**
*Close Chrome settings
*/
public void closeChromeSettings(WebDriver driver) throws Exception{
driver.quit();
LogTexts.logCloseBrowser(LOGGER, false);
}
}
@@ -1,18 +1,15 @@
package ch.uzh.extension.functionaltest.macros;
import ch.uzh.extension.functionaltest.macros.core.AuthorCoreMacros;
import ch.uzh.extension.functionaltest.macros.enums.TextColour;
import ch.uzh.extension.functionaltest.macros.enums.TextFormat;
import ch.uzh.extension.functionaltest.macros.utils.LogTexts;
import ch.uzh.extension.functionaltest.macros.utils.Util;
import ch.uzh.extension.functionaltest.macros.utils.Xpathes;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.Select;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -24,8 +21,8 @@
public class SwitchInteractMacros extends GroupMacros {
private final static Logger LOGGER = LoggerFactory.getLogger(SwitchInteractMacros.class);
private final StartMacros VHO = new StartMacros();
private final CourseMacros courseMacros = new CourseMacros();
private final AuthorCoreMacros authorCoreMacros = new AuthorCoreMacros();
/**
*Check login button
@@ -89,6 +86,17 @@ public void vhoLoginToSwitch(WebDriver driver, String username, String password)
}
}
/**
*Open meeting via Adobe connect link
*/
public void adobeConnectLink(WebDriver driver, String user, String password, String sspath, String meeting ) throws Exception {
Util.selectXpath(driver, Xpathes.XPATH_SWITCH_AAI_LOGIN_BUTTON);
VHO.vhoLogin(driver, user, password);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
Date date = new Date();
Util.takeSShot(driver, sspath, dateFormat.format(date) + meeting);
}
/**
*Create new meeting
*/
@@ -175,19 +183,21 @@ public void editFutureMeeting(WebDriver driver, String meeting, String title, St
/**
*Open future meeting
*/
public void openFutureMeeting(WebDriver driver, String meeting, String... output_path) throws Exception {
public String openFutureMeeting(WebDriver driver, String meeting, String... output_path) throws Exception {
List<WebElement> meetings = Util.searchItems(driver, Xpathes.XPATH_ROWS_IN_GRID + "/td/a[2]", 2);
int index = Util.getIndexInGrid(meetings, meeting);
Util.selectXpath(driver, "//*[@class='table table-condensed table-striped table-hover']/tbody/tr[" + index + "]/td[4]/a");
Util.activateLastWindow(driver);
LOGGER.info("Current url: {}", driver.getCurrentUrl());
String mUrl = driver.getCurrentUrl();
if (output_path.length > 0) {
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
Date date = new Date();
takeSShot(driver, output_path[0], meeting + dateFormat.format(date));
Util.takeSShot(driver, output_path[0], dateFormat.format(date) + meeting);
}
Util.closeActiveWindow(driver);
Util.activateOLATWindow(driver);
return mUrl;
}
/**
@@ -294,15 +304,4 @@ public void deletePastMeeting(WebDriver driver, String meeting) throws Exception
}
}
/**
*Take screenshot
*/
private void takeSShot(WebDriver driver, String output_path, String filename) throws Exception {
Thread.sleep(10000);
File scrFile= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(output_path + filename));
Thread.sleep(1000);
LogTexts.logMeetingSShot(LOGGER, output_path + filename);
}
}
@@ -24,7 +24,8 @@ public void selectTabAdministration(WebDriver driver) throws Exception {
Util.selectXpath(driver, Xpathes.XPATH_ADMINISTRATION_TAB);
} else {
if (Util.isElementPresent(driver, Xpathes.XPATH_MORETAB_IN_PRIMARY_NAVTABS, 2)) {
Util.selectXpath(driver, Xpathes.XPATH_ADMINISTRATOR_TAB_IN_TOGGLE);
Util.selectXpath(driver, Xpathes.XPATH_MORETAB_IN_PRIMARY_NAVTABS);
Util.selectXpath(driver, Xpathes.XPATH_ADMINISTRATION_TAB);
}
}
}
@@ -72,19 +72,19 @@ public boolean createCampuscourse(WebDriver driver, String course, CampusCourses
} else {
Util.selectXpath(driver, Xpathes.XPATH_CREATE_BUTTON_ON_CAMPUS_COURSE_CREATE_BOX);
}
LogTexts.logCCStandardCreated(LOGGER, false, getItemTitel(driver, CourseCoreMarcos.XPATH_COURSETITEL));
LogTexts.logCCStandardCreated(LOGGER, false, getItemTitel(driver, Xpathes.XPATH_COURSETITEL));
if (ct_length == 1) {
compareTitle(driver, coursetitle[0], CourseCoreMarcos.XPATH_COURSETITEL);
compareTitle(driver, coursetitle[0], Xpathes.XPATH_COURSETITEL);
}
authorMacros.closeCourseEditorWindow(driver);
break;
case BASIS:
if (findCourseInCampuscourseMenu(driver, coursetitle[0]) != campusmenu) {
Util.selectWebElement(driver, findCourseInCampuscourseMenu(driver, coursetitle[0]));
LogTexts.logCCBasisCreated(LOGGER, false, getItemTitel(driver, CourseCoreMarcos.XPATH_COURSETITEL));
LogTexts.logCCBasisCreated(LOGGER, false, getItemTitel(driver, Xpathes.XPATH_COURSETITEL));
if (ct_length == 2) {
compareTitle(driver, coursetitle[1], CourseCoreMarcos.XPATH_COURSETITEL);
compareTitle(driver, coursetitle[1], Xpathes.XPATH_COURSETITEL);
}
authorMacros.closeCourseEditorWindow(driver);
} else {
@@ -96,9 +96,9 @@ public boolean createCampuscourse(WebDriver driver, String course, CampusCourses
if (findCourseInCampuscourseMenu(driver, coursetitle[0]) != campusmenu) {
Util.selectWebElement(driver, findCourseInCampuscourseMenu(driver, coursetitle[0]));
Util.selectXpath(driver, Xpathes.XPATH_FIRST_BUTTON_ON_MODAL);
LogTexts.logCCContinued(LOGGER, false, coursetitle[0], getItemTitel(driver, CourseCoreMarcos.XPATH_COURSETITEL));
LogTexts.logCCContinued(LOGGER, false, coursetitle[0], getItemTitel(driver, Xpathes.XPATH_COURSETITEL));
if (ct_length == 2) {
compareTitle(driver, coursetitle[1], CourseCoreMarcos.XPATH_COURSETITEL);
compareTitle(driver, coursetitle[1], Xpathes.XPATH_COURSETITEL);
}
} else {
return false;
@@ -18,9 +18,6 @@
private final static Logger LOGGER = LoggerFactory.getLogger(CourseCoreMarcos.class);
static final String XPATH_COURSETITEL = "//*[@class='o_titled_wrapper ']/h2";
private static final String XPATH_COURSESTAB = "//*[@id='o_navbar_container']/div/ul/li[1]/a";
public enum StartInfoOrCourseInCourse {
STARTCOURSEINFO_FAV(1, 1),
STARTCOURSEINFO_MY(2, 1),
@@ -94,7 +91,7 @@ private int toStringfoldercreations(){
*Select Courses tab
*/
public void selectTabCourse(WebDriver driver) throws Exception {
Util.openMainTab(driver, XPATH_COURSESTAB);
Util.openMainTab(driver, Xpathes.XPATH_COURSESTAB);
}
/**
Oops, something went wrong.

0 comments on commit 3d28e6d

Please sign in to comment.