Java Code Examples for org.wso2.carbon.automation.extensions.selenium.BrowserManager#getWebDriver()

The following examples show how to use org.wso2.carbon.automation.extensions.selenium.BrowserManager#getWebDriver() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventSimulatorTestCase.java    From product-cep with Apache License 2.0 6 votes vote down vote up
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = BrowserManager.getWebDriver();
    String loggedInSessionCookie = getSessionCookie();

    eventStreamManagerAdminServiceClient = configurationUtil.getEventStreamManagerAdminServiceClient(
            backendURL, loggedInSessionCookie);

    // Deploying the stream definition required to run the simulator
    String streamDefinitionAsString = getJSONArtifactConfiguration("eventsimulatorFiles",
            "TempStream_1.0.0.json");

    eventStreamManagerAdminServiceClient.addEventStreamAsString(streamDefinitionAsString);
    Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), 1);
}
 
Example 2
Source File: ESBJAVA4617SourceViewTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath("artifacts/ESB/synapseconfig/proxyadmin/ESBJAVA4617Proxy.xml");
    driver = BrowserManager.getWebDriver();
    driver.get(getLoginURL());
}
 
Example 3
Source File: SampleInstallationVerification.java    From product-iots with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setup() throws XPathExpressionException, XMLStreamException, IOException {
    super.init();
    driver = BrowserManager.getWebDriver();
    LoginUtils.login(driver, automationContext, getWebAppURL());
    adminDashboard = new IOTAdminDashboard(driver);
}
 
Example 4
Source File: ESPublisherAssetOverrideExistingPageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
      super.init();
      driver = BrowserManager.getWebDriver();
      baseUrl = getWebAppURL();
      ESUtil.login(driver, baseUrl, webApp);
}
 
Example 5
Source File: ESStoreAssetOverrideExistingPageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
      super.init();
      driver = BrowserManager.getWebDriver();
      baseUrl = getWebAppURL();
      ESUtil.login(driver, baseUrl, webApp);
}
 
Example 6
Source File: ESXSSTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    baseHttpsUrl = getWebAppURLHttps();
}
 
Example 7
Source File: ESStoreOverriddenGlobalPageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    driver.get(baseUrl + "/" + STORE_APP);
}
 
Example 8
Source File: ESPublisherAssetOverridePartialTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
      super.init();
      driver = BrowserManager.getWebDriver();
      baseUrl = getWebAppURL();
      ESUtil.login(driver, baseUrl, webApp);
}
 
Example 9
Source File: ESBProxyDeleteTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath("artifacts/ESB/synapseconfig/proxyadmin/synapse.xml");
    driver = BrowserManager.getWebDriver();
    driver.get(getLoginURL());
}
 
Example 10
Source File: ESStoreSearchTopAssetsTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    driver.get(baseUrl + "/" + STORE_APP);
}
 
Example 11
Source File: ESStoreOverriddenGlobalPageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
      super.init();
      driver = BrowserManager.getWebDriver();
      baseUrl = getWebAppURL();
      ESUtil.login(driver, baseUrl, webApp);
}
 
Example 12
Source File: ESStoreAssetNewPageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
      super.init();
      driver = BrowserManager.getWebDriver();
      baseUrl = getWebAppURL();
      ESUtil.login(driver, baseUrl, webApp);
}
 
Example 13
Source File: ESPublisherAddedAssetTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, userInfo.getUserName(), userInfo.getPassword());
}
 
Example 14
Source File: ESStoreAnonHomePageTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    assetName = "Asset Recent";
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    wait = new WebDriverWait(driver,MAX_POLL_COUNT);
    currentUserName = userInfo.getUserName().split("@")[0];
    currentUserPwd = userInfo.getPassword();
    baseUrl = getWebAppURL();
    resourcePath = GADGET_REGISTRY_BASE_PATH + currentUserName + "/" + assetName + "/" + ASSET_VERSION;
    resourcePathSite = SITE_REGISTRY_BASE_PATH + currentUserName + "/" + assetName + "/" + ASSET_VERSION;
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);

    //navigate to publisher and add and publish a new gadget to support sort by created time
    driver.get(baseUrl + PUBLISHER_URL);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE1, assetName, ASSET_VERSION, "", "", "");
    driver.findElementPoll(By.linkText(assetName),MAX_POLL_COUNT);
    driver.findElement(By.linkText(assetName)).click();
    AssetUtil.publishAssetToStore(driver, assetName);

    driver.get(baseUrl + PUBLISHER_URL);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE2, assetName, ASSET_VERSION, "", "", "");
    driver.findElementPoll(By.linkText(assetName),MAX_POLL_COUNT);
    driver.findElement(By.linkText(assetName)).click();
    AssetUtil.publishAssetToStore(driver, assetName);


    driver.get(baseUrl + PUBLISHER_LOGOUT_URL);
    //navigate to store and wait for the new gadget to be visible in store
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    driver.findElementPoll(By.linkText(assetName), MAX_POLL_COUNT);

}
 
