forked from community/product-iots
parent
f40159eca3
commit
c9ab7103d8
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue