@BeforeClass(alwaysRun = true)
  public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    baseUrl = getStorePublisherUrl();
    AutomationContext automationContext =
        new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.TENANT_ADMIN);
    adminUserName = automationContext.getContextTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getContextTenant().getTenantAdmin().getPassword();
    String resourceLocation = getResourceLocation();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient =
        new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    providerName = currentUserName.split("@")[0];
    resourcePath = GADGET_REGISTRY_BASE_PATH + providerName + "/" + assetName + "/" + VERSION;
    LCNotificationSubject += resourcePath;
    updateNotificationSubject += resourcePath;
    smtpPropertyLocation = resourceLocation + SMTP_PROPERTY_FILE;

    // Update user profiles through Admin console
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
    ESUtil.setupUserProfile(driver, baseUrl, currentUserName, FIRST_NAME, LAST_NAME, EMAIL);
    // login to publisher & add a new gadget
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, assetName, VERSION, "", "", "");
  }
コード例 #2
0
  @BeforeClass(alwaysRun = true)
  public void setUp() throws Exception {
    super.init();
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    wait = new WebDriverWait(driver, MAX_WAIT_TIME);

    driver.get(baseUrl + STORE_URL);
    driver.findElement(By.id("btn-register")).click();
    driver.findElement(By.id("reg-username")).clear();
    driver.findElement(By.id("reg-username")).sendKeys(USER);
    driver.findElement(By.id("reg-password")).clear();
    driver.findElement(By.id("reg-password")).sendKeys(PASSWORD);
    driver.findElement(By.id("reg-password2")).clear();
    driver.findElement(By.id("reg-password2")).sendKeys(PASSWORD);
    driver.findElement(By.name("reg-email")).clear();
    driver.findElement(By.name("reg-email")).sendKeys(EMAIL);
    driver.findElement(By.name("reg-first-name")).clear();
    driver.findElement(By.name("reg-first-name")).sendKeys(FIRST_NAME);
    driver.findElement(By.name("reg-last-name")).clear();
    driver.findElement(By.name("reg-last-name")).sendKeys(LAST_NAME);
    driver.findElement(By.id("registrationSubmit")).click();
  }
 @BeforeClass(alwaysRun = true, enabled = false)
 public void setUp() throws Exception {
   super.init();
   driver = BrowserManager.getWebDriver();
   driver.get(getLoginURL());
   LoginPage test = new LoginPage(driver);
   test.loginAs(userInfo.getUserName(), userInfo.getPassword());
 }
  @Test(
      groups = "wso2.as",
      description = "Access the spring application",
      dependsOnMethods = "webApplicationDeploymentTest",
      enabled = false)
  public void invokeSpringApplicationTest() throws Exception {
    WebDriver driverForApp = null;
    try {
      driverForApp = BrowserManager.getWebDriver();
      // Go  to application
      driverForApp.get(webAppURL + "/booking-faces/spring/intro");
      driverForApp.findElement(By.linkText("Start your Spring Travel experience")).click();

      // searching hotels to reserve
      driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:searchString\"]")).sendKeys("Con");
      driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:findHotels\"]")).click();

      // view hotel information
      driverForApp.findElement(By.xpath("//*[@id=\"j_idt12:hotels:0:viewHotelLink\"]")).click();
      // go to book hotel
      driverForApp.findElement(By.xpath("//*[@id=\"hotel:book\"]")).click();

      // providing user name and password
      driverForApp
          .findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[1]/input"))
          .sendKeys("keith");
      driverForApp
          .findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[2]/input"))
          .sendKeys("melbourne");
      // authenticating
      driverForApp
          .findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[4]/input"))
          .click();

      // booking hotel
      driverForApp.findElement(By.xpath("//*[@id=\"hotel:book\"]")).click();

      // providing payments information
      driverForApp
          .findElement(By.xpath("//*[@id=\"bookingForm:creditCard\"]"))
          .sendKeys("1234567890123456");
      driverForApp.findElement(By.xpath("//*[@id=\"bookingForm:creditCardName\"]")).sendKeys("xyz");

      // proceed transaction
      driverForApp.findElement(By.xpath("//*[@id=\"bookingForm:proceed\"]")).click();

      // confirm booking
      driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:confirm\"]")).click();

      // verify whether the hotel booked is in the booked hotel tabled
      Assert.assertEquals(
          driverForApp.findElement(By.xpath("//*[@id=\"bookings_header\"]")).getText(),
          "Your Hotel Bookings",
          "Booked Hotel table Not Found");

      // verify the hotel name is exist in the booked hotel table
      Assert.assertEquals(
          driverForApp
              .findElement(By.xpath("//*[@id=\"j_idt23:j_idt24_data\"]/tr/td[1]"))
              .getText(),
          "Conrad Miami\n" + "1395 Brickell Ave\n" + "Miami, FL",
          "Hotel Name mismatch");
    } finally {
      if (driverForApp != null) {
        driverForApp.quit();
      }
    }
  }
コード例 #5
0
 @BeforeClass(alwaysRun = true)
 public void setEnvironment() throws Exception {
   super.init();
   driver = BrowserManager.getWebDriver();
   driver.get(getLoginURL());
 }