[Fact] //Admin_7 public void AddBadgeToAccount() { try { string accountId; string badgeNumber; string actualBadgeNumber; accountId = TestData.GetData("TCAdmin4_UserAccountID"); badgeNumber = TestData.GetData("TCAdmin7_BadgeNumber"); AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger); AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger); AdminAccountsPage adminAccountPage = new AdminAccountsPage(TestProgressLogger); // login in admin adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1); // Navigate on Accounts page. admincommonfunctions.SelectAccountsMenu(); admincommonfunctions.SelectAccountsTab(); TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage); // Click on ViewAll and search by accountid and double click. adminAccountPage.ClickOnViewAll(driver); adminAccountPage.SearchByAccountID(driver, accountId); adminAccountPage.DoubleClickOnAccountName(driver, accountId); TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId)); // Add new badge. adminAccountPage.AddNewBadge(driver, badgeNumber); actualBadgeNumber = adminAccountPage.GetTextOfAccountBadges(driver); // Verify added badge. Assert.Equal(badgeNumber, actualBadgeNumber); TestProgressLogger.LogCheckPoint(string.Format(LogMessage.VerifiedBadgeAdded, accountId)); // Delete Added badge. adminAccountPage.DeleteAccountBadge(driver); adminAccountPage.ClickOnYesButton(driver); // Logout from admin. admincommonfunctions.UserMenuBtn(); adminfunctions.AdminLogOut(); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); TestProgressLogger.LogError(LogMessage.AddBadgeToAccountTestFailed, ex); throw; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace); TestProgressLogger.LogError(LogMessage.AddBadgeToAccountTestFailed, e); throw e; } finally { TestProgressLogger.EndTest(); } }