@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.notification", description = "Testing mails for asset update event", dependsOnMethods = "testLCNotification") public void testUpdateNotification() throws Exception { // Update gadget and check lC state change notification driver.get(baseUrl + PUBLISHER_GADGET_LIST_PAGE); AssetUtil.updateAsset(driver, baseUrl, ASSET_TYPE, assetName, ASSET_DESCRIPTION); driver.get(baseUrl + PUBLISHER_GADGET_LIST_PAGE); // read email using smtp boolean hasMail = ESUtil.containsEmail(smtpPropertyLocation, EMAIL_PWD, EMAIL, updateNotificationSubject); assertTrue(hasMail, "Asset Update Notification failed for user:" + currentUserName); }