mirror of
https://repository.entgra.net/community/product-iots.git
synced 2025-09-16 23:32:19 +00:00
Sample installation and verification
This commit is contained in:
parent
890209e3de
commit
28879b416f
@ -0,0 +1,25 @@
|
||||
package org.wso2.iot.integration.ui.pages.devices;
|
||||
|
||||
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 DevicesPage {
|
||||
private WebDriver driver;
|
||||
private UIElementMapper uiElementMapper;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.ConnectedCupDeviceTypeViewPage;
|
||||
|
||||
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;
|
||||
|
||||
public EnrollDevicePage(WebDriver driver) throws IOException {
|
||||
this.driver = driver;
|
||||
this.uiElementMapper = UIElementMapper.getInstance();
|
||||
|
||||
WebDriverWait webDriverWait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
|
||||
if (!webDriverWait.until(ExpectedConditions.titleContains("Device Types | IoT Server"))) {
|
||||
throw new IllegalStateException("This is not the Device Enrollment page");
|
||||
}
|
||||
}
|
||||
|
||||
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 ConnectedCupDeviceTypeViewPage gotoConnectedCupDeviceTypeViewPage() throws IOException {
|
||||
WebElement tryBtn = driver.findElement(By.id(uiElementMapper.getElement("iot.sample.connectedcup.try.btn.id")));
|
||||
tryBtn.click();
|
||||
return new ConnectedCupDeviceTypeViewPage(driver);
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,8 @@ import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.wso2.iot.integration.ui.pages.UIElementMapper;
|
||||
import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
|
||||
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
|
||||
import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
|
||||
import org.wso2.iot.integration.ui.pages.groups.DeviceGroupsPage;
|
||||
import org.wso2.iot.integration.ui.pages.login.LoginPage;
|
||||
@ -93,5 +95,15 @@ public class IOTAdminDashboard {
|
||||
return new UserListingPage(driver);
|
||||
}
|
||||
|
||||
public EnrollDevicePage enrollNewDevice() throws IOException {
|
||||
driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.device.addBtn.xpath"))).click();
|
||||
return new EnrollDevicePage(driver);
|
||||
}
|
||||
|
||||
public DevicesPage viewDevices() throws IOException {
|
||||
driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.device.viewBtn.xpath"))).click();
|
||||
return new DevicesPage(driver);
|
||||
}
|
||||
|
||||
//ToDo : Need to add device and policy methods
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ 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.enroll.EnrollDevicePage;
|
||||
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
|
||||
import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
|
||||
import org.wso2.iot.integration.ui.pages.login.LoginPage;
|
||||
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.wso2.iot.integration.ui.pages.UIElementMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ConnectedCupDeviceTypeViewPage {
|
||||
private WebDriver driver;
|
||||
private UIElementMapper uiElementMapper;
|
||||
|
||||
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(
|
||||
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) {
|
||||
WebElement createInstanceBtn = driver.findElement(By.xpath(
|
||||
uiElementMapper.getElement("iot.sample.connectedcup.createInstanceBtn.xpath")));
|
||||
createInstanceBtn.click();
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -15,25 +15,9 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.wso2.iot.integration.ui.pages.enroll;
|
||||
package org.wso2.iot.integration.ui.pages.samples;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.wso2.iot.integration.ui.pages.UIElementMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
public class ConnectedCupDeviceViewPage {
|
||||
|
||||
/**
|
||||
* Device Enrollment page for new user
|
||||
*/
|
||||
public class EnrollDevicePage {
|
||||
private static final Log log = LogFactory.getLog(EnrollDevicePage.class);
|
||||
private WebDriver driver;
|
||||
private UIElementMapper uiElementMapper;
|
||||
|
||||
public EnrollDevicePage(WebDriver driver) throws IOException {
|
||||
this.driver = driver;
|
||||
this.uiElementMapper = UIElementMapper.getInstance();
|
||||
}
|
||||
}
|
||||
@ -72,8 +72,8 @@ public class AddUserPage {
|
||||
emailField.sendKeys(email);
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, UIConstants.webDriverTimeOut);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(
|
||||
uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath"))));
|
||||
// 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();
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ public class UserListingPage {
|
||||
/**
|
||||
* @return After deleting a user, returns back to the user listing page.
|
||||
*/
|
||||
public UserListingPage deleteUser() throws IOException {
|
||||
public UserListingPage deleteUser() throws IOException, InterruptedException {
|
||||
WebElement deleteBtn = driver.findElement(By.xpath(
|
||||
uiElementMapper.getElement("iot.admin.deleteUser.btn.xpath")));
|
||||
|
||||
@ -55,9 +55,9 @@ public class UserListingPage {
|
||||
wait.until(ExpectedConditions.visibilityOf(deleteConfirmationBtn));
|
||||
deleteConfirmationBtn.click();
|
||||
|
||||
Thread.sleep(UIConstants.threadTimeout);
|
||||
WebElement deleteSuccessBtn = driver.findElement(
|
||||
By.xpath(uiElementMapper.getElement("iot.admin.deleteUser.success.link.xpath")));
|
||||
wait.until(ExpectedConditions.visibilityOf(deleteSuccessBtn));
|
||||
deleteSuccessBtn.click();
|
||||
|
||||
return new UserListingPage(driver);
|
||||
|
||||
@ -69,6 +69,10 @@ iot.user.register.email.error=email-error
|
||||
iot.user.register.password.error=password-error
|
||||
iot.user.register.confirmPassword.error=password_confirmation-error
|
||||
|
||||
# Admin dashboard Device -----------------------------------------------------------------------------------------------
|
||||
iot.admin.device.viewBtn.xpath=//a[@href='/devicemgt/devices']
|
||||
iot.admin.device.addBtn.xpath=//a[@href='/devicemgt/device/enroll']
|
||||
|
||||
# Incorrect login Credentials ------------------------------------------------------------------------------------------
|
||||
iot.user.login.username.error=username-error
|
||||
iot.user.login.password.error=password-error
|
||||
@ -78,7 +82,7 @@ iot.user.login.shortPassword=password-error
|
||||
|
||||
iot.dashboard.device.div.xpath=/html/body/div[3]/div[7]/div[1]/div/div/div[1]
|
||||
|
||||
#Grouping ---------------------------------------------------------------
|
||||
#Grouping --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
iot.device.group.addButton.xpath=/html/body/div[3]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/span[2]/a[2]
|
||||
iot.device.group.viewButton.xpath=/html/body/div[3]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/span[2]/a[1]
|
||||
@ -119,16 +123,25 @@ iot.admin.deleteUser.success.link.xpath=//a[@id="remove-user-success-link"]
|
||||
|
||||
iot.admin.addUser.formError.xpath=//*[@id="user-create-error-msg"]
|
||||
|
||||
#----- User view page heading ----------------------------------------
|
||||
#----- User view page heading ------------------------------------------------------------------------------------------
|
||||
|
||||
iot.user.view.page.heading.xpath=/html/body/div[3]/div[1]/div/label
|
||||
|
||||
#----- Editing a user-------------------------------------------------
|
||||
#----- Editing a user---------------------------------------------------------------------------------------------------
|
||||
|
||||
iot.admin.viewUser.btn.xpath=//*[@id="user1"]/td[5]/a[1]/span[1]/i[2]
|
||||
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.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
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package org.wso2.carbon.iot.integration.web.ui.test.samples;
|
||||
|
||||
/**
|
||||
* Created by menaka on 2/29/16.
|
||||
*/
|
||||
public class SampleEnrollmentTest {
|
||||
}
|
||||
@ -20,11 +20,16 @@ package org.wso2.carbon.iot.integration.web.ui.test.samples;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.testng.Assert;
|
||||
import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException;
|
||||
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;
|
||||
import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException;
|
||||
import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager;
|
||||
import org.wso2.carbon.integration.common.admin.client.LogViewerClient;
|
||||
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
|
||||
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
|
||||
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
@ -34,6 +39,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@ -53,15 +60,18 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
|
||||
private Properties properties = System.getProperties();
|
||||
private String carbonHome = properties.getProperty("carbon.home");
|
||||
private String[] cmdArray;
|
||||
private LogViewerClient logViewerClient;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setup() throws XPathExpressionException, XMLStreamException, IOException, AutomationFrameworkException {
|
||||
public void setup() throws XPathExpressionException, XMLStreamException, IOException, AutomationFrameworkException,
|
||||
LoginAuthenticationExceptionException {
|
||||
super.init();
|
||||
logViewerClient = new LogViewerClient(getBackendURL(), getSessionCookie(automationContext));
|
||||
}
|
||||
|
||||
@Test(description = "Verify the sample build process")
|
||||
@Test(groups = {"iot.sample"}, description = "Verify the sample build process")
|
||||
public void sampleBuildTest() throws IOException {
|
||||
String connectedCupDir = carbonHome + File.pathSeparator + "samples" + File.pathSeparator + "connectedcup";
|
||||
String connectedCupDir = carbonHome + File.separator + "samples" + File.separator + "connectedcup";
|
||||
log.info("Connected cup Sample: " + connectedCupDir);
|
||||
File dir = new File(connectedCupDir);
|
||||
try {
|
||||
@ -69,7 +79,6 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
|
||||
log.info("Executing maven clean install --------------------------------");
|
||||
cmdArray = new String[]{"cmd.exe", "/c", "mvn clean install"};
|
||||
tempProcess = Runtime.getRuntime().exec(cmdArray, null, dir);
|
||||
|
||||
} else {
|
||||
log.info("Executing maven clean install --------------------------------");
|
||||
cmdArray = new String[]{"mvn", "clean", "install"};
|
||||
@ -85,7 +94,8 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(description = "Verify the sample installation process", dependsOnMethods = {"sampleBuildTest"})
|
||||
@Test(groups = {"iot.sample"}, description = "Verify the sample installation process", dependsOnMethods =
|
||||
{"sampleBuildTest"})
|
||||
public void sampleInstallationTest() throws IOException {
|
||||
|
||||
log.info("CARBON_HOME: " + System.getProperty("carbon.home"));
|
||||
@ -108,21 +118,33 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(description = "Test restarting the server", dependsOnMethods = {"sampleInstallationTest"})
|
||||
@Test(groups = {"iot.sample"}, description = "Test restarting the server", dependsOnMethods =
|
||||
{"sampleInstallationTest"})
|
||||
public void serverRestartTest() {
|
||||
CarbonServerManager serverManager = new CarbonServerManager(automationContext);
|
||||
ServerConfigurationManager serverManager;
|
||||
LogEvent[] events;
|
||||
String msg = "Mgt Console URL : https://10.100.4.7:9443/carbon/";
|
||||
try {
|
||||
serverManager = new ServerConfigurationManager(automationContext);
|
||||
serverManager.restartGracefully();
|
||||
} catch (AutomationFrameworkException e) {
|
||||
log.error("Restart failed....");
|
||||
|
||||
events = logViewerClient.getAllRemoteSystemLogs();
|
||||
Assert.assertTrue(waitForRestart(events, msg));
|
||||
} catch (AutomationUtilException | XPathExpressionException | MalformedURLException e) {
|
||||
log.error("Restart failed due to : " + e.getLocalizedMessage());
|
||||
} catch (RemoteException | LogViewerLogViewerException e) {
|
||||
log.error("Cannot get server log due to : " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void tearDown() throws Exception {
|
||||
if (tempProcess != null) {
|
||||
tempProcess.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean waitForMessage(InputStream inputStream, String message) throws IOException {
|
||||
private boolean waitForMessage(InputStream inputStream, String message) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
boolean status = false;
|
||||
@ -134,4 +156,12 @@ public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
private boolean waitForRestart(LogEvent[] events, String msg) {
|
||||
for (LogEvent event : events) {
|
||||
if (event.getMessage().contains(msg))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 org.openqa.selenium.WebDriver;
|
||||
import org.testng.Assert;
|
||||
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.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 SampleInstallationVerification extends IOTIntegrationUIBaseTestCase {
|
||||
|
||||
private WebDriver driver;
|
||||
private EnrollDevicePage enrollDevicePage;
|
||||
private IOTAdminDashboard adminDashboard;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setup() throws XPathExpressionException, XMLStreamException, IOException {
|
||||
super.init();
|
||||
driver = BrowserManager.getWebDriver();
|
||||
LoginUtils.login(driver, automationContext, getWebAppURL());
|
||||
adminDashboard = new IOTAdminDashboard(driver);
|
||||
}
|
||||
|
||||
@Test(description = "Verify the sample is available in Virtual devices section.")
|
||||
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();
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void teardown() {
|
||||
driver.quit();
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ import java.io.IOException;
|
||||
* - Create a new User
|
||||
* - Delete a user
|
||||
*/
|
||||
public class TestAdminFunctions extends IOTIntegrationUIBaseTestCase {
|
||||
public class AdminFunctionsTest extends IOTIntegrationUIBaseTestCase {
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
@ -50,10 +50,10 @@ public class NewUserRegistrationTest extends IOTIntegrationUIBaseTestCase {
|
||||
|
||||
@Test(description = "Verify new User registration")
|
||||
public void userRegisterTest() throws IOException {
|
||||
LoginPage loginPage = new LoginPage(driver);
|
||||
LoginPage login = new LoginPage(driver);
|
||||
uiElementMapper = UIElementMapper.getInstance();
|
||||
NewUserRegisterPage registerTest = loginPage.registerNewUser();
|
||||
loginPage = registerTest.registerUser(
|
||||
NewUserRegisterPage registerTest = login.registerNewUser();
|
||||
LoginPage loginPage = registerTest.registerUser(
|
||||
uiElementMapper.getElement("iot.user.add.firstname"),
|
||||
uiElementMapper.getElement("iot.user.add.lastname"),
|
||||
uiElementMapper.getElement("iot.user.add.email"),
|
||||
|
||||
@ -40,7 +40,7 @@ import java.io.IOException;
|
||||
* - Non matching passwords
|
||||
* - Password, username length
|
||||
*/
|
||||
public class RegistrationFormValidationTests extends IOTIntegrationUIBaseTestCase {
|
||||
public class RegistrationFormValidationTest extends IOTIntegrationUIBaseTestCase {
|
||||
private WebDriver driver;
|
||||
private UIElementMapper uiElementMapper;
|
||||
private NewUserRegisterPage registerPage;
|
||||
@ -99,7 +99,7 @@ public class RegistrationFormValidationTests extends IOTIntegrationUIBaseTestCas
|
||||
|
||||
@Test(description = "Test for password length")
|
||||
public void passwordLengthTest() {
|
||||
registerPage.validateForm("user", "user", "user@wso2.com", "user1", "passw", "passw");
|
||||
registerPage.validateForm("user", "user", "user@wso2.com", "user1", "pass", "pass");
|
||||
Assert.assertEquals(driver.findElement(By.id(
|
||||
uiElementMapper.getElement("iot.user.register.password.error"))).getText(),
|
||||
"Password should be between 5 and 30 characters.");
|
||||
@ -109,6 +109,4 @@ public class RegistrationFormValidationTests extends IOTIntegrationUIBaseTestCas
|
||||
public void tearDown() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -27,15 +27,16 @@
|
||||
</packages>
|
||||
|
||||
<classes>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.login.LoginTest"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.user.NewUserRegistrationTest"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.user.RegistrationFormValidationTests"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.login.LoginFailTest"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.group.DeviceGroupTest"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.group.DeviceGroupFailTest"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.user.TestAdminFunctions"/>
|
||||
<class name="org.wso2.carbon.iot.integration.web.ui.test.user.AddUserFormValidationTest"/>
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.login.LoginTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.user.NewUserRegistrationTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.user.RegistrationFormValidationTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.login.LoginFailTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.group.DeviceGroupTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.group.DeviceGroupFailTest"/>-->
|
||||
<!--<class name="org.wso2.carbon.iot.integration.web.ui.test.user.AdminFunctionsTest"/>-->
|
||||
<!--<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"/>
|
||||
</classes>
|
||||
|
||||
</test>
|
||||
|
||||
4
pom.xml
4
pom.xml
@ -282,10 +282,6 @@
|
||||
<groupId>org.wso2.carbon.commons</groupId>
|
||||
<artifactId>org.wso2.carbon.user.mgt.stub</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon.commons</groupId>
|
||||
<artifactId>org.wso2.carbon.logging.view.stub</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon.commons</groupId>
|
||||
<artifactId>org.wso2.carbon.ndatasource.stub</artifactId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user