diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/error/IOTErrorPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/error/IOTErrorPage.java new file mode 100644 index 00000000..da402c96 --- /dev/null +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/error/IOTErrorPage.java @@ -0,0 +1,31 @@ +package org.wso2.iot.integration.ui.pages.error; + +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.UIElementMapper; +import org.wso2.iot.integration.ui.pages.UIUtils; + +import java.io.IOException; + +public class IOTErrorPage { + + private WebDriver driver; + private UIElementMapper uiElementMapper; + private boolean isErrorPage = true; + + public IOTErrorPage (WebDriver driver) throws IOException { + this.driver = driver; + this.uiElementMapper = UIElementMapper.getInstance(); + WebDriverWait webDriverWait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); + + if (!webDriverWait.until(ExpectedConditions.titleContains(uiElementMapper.getElement("cdmf.error.page")))) { + isErrorPage = false; + throw new IllegalStateException("This is not the Error page"); + } + } + + public boolean isErrorPresent() { + return this.isErrorPage; + } +} diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java index 1db9969d..b80d0efb 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java @@ -20,7 +20,10 @@ package org.wso2.iot.integration.ui.pages.groups; 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.UIElementMapper; +import org.wso2.iot.integration.ui.pages.UIUtils; import java.io.IOException; @@ -37,9 +40,9 @@ public class DeviceAddGroupPage { public DeviceAddGroupPage(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); + WebDriverWait webDriverWait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); - if (!driver.findElement(By.xpath - (uiElementMapper.getElement("iot.device.group.addNewGroup.xpath"))).getText().contains("ADD NEW GROUP")) { + if (!webDriverWait.until(ExpectedConditions.titleContains(uiElementMapper.getElement("cdmf.groups.page")))) { throw new IllegalStateException("This is not the Add Group page"); } } diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java index 8a6d6ac5..8a05cd55 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java @@ -42,7 +42,7 @@ public class DeviceGroupsPage { WebDriverWait webDriverWait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); if (!webDriverWait.until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.xpath( - uiElementMapper.getElement("iot.device.groups.view.header.xpath"))), "GROUPS"))) { + uiElementMapper.getElement("iot.device.groups.view.header.xpath"))), "GROUP"))) { throw new IllegalStateException("This is not the Groups page"); } } diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java index 095e28fc..828e582b 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java @@ -22,7 +22,10 @@ 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.UIElementMapper; +import org.wso2.iot.integration.ui.pages.UIUtils; 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; @@ -51,18 +54,16 @@ import java.io.IOException; */ public class IOTAdminDashboard { - private static final Log log = LogFactory.getLog(IOTHomePage.class); + private static final Log log = LogFactory.getLog(IOTAdminDashboard.class); private WebDriver driver; private UIElementMapper uiElementMapper; public IOTAdminDashboard(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); - log.info(driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.dashboard.title.xpath"))). - getText()); - // Check that we're on the right page. - if (!driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.dashboard.title.xpath"))). - getText().contains("DASHBOARD")) { + WebDriverWait wait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); + + if (!wait.until(ExpectedConditions.titleIs(uiElementMapper.getElement("cdmf.home.page")))) { throw new IllegalStateException("This is not the home page"); } } diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java index 28998e05..58b929e9 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java @@ -43,7 +43,7 @@ public class IOTHomePage { this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. WebDriverWait wait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); - if (!wait.until(ExpectedConditions.titleIs("Device Management | IoT Server"))) { + if (!wait.until(ExpectedConditions.titleIs(uiElementMapper.getElement("cdmf.user.home.page")))) { throw new IllegalStateException("This is not the home page"); } } diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java index 8a23e407..91fb30c6 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java @@ -50,7 +50,7 @@ public class LoginPage { this.uiElementMapper = UIElementMapper.getInstance(); WebDriverWait webDriverWait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); - if (!webDriverWait.until(ExpectedConditions.titleContains("Login | IoT Server"))) { + if (!webDriverWait.until(ExpectedConditions.titleContains(uiElementMapper.getElement("cdmf.login.page")))) { throw new IllegalStateException("This is not the Login page"); } userNameField = driver.findElement(By.xpath( diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java index 90582de4..b40dfe51 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java +++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java @@ -49,7 +49,7 @@ public class NewUserRegisterPage { // Check that we're on the right page. WebDriverWait webDriverWait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); - if (!webDriverWait.until(ExpectedConditions.titleContains("Register | IoT Server"))) { + if (!webDriverWait.until(ExpectedConditions.titleContains(uiElementMapper.getElement("cdmf.register.page")))) { throw new IllegalStateException("This is not the Register page"); } diff --git a/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties b/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties index d5ee382e..e212e65e 100644 --- a/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties +++ b/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties @@ -16,6 +16,14 @@ # under the License. # +# CDMF Page titles ----------------------------------------------------------------------------------------------------- +cdmf.home.page=Home | CDMF +cdmf.login.page=Login | CDMF +cdmf.register.page=Register | CDMF +cdmf.error.page=Error | CDMF +cdmf.user.home.page=Device Management | CDMF +cdmf.groups.page=Group Management | CDMF + # User registration and login details----------------------------------------------------------------------------------- iot.user.add.firstname=firstname @@ -27,9 +35,10 @@ iot.user.add.email=username@wso2.com iot.user.login.username=testUser iot.user.login.password=testPassword + # User registration and login ui---------------------------------------------------------------------------------------- -iot.user.registered.name=/html/body/header/div/div[2]/a/span[1] +iot.user.registered.name=/html/body/header/div/div[2]/ul/li/a/span[2] iot.user.add.input.firstname.xpath=//*[@id="first_name"] iot.user.add.input.lastname.xpath=//*[@id="last_name"] @@ -58,18 +67,13 @@ iot.home.page.title.xpath=/html/body/div[3]/div[1]/div/span 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.user.logout.link.xpath=/html/body/header/div/div[2]/ul/li/ul/li[2]/a iot.devices.table.xpath=//*[@id="device-grid"] # Register page error elements ----------------------------------------------------------------------------------------- - -iot.user.register.firstname.error=first_name-error -iot.user.register.lastname.error=last_name-error -iot.user.register.username.error=user_name-error -iot.user.register.email.error=email-error -iot.user.register.password.error=password-error -iot.user.register.confirmPassword.error=password_confirmation-error +#//*[@id="user-create-error-msg"] +iot.user.register.form.error=user-create-error-msg # Admin dashboard Device ----------------------------------------------------------------------------------------------- iot.admin.device.viewBtn.xpath=//a[@href='/devicemgt/devices'] @@ -81,13 +85,12 @@ iot.user.login.password.error=password-error iot.user.login.incorrect.xpath=/html/body/div/div/div/div[1] iot.user.login.shortPassword=password-error - iot.dashboard.device.div.xpath=/html/body/div[3]/div[7]/div[1]/div/div/div[1] #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] +iot.device.group.addButton.xpath=/html/body/div[3]/div[2]/div/div[3]/div[2]/div/div[2]/div[2]/span[2]/a[2]/span/i[2] +iot.device.group.viewButton.xpath=/html/body/div[3]/div[2]/div/div[3]/div[2]/div/div[2]/div[2]/span[2]/a[1]/span/i[2] iot.device.group.addNewGroup.xpath=/html/body/div[3]/div/div[1]/div/p[1] @@ -97,9 +100,10 @@ iot.device.group.addGroupForm.name.id=name iot.device.group.addGroupForm.description.id=description iot.device.group.addGroupForm.addButton.id=add-group-btn -iot.device.groups.view.header.xpath=/html/body/div[3]/div[1]/div/span +iot.device.groups.view.header.xpath=/html/body/div[3]/div[2]/div/h1[1] -iot.device.groups.add.emptyfrom.error=/html/body/div[3]/div/div[1]/div/span/strong +#/html/body/div[3]/div[2]/div/div[3]/div/div/div[1]/label +iot.device.groups.add.emptyfrom.error=/html/body/div[3]/div[2]/div/div[3]/div/div/div[1]/label iot.device.table.id=group-grid diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/common/Constants.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/common/Constants.java index 9cb594c5..4942663c 100644 --- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/common/Constants.java +++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/common/Constants.java @@ -69,12 +69,14 @@ public class Constants { public static final String USER_NAME_ERROR = "Please enter a username"; public static final String PASSWORD_ERROR = "Please provide a password"; - public static final String FAILED_ERROR = "Incorrect username or password.!"; + public static final String FAILED_ERROR = "LOGIN\n" + + "Login failed! Please recheck the username and password and try again.!\n" + "Username *\n" + + "Password *\n" + "LOGIN\n" + "Create an account"; public static final String SHORT_PASSWORD_ERROR = "Your password must be at least 3 characters long"; public static final String WRONG_USER_NAME = "admnnn"; public static final String WRONG_USER_PASSWORD = "admmmm"; public static final String SHORT_PASSWORD = "ad"; - public static final String PAGE_TITLE = "Login | IoT Server"; + public static final String PAGE_TITLE = "Login | CDMF"; } diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/error/InitialErrorTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/error/InitialErrorTest.java new file mode 100644 index 00000000..ac7ecda6 --- /dev/null +++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/error/InitialErrorTest.java @@ -0,0 +1,39 @@ +package org.wso2.carbon.iot.integration.web.ui.test.error; + +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.common.Constants; +import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase; +import org.wso2.iot.integration.ui.pages.error.IOTErrorPage; + +import javax.xml.stream.XMLStreamException; +import javax.xml.xpath.XPathExpressionException; +import java.io.IOException; + +public class InitialErrorTest extends IOTIntegrationUIBaseTestCase{ + + private WebDriver driver; + + @BeforeClass(alwaysRun = true) + public void setup() throws XPathExpressionException, XMLStreamException, IOException { + super.init(); + driver = BrowserManager.getWebDriver(); + driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH); + } + + @Test(description = "Test for initial login error.") + public void ErrorPageTest() throws IOException { + IOTErrorPage errorPage = new IOTErrorPage(driver); + Assert.assertTrue(errorPage.isErrorPresent()); + } + + @AfterClass(alwaysRun = true) + public void tearDown(){ + driver.quit(); + } + +} diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java index b727101e..9b478a8c 100644 --- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java +++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java @@ -53,25 +53,6 @@ public class LoginFormValidationTest extends IOTIntegrationUIBaseTestCase { clearForm(); } - @Test(description = "Test for empty login form submission") - public void emptyLoginFormTest() throws Exception { - userNameField.sendKeys(""); - passwordField.sendKeys(""); - loginButton.click(); - - WebElement alertUserName = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.login.username.error"))); - WebElement alertPassword = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.login.password.error"))); - - if (!alertUserName.isDisplayed()) Assert.assertTrue(false, "Alert for user name is not present."); - if (!alertPassword.isDisplayed()) Assert.assertTrue(false, "Alert for password is not present."); - - Assert.assertEquals(alertUserName.getText(), Constants.User.Login.USER_NAME_ERROR); - Assert.assertEquals(alertPassword.getText(), Constants.User.Login.PASSWORD_ERROR); - - } - @Test(description = "Test for incorrect username") public void incorrectUserNameTest() throws Exception { clearForm(); @@ -103,22 +84,6 @@ public class LoginFormValidationTest extends IOTIntegrationUIBaseTestCase { } } - - @Test(description = "Test for short password") - public void shortPasswordTest() throws Exception { - clearForm(); - userNameField.sendKeys(automationContext.getSuperTenant().getTenantAdmin().getUserName()); - passwordField.sendKeys(Constants.User.Login.SHORT_PASSWORD); - loginButton.click(); - - WebElement alert = driver.findElement(By.id(uiElementMapper.getElement("iot.user.login.password.error"))); - if (alert.isDisplayed()) { - Assert.assertEquals(alert.getText(), Constants.User.Login.SHORT_PASSWORD_ERROR); - } else { - Assert.assertTrue(false, Constants.ALERT_NOT_PRESENT); - } - } - public void clearForm() throws Exception { driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH); uiElementMapper = UIElementMapper.getInstance(); diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java index 4bdf52ed..ba219038 100644 --- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java +++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java @@ -45,7 +45,7 @@ public class LoginTest extends IOTIntegrationUIBaseTestCase { driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH); } - @Test(description = "Verify login to IOT server dashboard") + @Test(description = "Verify logins to IOT server dashboard") public void testAdminLogin() throws IOException, XPathExpressionException { LoginPage loginPage = new LoginPage(driver); IOTAdminDashboard dashboard = loginPage.loginAsAdmin( diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java index 60af0de3..ec088dd4 100644 --- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java +++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java @@ -61,80 +61,50 @@ public class RegistrationFormValidationTest extends IOTIntegrationUIBaseTestCase registerPage.validateForm("", "", "", "", "", ""); WebElement alertFirstName = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.firstname.error"))); - WebElement alertLastName = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.lastname.error"))); - WebElement alertEmail = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.email.error"))); - WebElement alertUserName = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.username.error"))); - WebElement alertPassword = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.password.error"))); - WebElement alertConfPassword = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.confirmPassword.error"))); + uiElementMapper.getElement("iot.user.register.form.error"))); if (!alertFirstName.isDisplayed()) { Assert.assertTrue(false, "Alert for first name is not displayed"); } - if (!alertLastName.isDisplayed()) { - Assert.assertTrue(false, "Alert for last name is not displayed"); - } - if (!alertEmail.isDisplayed()) { - Assert.assertTrue(false, "Alert for email is not displayed"); - } - if (!alertUserName.isDisplayed()) { - Assert.assertTrue(false, "Alert for user name is not displayed"); - } - if (!alertPassword.isDisplayed()) { - Assert.assertTrue(false, "Alert for password is not displayed"); - } - if (!alertConfPassword.isDisplayed()) { - Assert.assertTrue(false, "Alert for confirm password is not displayed"); - } - Assert.assertEquals(alertFirstName.getText(), "Firstname is a required field. This cannot be empty."); - Assert.assertEquals(alertLastName.getText(), "Lastname is a required field. This cannot be empty."); - Assert.assertEquals(alertEmail.getText(), "Email is a required field. This cannot be empty."); - Assert.assertEquals(alertUserName.getText(), "Username is a required field. This cannot be empty."); - Assert.assertEquals(alertPassword.getText(), "Please enter a user login password"); - Assert.assertEquals(alertConfPassword.getText(), "Please enter a user login password"); + Assert.assertEquals(alertFirstName.getText(), "Firstname is a required field. It cannot be empty."); } @Test(description = "Test for non matching passwords") public void nonMatchingPasswordTest() { registerPage.validateForm("user", "user", "user@wso2.com", "user1", "password", "Password"); WebElement alertConfPassword = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.confirmPassword.error"))); + uiElementMapper.getElement("iot.user.register.form.error"))); if (!alertConfPassword.isDisplayed()) { Assert.assertTrue(false, "Alert for confirm password is not displayed"); } - Assert.assertEquals(alertConfPassword.getText(), "Please enter the same password as above"); + Assert.assertEquals(alertConfPassword.getText(), "Please enter the same password for confirmation."); } @Test(description = "Test for email") public void incorrectEmailTest() { registerPage.validateForm("user", "user", "user123", "user1", "password", "password"); WebElement alertEmail = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.email.error"))); + uiElementMapper.getElement("iot.user.register.form.error"))); if (!alertEmail.isDisplayed()) { Assert.assertTrue(false, "Alert for email is not displayed"); } - Assert.assertEquals(alertEmail.getText(), "Email is not valid. Please enter a correct email address."); + Assert.assertEquals(alertEmail.getText(), "Provided email is invalid."); } @Test(description = "Test for password length") public void passwordLengthTest() { registerPage.validateForm("user", "user", "user@wso2.com", "user1", "pass", "pass"); WebElement alertPassword = driver.findElement(By.id( - uiElementMapper.getElement("iot.user.register.password.error"))); + uiElementMapper.getElement("iot.user.register.form.error"))); if (!alertPassword.isDisplayed()) { Assert.assertTrue(false, "Alert for password is not displayed"); } - Assert.assertEquals(alertPassword.getText(), "Password should be between 5 and 30 characters."); + Assert.assertEquals(alertPassword.getText(), "Password is a required field. It cannot be empty."); } @AfterClass(alwaysRun = true) diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml b/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml index 6df79fcd..5ff41446 100644 --- a/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml +++ b/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml @@ -26,13 +26,14 @@ + - + - - - + + +