Example 15
Source File: ESPublishToStore.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    driver.get(baseUrl + PUBLISHER_GADGET_LIST_PAGE);
    providerName = userInfo.getUserName();
    resourcePath = GADGET_REGISTRY_BASE_PATH + providerName + "/" + ASSET_NAME + "/" + ASSET_VERSION;
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL,userInfo.getUserName(),
            userInfo.getPassword());
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, userInfo.getUserName(), userInfo.getPassword());
}
 
Example 16
Source File: ESLoginTestCase.java    From product-es with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    driver.get(getLoginURL());
}
 
Example 17
Source File: InitialErrorTest.java    From product-iots with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setup() throws XPathExpressionException, XMLStreamException, IOException {
    super.init();
    driver = BrowserManager.getWebDriver();
    driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH);
}
 
Example 18
Source File: XssCsrfSkipPatternsTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
@Test(groups = "wso2.is", description = "verify XSS prevention exist")
public void testXSSPrevention() throws Exception {

    LogViewerClient logViewerClient =  new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    driver = BrowserManager.getWebDriver();
    driver.get(getLoginURL());

    driver.findElement(By.id("txtUserName")).clear();
    driver.findElement(By.id("txtUserName")).sendKeys("admin");
    driver.findElement(By.id("txtPassword")).clear();
    driver.findElement(By.id("txtPassword")).sendKeys("admin");
    driver.findElement(By.cssSelector("input.button")).click();
    driver.findElement(By.cssSelector("#menu-panel-button3 > span")).click();
    driver.findElement(By.linkText("Add New Tenant")).click();
    driver.findElement(By.id("domain")).clear();
    driver.findElement(By.id("domain")).sendKeys("domain1.com");
    driver.findElement(By.id("admin-firstname")).clear();
    driver.findElement(By.id("admin-firstname")).sendKeys("admin");
    driver.findElement(By.id("admin-lastname")).clear();
    driver.findElement(By.id("admin-lastname")).sendKeys("admin");
    driver.findElement(By.id("admin")).clear();
    driver.findElement(By.id("admin")).sendKeys("admin");
    driver.findElement(By.id("admin-password")).clear();
    driver.findElement(By.id("admin-password")).sendKeys("Test#1234");
    driver.findElement(By.id("admin-password-repeat")).clear();
    driver.findElement(By.id("admin-password-repeat")).sendKeys("Test#1234");
    driver.findElement(By.id("admin-email")).clear();
    driver.findElement(By.id("admin-email")).sendKeys("[email protected]");
    driver.findElement(By.cssSelector("input.button")).click();
    driver.findElement(By.cssSelector("button[type=\"button\"]")).click();
    driver.findElement(By.linkText("Sign-out")).click();
    driver.findElement(By.id("txtUserName")).clear();
    driver.findElement(By.id("txtUserName")).sendKeys("[email protected]");
    driver.findElement(By.id("txtPassword")).clear();
    driver.findElement(By.id("txtPassword")).sendKeys("Test#1234");
    driver.findElement(By.cssSelector("input.button")).click();
    driver.findElement(By.cssSelector("span")).click();
    driver.findElement(By.linkText("Templates")).click();

    driver.findElement(By.linkText("Add Sequence Template")).click();
    driver.findElement(By.linkText("switch to source view")).click();
    driver.switchTo().frame("frame_sequence_source");
    driver.findElement(By.id("textarea")).click();
    driver.findElement(By.id("textarea")).click();
    driver.findElement(By.id("textarea")).clear();
    driver.findElement(By.id("textarea")).sendKeys(
            "<template xmlns=\"http://ws.apache.org/ns/synapse\" name=\"test7\">\n"
                + "<sequence>\n"
                    + "<script language=\"js\"/>\n"
                + "</sequence>\n"
            + " </template>");
    driver.switchTo().defaultContent();
    driver.findElement(By.cssSelector("input.button")).click();
    Assert.assertTrue(
            !logViewerClient.getAllRemoteSystemLogs()[0].getMessage().contains("Could not handle request"),
            "XSS attack prevention failed.");
}
 
Example 19
Source File: ESStoreTUAccessInvalidTenantTestCase.java    From product-es with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
}
 
Example 20
Source File: MBIntegrationUiBaseTest.java    From product-ei with Apache License 2.0 3 votes vote down vote up
/**
 * Initializes the automation context, login client, session cookie and the backend url by a {@link org.wso2
 * .carbon.automation.engine.context.TestUserMode}.
 *
 * @param testUserMode The testing user mode.
 * @throws XPathExpressionException
 * @throws AutomationUtilException
 * @throws MalformedURLException
 */
protected void init(TestUserMode testUserMode) throws XPathExpressionException, AutomationUtilException,
                                                                                            MalformedURLException {
    mbServer = new AutomationContext("MB", testUserMode);
    loginLogoutClient = new LoginLogoutClient(mbServer);
    sessionCookie = loginLogoutClient.login();
    backendURL = mbServer.getContextUrls().getBackEndUrl();
    this.driver = BrowserManager.getWebDriver();
}