Minor fixes

merge-requests/1/head
Menaka Madushanka 9 years ago
parent d71b00d925
commit d7565e7fe7

@ -70,7 +70,7 @@ public class GraphHandler {
Graph g = new Graph(); Graph g = new Graph();
String key = e.getAttribute("id").split("-")[1]; String key = e.getAttribute("id").split("-")[1];
g.setGraphId(key.toLowerCase().replace(" ", "")); g.setGraphId(key.toLowerCase().replace(" ", ""));
String xAxis = e.findElement(By.xpath(uiElementMapper.getElement("ot.stat.graph.xAxis.xpath"))).getText(); String xAxis = e.findElement(By.xpath(uiElementMapper.getElement("iot.stat.graph.xAxis.xpath"))).getText();
g.setxAxis(xAxis); g.setxAxis(xAxis);
String yAxis = e.findElement(By.xpath("//*[contains(@id, \"y_axis-" + key + "\")]")).getText(); String yAxis = e.findElement(By.xpath("//*[contains(@id, \"y_axis-" + key + "\")]")).getText();
g.setyAxis(yAxis); g.setyAxis(yAxis);

@ -132,5 +132,5 @@ public class IOTAdminDashboard {
return new DevicesPage(driver); return new DevicesPage(driver);
} }
//ToDo : Need to add device and policy methods //ToDo : Need to add policy methods
} }

@ -76,6 +76,7 @@ public class ConnectedCupDeviceInterface {
WebElement tempSlider = driver.findElement(By.xpath( WebElement tempSlider = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.temperature.xpath"))); uiElementMapper.getElement("iot.sample.temperature.xpath")));
moveSlider(tempSlider, Integer.parseInt(temp)); moveSlider(tempSlider, Integer.parseInt(temp));
driver.manage().timeouts().implicitlyWait(UIUtils.webDriverTime, TimeUnit.SECONDS);
return true; return true;
} }
return false; return false;
@ -107,6 +108,5 @@ public class ConnectedCupDeviceInterface {
Actions move = new Actions(driver); Actions move = new Actions(driver);
Action action = move.dragAndDropBy(slider, 0, val).build(); Action action = move.dragAndDropBy(slider, 0, val).build();
action.perform(); action.perform();
} }
} }

