@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, "", "", "");
  }
 @Test(groups = "wso2.es.common", description = "Testing password recovery through email")
 public void testPasswordRecoveryEmail() throws Exception {
   driver.get(baseUrl + STORE_URL);
   driver.findElement(By.id("btn-signin")).click();
   driver.findElement(By.linkText("Forgot your password?")).click();
   driver.findElement(By.id("username")).clear();
   driver.findElement(By.id("username")).sendKeys(USER);
   driver.findElement(By.id("validationSubmit")).click();
   String resourceLocation = getResourceLocation();
   smtpPropertyLocation = resourceLocation + SMTP_PROPERTY_FILE;
   // TODO:avoid waiting
   // waiting for email to receive
   Thread.sleep(10000);
   String message = ESUtil.readEmail(smtpPropertyLocation, EMAIL_PWD, EMAIL, RESET_MAIL_TITLE);
   String resetUrl = message.split("\r")[5].trim().substring("https://localhost:9443".length());
   driver.get(baseUrl + resetUrl);
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys(NEW_PASSWORD);
   driver.findElement(By.id("password2")).clear();
   driver.findElement(By.id("password2")).sendKeys(NEW_PASSWORD);
   driver.findElement(By.id("resetPassword")).click();
   ESUtil.login(driver, baseUrl, STORE_APP, USER, NEW_PASSWORD);
 }