Sample Enrollment and verification

application-manager-new
Menaka Madushanka 9 years ago
parent b99001ae8d
commit adfa5762c9

@ -32,8 +32,6 @@ import java.rmi.RemoteException;
public class IOTIntegrationUIBaseTestCase {
private static final Log log = LogFactory.getLog(IOTIntegrationUIBaseTestCase.class);
protected AutomationContext automationContext;
protected void init() throws IOException, XMLStreamException, XPathExpressionException {

@ -17,7 +17,29 @@
*/
package org.wso2.iot.integration.ui.pages;
import org.apache.commons.logging.Log;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class UIConstants {
public static long webDriverTimeOut = 10;
public static long webDriverTime = 60;
public static int threadTimeout = 1000;
public static boolean isElementPresent(Log log, WebDriver driver, By by) {
try {
WebDriverWait wait = new WebDriverWait(driver, webDriverTime);
wait.until(ExpectedConditions.presenceOfElementLocated(by));
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
log.error(by.toString() + " is not present");
return false;
}
}
}

@ -1,25 +1,83 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.iot.integration.ui.pages.devices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
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.UIConstants;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
import java.io.IOException;
import java.util.List;
public class DevicesPage {
private WebDriver driver;
private UIElementMapper uiElementMapper;
Log log = LogFactory.getLog(DevicesPage.class);
public DevicesPage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
WebDriverWait webDriverWait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
if (!webDriverWait.until(ExpectedConditions.titleContains("Device Management | IoT Server"))) {
throw new IllegalStateException("This is not the Device Management page");
}
}
public boolean isDeviceEnrolled(String name) {
List<WebElement> deviceNames = driver.findElements(By.tagName("h4"));
if (!deviceNames.isEmpty()) {
for (WebElement deviceName : deviceNames) {
if (deviceName.getText().contains(name)) {
return true;
}
}
}
return false;
}
public ConnectedCupDeviceViewPage viewDevice(String deviceName) throws IOException {
WebElement deviceTable = driver.findElement(By.xpath(uiElementMapper.getElement("iot.devices.table.xpath")));
List<WebElement> data = deviceTable.findElements(By.cssSelector("a"));
for (WebElement e : data) {
String s = getLink(e, "/device/connectedcup?id=");
if (s != null) {
driver.get(s);
return new ConnectedCupDeviceViewPage(driver, deviceName);
}
}
return null;
}
public String getLink(WebElement element, String lookupText) {
String link = element.getAttribute("href");
log.info("Link -----------------------> " + link);
if (link.contains(lookupText)) {
log.info("returned ----------------->>>> " + link);
return link;
}
return null;
}
}

@ -20,6 +20,7 @@ package org.wso2.iot.integration.ui.pages.devices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ -34,9 +35,9 @@ import java.io.IOException;
* Device Enrollment page for new user
*/
public class EnrollDevicePage {
private static final Log log = LogFactory.getLog(EnrollDevicePage.class);
private WebDriver driver;
private UIElementMapper uiElementMapper;
private Log log = LogFactory.getLog(EnrollDevicePage.class);
public EnrollDevicePage(WebDriver driver) throws IOException {
this.driver = driver;
@ -48,22 +49,31 @@ public class EnrollDevicePage {
}
}
public boolean isInstalled(String name) {
return driver.findElement(By.id("#" + name.toLowerCase())) != null;
// WebElement sample = null;
// try {
// sample = driver.findElement(By.id("#"+name.toLowerCase()));
// } catch (NoSuchElementException e){
// log.error("No element found for id: " + name);
// }
// return sample != null;
public boolean isInstalled() {
boolean check = UIConstants.isElementPresent(log, driver, By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.xpath")));
if (check) {
WebElement deviceDiv = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.xpath")));
WebElement tryBtn = deviceDiv.findElement(By.tagName("button"));
return tryBtn.isDisplayed();
}
return false;
}
public ConnectedCupDeviceTypeViewPage gotoConnectedCupDeviceTypeViewPage() throws IOException {
WebElement tryBtn = driver.findElement(By.id(uiElementMapper.getElement("iot.sample.connectedcup.try.btn.id")));
tryBtn.click();
return new ConnectedCupDeviceTypeViewPage(driver);
boolean check = UIConstants.isElementPresent(log, driver,By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.xpath")));
if (check){
WebElement deviceDiv = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.xpath")));
WebElement tryBtn = deviceDiv.findElement(By.tagName("button"));
tryBtn.click();
return new ConnectedCupDeviceTypeViewPage(driver);
} else {
log.error("Element not found...........................");
return null;
}
}
}

@ -54,13 +54,13 @@ public class DeviceGroupsPage {
public boolean isGroupCreated(String groupName) {
WebElement table = driver.findElement(By.id(uiElementMapper.getElement("iot.device.table.id")));
List<WebElement> allGroupNames = table.findElements(By.tagName("h4"));
List<String> groupsList = new ArrayList<>();
for (WebElement name : allGroupNames) {
groupsList.add(name.getText());
if (name.getText().contains(groupName)){
return true;
}
}
return groupsList.contains(groupName);
return false;
}
}

@ -21,6 +21,7 @@ package org.wso2.iot.integration.ui.pages.samples;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.iot.integration.ui.pages.UIConstants;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
import java.io.IOException;
@ -32,24 +33,34 @@ public class ConnectedCupDeviceTypeViewPage {
public ConnectedCupDeviceTypeViewPage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
// WebDriverWait webDriverWait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
if (driver.findElement(By.xpath(
if (!driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.page.title"))).getText().
contains("Connected Cup")) {
throw new IllegalStateException("This is not the Connected cup device type view page");
}
}
public void enrollDevice(String name) {
public boolean isPopUpPresent() throws InterruptedException {
WebElement createInstanceBtn = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.createInstanceBtn.xpath")));
createInstanceBtn.click();
Thread.sleep(UIConstants.threadTimeout);
return driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.modal.popup.xpath"))).isDisplayed();
}
public boolean enrollDevice(String name) throws InterruptedException {
WebElement nameField = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.createInstance.nameField.xpath")));
WebElement createButton = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.createInstance.downloadBtn.xpath")));
nameField.sendKeys(name);
createButton.click();
return driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.page.title"))).getText().contains("Connected Cup");
}
}

@ -18,6 +18,36 @@
package org.wso2.iot.integration.ui.pages.samples;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.wso2.iot.integration.ui.pages.UIConstants;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
import java.io.IOException;
public class ConnectedCupDeviceViewPage {
private WebDriver driver;
private UIElementMapper uiElementMapper;
public ConnectedCupDeviceViewPage(WebDriver driver, String name) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
if (!driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.view.page.title"))).getText().
contains(name)) {
throw new IllegalStateException("This is not the Connected cup device type view page");
}
}
public VirtualSampleViewPage gotoDevice() throws IOException {
WebDriverWait wait = new WebDriverWait(driver, UIConstants.webDriverTime);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(
uiElementMapper.getElement("iot.sample.connectedcup.gotodevice.xpath"))));
driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.connectedcup.gotodevice.xpath"))).click();
return new VirtualSampleViewPage(driver);
}
}

@ -0,0 +1,80 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.iot.integration.ui.pages.samples;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
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.UIConstants;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
import java.io.IOException;
public class VirtualSampleViewPage {
Log log = LogFactory.getLog(VirtualSampleViewPage.class);
private WebDriver driver;
private UIElementMapper uiElementMapper;
public VirtualSampleViewPage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
WebDriverWait webDriverWait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
if (!webDriverWait.until(ExpectedConditions.titleContains("Connected Coffee Cup"))) {
throw new IllegalStateException("This is not the Connected cup device page");
}
}
public boolean orderCoffee() {
if (UIConstants.isElementPresent(log, driver, By.xpath(
uiElementMapper.getElement("iot.sample.orderCoffee.xpath")))) {
WebElement orderBtn = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.orderCoffee.xpath")));
orderBtn.click();
return true;
}
return false;
}
public boolean changeTemperature(String val) {
if (UIConstants.isElementPresent(log, driver, By.xpath(
uiElementMapper.getElement("iot.sample.temperature.xpath")))) {
WebElement tempSlider = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.temperature.xpath")));
tempSlider.clear();
tempSlider.sendKeys(val);
return true;
}
return false;
}
public boolean changeCoffeeLevel(String level) {
if (UIConstants.isElementPresent(log, driver, By.xpath(
uiElementMapper.getElement("iot.sample.coffee.level.xpath")))) {
WebElement tempSlider = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.sample.coffee.level.xpath")));
tempSlider.clear();
tempSlider.sendKeys(level);
return true;
}
return false;
}
}

@ -71,10 +71,6 @@ public class AddUserPage {
lastNameField.sendKeys(lastName);
emailField.sendKeys(email);
WebDriverWait wait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
// wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(
// uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath"))));
driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath"))).click();
return new UserAddedConfirmationPage(driver);

@ -17,8 +17,6 @@
*/
package org.wso2.iot.integration.ui.pages.uesr;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
@ -29,13 +27,11 @@ import java.io.IOException;
* This class represents the confirmation page for adding a new user.
*/
public class UserAddedConfirmationPage {
private static final Log log = LogFactory.getLog(UserAddedConfirmationPage.class);
private WebDriver driver;
private UIElementMapper uiElementMapper;
public UserAddedConfirmationPage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
UIElementMapper uiElementMapper = UIElementMapper.getInstance();
driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.view.btn.xpath"))).click();
}

@ -60,6 +60,8 @@ iot.admin.dashboard.title.xpath=/html/body/div[3]/div[1]/div/span
iot.home.enrollDevice.xpath=//*[@id="ast-container"]/div/p/a
iot.user.logout.link.xpath=/html/body/header/div/div[2]/ul/li[3]/a
iot.devices.table.xpath=//*[@id="device-grid"]
# Register page error elements -----------------------------------------------------------------------------------------
iot.user.register.firstname.error=first_name-error
@ -134,14 +136,26 @@ iot.admin.editUser.btn.xpath=//*[@id="userEditBtn"]
iot.admin.editUser.edit.btn.xpath=//*[@id="add-user-btn"]
#---------------------------Testing the samples ------------------------------------------------------------------------
iot.sample.connectedcup.id=#connectedcup
iot.sample.connectedcup.try.btn.id=#connectedcup
iot.sample.connectedcup.createInstanceBtn.xpath=/html/body/div[5]/div/div/div[2]/div[1]/div[4]/a[2]
iot.sample.connectedcup.createInstance.nameField.xpath=//*[@id="downloadForm"]/div[1]/div/input[1]
iot.sample.connectedcup.createInstance.downloadBtn.xpath=//*[@id="downloadForm"]/div[2]/a
iot.sample.connectedcup.xpath=//*[@id="connectedcup"]
iot.sample.connectedcup.try.btn.xpath=//button[contains(@id,'connectedcup_btn')]
iot.sample.connectedcup.try.btn.id=connectedcup_btn
iot.sample.connectedcup.page.title=//h1[@class='grey ']
iot.sample.connectedcup.view.page.title=//label[@class='device-id device-select']
iot.sample.connectedcup.createInstanceBtn.xpath=//a[@class='download-link btn-operations']
iot.sample.connectedcup.createInstance.nameField.xpath=//input[@class='connectedCupName']
iot.sample.connectedcup.createInstance.downloadBtn.xpath=//a[contains(@class,'btn-operations')]
iot.sample.modal.popup.xpath=//div[@class='modalpopup-content']
iot.sample.connectedcup.gotodevice.xpath=//a[@class='btn-operations']
iot.sample.connectedcup.device.title.xpath=/html/body/div[4]/h1
iot.sample.orderCoffee.xpath=//*[@id="order-cup"]
iot.sample.coffee.level.xpath=//*[@id="amount_coffee"]
iot.sample.temperature.xpath=//*[@id="amount_temp"]
iot.try.devices.div.classname=//div[@class='try-device-container']
iot.try.device.text.xpath=//p[contains(@class,'try-device-text')]
#-----------------------------------------------------------------------------------------------------------------------
#iot.user.delete.button=//*[@id="inosh"]/td[5]/a[3]
#iot.user.delete.button.confirm=remove-user-yes-link

@ -23,4 +23,10 @@ public class Constants {
public static final String IOT_USER_ADD_URL = "/devicemgt/user/add";
public static final String IOT_GROUP_ADD_URL = "/devicemgt/group/add";
public static final String IOT_HOME_URL = "/devicemgt/";
public static final String IOT_ENROLL_CONNECTED_CUP = "/device/connectedcup/enroll";
public static final String IOT_DEVICES_URL = "/devicemgt/devices";
public static final String IOT_CONNECTED_CUP_NAME = "testDevice";
}

@ -1,7 +1,50 @@
package org.wso2.carbon.iot.integration.web.ui.test.samples;
/**
* Created by menaka on 2/29/16.
*/
public class SampleEnrollmentTest {
import junit.framework.Assert;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
public class SampleEnrollmentTest extends IOTIntegrationUIBaseTestCase {
private WebDriver driver;
private ConnectedCupDeviceTypeViewPage connectedCupDeviceTypeViewPage;
@BeforeClass(alwaysRun = true)
public void setup() throws XPathExpressionException, XMLStreamException, IOException {
super.init();
driver = BrowserManager.getWebDriver();
LoginUtils.login(driver, automationContext, getWebAppURL());
IOTAdminDashboard adminDashboard = new IOTAdminDashboard(driver);
EnrollDevicePage enrollDevicePage = adminDashboard.enrollNewDevice();
connectedCupDeviceTypeViewPage = enrollDevicePage.gotoConnectedCupDeviceTypeViewPage();
}
@Test(description = "Verify the pop up modal is displayed.", groups = {"iot.enroll"}, dependsOnGroups = {"iot.install"})
public void enrollDevicePopUpModalTest() throws InterruptedException, IOException {
Assert.assertTrue(connectedCupDeviceTypeViewPage.isPopUpPresent());
}
@Test(description = "Test case for device enrolment", groups = {"iot.enroll"}, dependsOnMethods =
{"enrollDevicePopUpModalTest"})
public void enrollDeviceTest() throws InterruptedException {
Assert.assertTrue(connectedCupDeviceTypeViewPage.enrollDevice(Constants.IOT_CONNECTED_CUP_NAME));
}
@AfterClass(alwaysRun = true)
public void tearDown() {
driver.quit();
}
}

@ -0,0 +1,73 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.iot.integration.web.ui.test.samples;
import junit.framework.Assert;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
import org.wso2.iot.integration.ui.pages.samples.VirtualSampleViewPage;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
public class SampleEnrolmentVerificationTest extends IOTIntegrationUIBaseTestCase {
private WebDriver webDriver;
private DevicesPage devicesPage;
private ConnectedCupDeviceViewPage connectedCupDeviceViewPage;
@BeforeClass(alwaysRun = true)
public void setUp() throws XPathExpressionException, XMLStreamException, IOException {
super.init();
webDriver = BrowserManager.getWebDriver();
LoginUtils.login(webDriver, automationContext, getWebAppURL());
webDriver.get(getWebAppURL() + Constants.IOT_DEVICES_URL);
devicesPage = new DevicesPage(webDriver);
}
@Test(description = "Verify enrolment of the sample device", groups = {"iot.enroll.verify"}, dependsOnGroups = "iot.enroll")
public void verifyEnrollmentTest() {
Assert.assertTrue(devicesPage.isDeviceEnrolled(Constants.IOT_CONNECTED_CUP_NAME));
}
@Test(description = "Verify navigation to device view", dependsOnMethods = "verifyEnrollmentTest",
groups = {"iot.enroll.verify"})
public void verifyNavigationTest() throws IOException {
connectedCupDeviceViewPage = devicesPage.viewDevice(Constants.IOT_CONNECTED_CUP_NAME);
Assert.assertNotNull(connectedCupDeviceViewPage);
}
@Test(description = "Verify sample functions", dependsOnMethods = {"verifyNavigationTest"})
public void sampleStartUpTest() throws IOException {
VirtualSampleViewPage sampleViewPage = connectedCupDeviceViewPage.gotoDevice();
Assert.assertNotNull(sampleViewPage);
}
@AfterClass(alwaysRun = true)
public void tearDown() {
webDriver.quit();
}
}

@ -27,7 +27,6 @@ import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathExpressionException;
@ -36,7 +35,6 @@ import java.io.IOException;
public class SampleInstallationVerification extends IOTIntegrationUIBaseTestCase {
private WebDriver driver;
private EnrollDevicePage enrollDevicePage;
private IOTAdminDashboard adminDashboard;
@BeforeClass(alwaysRun = true)
@ -47,17 +45,11 @@ public class SampleInstallationVerification extends IOTIntegrationUIBaseTestCase
adminDashboard = new IOTAdminDashboard(driver);
}
@Test(description = "Verify the sample is available in Virtual devices section.")
@Test(description = "Verify the sample is available in Virtual devices section.", groups = {"iot.install"},
dependsOnGroups = {"iot.sample"})
public void installationVerificationTest() throws IOException {
enrollDevicePage = adminDashboard.enrollNewDevice();
Assert.assertTrue(enrollDevicePage.isInstalled("ConnectedCup"));
// Assert.assertTrue(enrollDevicePage.isInstalled("Virtual Fire Alarm"));
}
@Test(description = "Verify the installation of UI components.", dependsOnMethods =
{"installationVerificationTest"})
public void verifyNavigationToDeviceTypeView() throws IOException {
ConnectedCupDeviceTypeViewPage connectedCupDeviceTypeViewPage = enrollDevicePage.gotoConnectedCupDeviceTypeViewPage();
EnrollDevicePage enrollDevicePage = adminDashboard.enrollNewDevice();
Assert.assertTrue(enrollDevicePage.isInstalled());
}
@AfterClass(alwaysRun = true)

@ -39,7 +39,6 @@ import java.io.IOException;
*/
public class NewUserRegistrationTest extends IOTIntegrationUIBaseTestCase {
private WebDriver driver;
private UIElementMapper uiElementMapper;
@BeforeClass(alwaysRun = true)
public void setup() throws XPathExpressionException, XMLStreamException, IOException {
@ -51,7 +50,7 @@ public class NewUserRegistrationTest extends IOTIntegrationUIBaseTestCase {
@Test(description = "Verify new User registration")
public void userRegisterTest() throws IOException {
LoginPage login = new LoginPage(driver);
uiElementMapper = UIElementMapper.getInstance();
UIElementMapper uiElementMapper = UIElementMapper.getInstance();
NewUserRegisterPage registerTest = login.registerNewUser();
LoginPage loginPage = registerTest.registerUser(
uiElementMapper.getElement("iot.user.add.firstname"),

@ -23,7 +23,6 @@
<test name="IOT-Integration-Test" parallel="false" verbose="2">
<packages>
</packages>
<classes>
@ -37,6 +36,8 @@
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.user.AddUserFormValidationTest"/>-->
<class name="org.wso2.carbon.iot.integration.web.ui.test.samples.SampleInstallationTest"/>
<class name="org.wso2.carbon.iot.integration.web.ui.test.samples.SampleInstallationVerification"/>
<class name="org.wso2.carbon.iot.integration.web.ui.test.samples.SampleEnrollmentTest"/>
<class name="org.wso2.carbon.iot.integration.web.ui.test.samples.SampleEnrolmentVerificationTest"/>
</classes>
</test>

Loading…
Cancel
Save