@ -21,6 +21,8 @@ package org.wso2.iot.integration.ui.pages.samples;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.wso2.iot.integration.ui.pages.UIUtils; import org.wso2.iot.integration.ui.pages.UIUtils;
import org.wso2.iot.integration.ui.pages.UIElementMapper; import org.wso2.iot.integration.ui.pages.UIElementMapper;
@ -52,8 +54,9 @@ public class ConnectedCupDeviceTypeViewPage {
WebElement createInstanceBtn = driver.findElement(By.xpath( WebElement createInstanceBtn = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.createInstanceBtn.xpath"))); uiElementMapper.getElement("iot.sample.connectedcup.createInstanceBtn.xpath")));
createInstanceBtn.click(); createInstanceBtn.click();
WebDriverWait wait = new WebDriverWait(driver, UIUtils.webDriverTimeOut);
Thread.sleep(UIUtils.threadTimeout); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.modal.popup.xpath")))));
return driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.modal.popup.xpath"))).isDisplayed(); return driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.modal.popup.xpath"))).isDisplayed();
} }
@ -66,7 +69,6 @@ public class ConnectedCupDeviceTypeViewPage {
* @return : True if navigates to the Device type view page without errors. False otherwise. * @return : True if navigates to the Device type view page without errors. False otherwise.
*/ */
public boolean enrollDevice(String name) { public boolean enrollDevice(String name) {
WebElement nameField = driver.findElement(By.xpath( WebElement nameField = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.createInstance.nameField.xpath"))); uiElementMapper.getElement("iot.sample.connectedcup.createInstance.nameField.xpath")));
WebElement createButton = driver.findElement(By.xpath( WebElement createButton = driver.findElement(By.xpath(

@ -78,7 +78,6 @@ public class ConnectedCupDeviceViewPage {
return new ConnectedCupDeviceInterface(driverDevice); return new ConnectedCupDeviceInterface(driverDevice);
} }
/** /**
* Gets the connected cup device web app URL. * Gets the connected cup device web app URL.
* @return : Link of the connected cup device web app. * @return : Link of the connected cup device web app.
@ -91,7 +90,6 @@ public class ConnectedCupDeviceViewPage {
uiElementMapper.getElement("iot.sample.connectedcup.gotodevice.xpath"))).getAttribute("href"); uiElementMapper.getElement("iot.sample.connectedcup.gotodevice.xpath"))).getAttribute("href");
} }
/** /**
* This method checks whether there are expected number of graphs are available in the UI. * This method checks whether there are expected number of graphs are available in the UI.
* @param count : Number of graphs expected. * @param count : Number of graphs expected.
@ -101,7 +99,6 @@ public class ConnectedCupDeviceViewPage {
return handler.getGraphCount() == count; return handler.getGraphCount() == count;
} }
/** /**
* Checks whether the selected graph axes represent the given values. * Checks whether the selected graph axes represent the given values.
* @param axis : Graph axis. X or Y * @param axis : Graph axis. X or Y
@ -119,6 +116,7 @@ public class ConnectedCupDeviceViewPage {
return graphMap.get(graphId).getyAxis().contains(axisName); return graphMap.get(graphId).getyAxis().contains(axisName);
} }
} }
log.error("There are no graphs found.");
return false; return false;
} }
@ -131,12 +129,13 @@ public class ConnectedCupDeviceViewPage {
public boolean graphLegendName(String graphId, String legend) { public boolean graphLegendName(String graphId, String legend) {
log.info(graphMap.toString()); log.info(graphMap.toString());
if (graphMap.size() != 0) { if (graphMap.size() != 0) {
try { if (graphMap.get(graphId) != null){
return graphMap.get(graphId).getLegend().contains(legend); return graphMap.get(graphId).getLegend().contains(legend);
} catch (NullPointerException e) {
log.info("Null Pointer" + e.getMessage());
} }
log.error(String.format("Graph for %s is not found.", graphId));
return false;
} }
log.error("There are no graphs found.");
return false; return false;
} }

@ -20,12 +20,12 @@
iot.user.add.firstname=firstname iot.user.add.firstname=firstname
iot.user.add.lastname=lastname iot.user.add.lastname=lastname
iot.user.add.username=username iot.user.add.username=testUser
iot.user.add.password=password iot.user.add.password=testPassword
iot.user.add.email=username@wso2.com iot.user.add.email=username@wso2.com
iot.user.login.username=username iot.user.login.username=testUser
iot.user.login.password=password iot.user.login.password=testPassword
# User registration and login ui---------------------------------------------------------------------------------------- # User registration and login ui----------------------------------------------------------------------------------------

@ -60,7 +60,7 @@ public class Constants {
public static final String ADD_USER_FIRST_NAME_ERROR_MSG = "Firstname is a required field. It cannot be empty."; public static final String ADD_USER_FIRST_NAME_ERROR_MSG = "Firstname is a required field. It cannot be empty.";
public static final String ADD_USER_LAST_NAME_ERROR_MSG = "Lastname is a required field. It cannot be empty."; public static final String ADD_USER_LAST_NAME_ERROR_MSG = "Lastname is a required field. It cannot be empty.";
public static final String ADD_USER_NO_EMAIL_ERROR_MSG = "Email is a required field. It cannot be empty."; public static final String ADD_USER_NO_EMAIL_ERROR_MSG = "Email is a required field. It cannot be empty.";
public static final String ADD_USER_WRONG_EMAIL_ERROR_MSG = "Email is a required field. It cannot be empty."; public static final String ADD_USER_WRONG_EMAIL_ERROR_MSG = "Provided email is invalid. Please check.";
public static final String ALERT_NOT_PRESENT = "Alert is not present."; public static final String ALERT_NOT_PRESENT = "Alert is not present.";

@ -46,8 +46,8 @@ public class LoginTest extends IOTIntegrationUIBaseTestCase {
@Test(description = "Verify login to IOT server dashboard") @Test(description = "Verify login to IOT server dashboard")
public void testAdminLogin() throws IOException, XPathExpressionException { public void testAdminLogin() throws IOException, XPathExpressionException {
LoginPage test = new LoginPage(driver); LoginPage loginPage = new LoginPage(driver);
IOTAdminDashboard dashboard = test.loginAsAdmin( IOTAdminDashboard dashboard = loginPage.loginAsAdmin(
automationContext.getSuperTenant().getTenantAdmin().getUserName(), automationContext.getSuperTenant().getTenantAdmin().getUserName(),
automationContext.getSuperTenant().getTenantAdmin().getPassword()); automationContext.getSuperTenant().getTenantAdmin().getPassword());
dashboard.logout(); dashboard.logout();

@ -190,7 +190,8 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
} }
} }
} catch (RemoteException | LogViewerLogViewerException e) { } catch (RemoteException | LogViewerLogViewerException e) {
e.printStackTrace(); log.error("Error reading logs. \n" + e.getMessage());
Assert.assertTrue(false);
} }
} }
}; };

Loading…
Cancel
Save