Search in sources :

Example 11 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class IOTServerExtension method initiate.

@Override
public void initiate() throws AutomationFrameworkException {
    try {
        automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
        if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
            getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0");
        }
        serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
        executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
    } catch (XPathExpressionException e) {
        handleException("Error while initiating test environment", e);
    }
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext) XPathExpressionException(javax.xml.xpath.XPathExpressionException)

Example 12 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class SampleEnrollmentTest method setup.

@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();
}
Also used : EnrollDevicePage(org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage) IOTAdminDashboard(org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard) BeforeClass(org.testng.annotations.BeforeClass)

Example 13 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class LoginUtils method login.

/**
 * This method is used to login as admin.
 *
 * @param driver            The selenium web driver
 * @param automationContext Test Automation context
 * @param webAppURL         The server url
 */
public static void login(WebDriver driver, AutomationContext automationContext, String webAppURL) throws IOException, XPathExpressionException {
    driver.get(webAppURL + Constants.IOT_LOGIN_PATH);
    LoginPage test = new LoginPage(driver);
    test.loginAsAdmin(automationContext.getSuperTenant().getTenantAdmin().getUserName(), automationContext.getSuperTenant().getTenantAdmin().getPassword());
}
Also used : LoginPage(org.wso2.iot.integration.ui.pages.login.LoginPage)

Example 14 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class AnalyticsServerExtension method initiate.

@Override
public void initiate() throws AutomationFrameworkException {
    try {
        automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
        if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
            getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "2");
        }
        serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
        executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
    } catch (XPathExpressionException e) {
        handleException("Error while initiating test environment", e);
    }
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext) XPathExpressionException(javax.xml.xpath.XPathExpressionException)

Example 15 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class PolicyTest method setup.

@BeforeClass(alwaysRun = true)
public void setup() throws Exception {
    super.init();
    driver = BrowserManager.getWebDriver();
    LoginUtils.login(driver, automationContext, getWebAppURL());
    adminDashboard = new IOTAdminDashboard(driver);
}
Also used : IOTAdminDashboard(org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)8 XPathExpressionException (javax.xml.xpath.XPathExpressionException)7 BeforeClass (org.testng.annotations.BeforeClass)7 IOTAdminDashboard (org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard)4 DevicesPage (org.wso2.iot.integration.ui.pages.devices.DevicesPage)2 MalformedURLException (java.net.MalformedURLException)1 RemoteException (java.rmi.RemoteException)1 Test (org.testng.annotations.Test)1 User (org.wso2.carbon.automation.engine.context.beans.User)1 LogViewerClient (org.wso2.carbon.integration.common.admin.client.LogViewerClient)1 AutomationUtilException (org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException)1 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)1 LogViewerLogViewerException (org.wso2.carbon.logging.view.stub.LogViewerLogViewerException)1 EnrollDevicePage (org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage)1 LoginPage (org.wso2.iot.integration.ui.pages.login.LoginPage)1 ConnectedCupDeviceInterface (org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface)1