Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #102 from NisalaNiroshana/LoadOderingTest
Browse files Browse the repository at this point in the history
Load odering test
  • Loading branch information
sinthuja committed Jun 24, 2016
2 parents 2bcd4db + cc5a40b commit dd79308
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,7 @@ public static Object[][] userModeProvider() {
*/
@BeforeClass(alwaysRun = true)
public void setUp() throws AutomationUtilException, XPathExpressionException, IOException {
String systemResourceLocation = FrameworkPathUtil.getSystemResourceLocation();
String gadgetStorePath = getPortalFilePath(UESDASHBOARDS_GADGETSTORE_PATH);
String testGadgetPathLowPriority = systemResourceLocation + "gadgets/textbox-testGadgetLowPriority.zip";
String testGadgetPathMediumPriority = systemResourceLocation + "gadgets/textbox-testGadgetMediumPriority.zip";
String testGadgetPathHighPriority = systemResourceLocation + "gadgets/textbox-testGadgetHighPriority.zip";

FileUtils.copyFileToDirectory(new File(testGadgetPathLowPriority), new File(gadgetStorePath));
FileUtils.copyFileToDirectory(new File(testGadgetPathMediumPriority), new File(gadgetStorePath));
FileUtils.copyFileToDirectory(new File(testGadgetPathHighPriority), new File(gadgetStorePath));

// Restart the server after the custom gadgets are loaded
AutomationContext automationContext =
new AutomationContext(DSIntegrationTestConstants.DS_PRODUCT_NAME, this.userMode);
ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(automationContext);
serverConfigurationManager.restartGracefully();

login(getCurrentUsername(), getCurrentPassword());

addDashBoard(DASHBOARD_TITLE, "This is a test dashboard");
}

Expand Down Expand Up @@ -121,7 +104,7 @@ public void tearDown() throws XPathExpressionException, MalformedURLException {
public void testGadgetLoadOrder() throws MalformedURLException, XPathExpressionException {
redirectToLocation("portal", "dashboards");
getDriver().findElement(By.cssSelector("#" + DASHBOARD_TITLE + " a.ues-edit")).click();
String[][] gadgetMappings = {{"textbox-TestGadgetLowPriority", "a"}, {"textbox-TestGadgetMediumPriority", "b"}, {"textbox-TestGadgetHighPriority", "c"}};
String[][] gadgetMappings = {{"test3", "a"}, {"test1", "b"}, {"test2", "c"}};
String script = generateAddGadgetScript(gadgetMappings);
selectPane("gadgets");
getDriver().executeScript(script);
Expand All @@ -132,13 +115,13 @@ public void testGadgetLoadOrder() throws MalformedURLException, XPathExpressionE
boolean correctLoadOrder = false;
Date timeBeforeLoadingHighPriority = new Date();
(new WebDriverWait(getDriver(), 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("textbox-TestGadgetHighPriority-0")));
.until(ExpectedConditions.presenceOfElementLocated(By.id("test2-0")));
Date timeBeforeLoadingMediumPriority = new Date();
(new WebDriverWait(getDriver(), 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("textbox-TestGadgetMediumPriority-0")));
.until(ExpectedConditions.presenceOfElementLocated(By.id("test1-0")));
Date timeBeforeLoadingLowPriority = new Date();
(new WebDriverWait(getDriver(), 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("textbox-TestGadgetLowPriority-0")));
.until(ExpectedConditions.presenceOfElementLocated(By.id("test3-0")));
Date timeAfterLoading = new Date();
if (timeBeforeLoadingMediumPriority.getTime() - timeBeforeLoadingHighPriority.getTime() < 5000 &&
timeBeforeLoadingLowPriority.getTime() - timeBeforeLoadingMediumPriority.getTime() >= 5000 &&
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit dd79308

Please sign in to comment.