public void MyTestCleanup() { //Create the Report Output File var usernameToPass = ExcelUtilityLibrary.ReadData(4, "Username"); var passwordToPass = ExcelUtilityLibrary.ReadData(4, "Password"); var impersonationContext = new AUSClaims_Prod_NodeOneRefresh.Impersonate.WrappedImpersonationContext("RGARE", usernameToPass, passwordToPass); impersonationContext.Enter(); Reports.CreateCSVOutputFile(TestContext.TestName.ToString(), TestContext.CurrentTestOutcome.ToString(), testDescription, expectedResult, evidenceType, testContextInstance.TestResultsDirectory.ToString(), executedBy); impersonationContext.Leave(); //Send Email to Imaging Team var fromAddress = new MailAddress("*****@*****.**"); var toAddress = new MailAddress("*****@*****.**"); var Todaysdate = DateTime.Now; const string fromPassword = "******"; var subject = "The Application Checkout Test: " + this.testContextInstance.TestName.ToString() + " Has " + this.testContextInstance.CurrentTestOutcome.ToString(); var body = this.testContextInstance.TestName.ToString() + " Has Been Completed on: " + Todaysdate + "\n The log files results can be found at: " + this.testContextInstance.TestResultsDirectory; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } }
public void AUSClaims_Prod_NodeOne_DailyRefresh() { //username and Password Retrevial from Excel ExcelUtilityLibrary.PopulateInCollection(@"\\\\rgare\\rgaappcommon\\OPNTXTIMG\\common\\Mike\\Passwords for Coded UI\\Application Checkout\\AdminCredentials.xlsx"); //Variable to Set Which Browser to Use BrowserWindow browserWindow = new BrowserWindow(); var BrowserToUse = "iexplore"; //Open the Browser Window Process browserInPrivate = new Process(); browserInPrivate.StartInfo.FileName = BrowserToUse; browserInPrivate.StartInfo.Arguments = UrlUnderTest_AUSClaims_Prod_NodeOne; browserInPrivate.StartInfo.WindowStyle = ProcessWindowStyle.Normal; browserInPrivate.Start(); //Login to the AUS Claims Node One Admin Page WindowsSecurityWindow windowsSecurityWindow = new WindowsSecurityWindow(); windowsSecurityWindow.Authenicate(ExcelUtilityLibrary.ReadData(1, "Username"), ExcelUtilityLibrary.ReadData(1, "Password")); //Page Class Definitions AUSClaims_Prod_AdminPage_NodeOne AdminPage_NodeOne = new AUSClaims_Prod_AdminPage_NodeOne(browserWindow); AUSClaims_Prod_CachePage_NodeOne CachePage_NodeOne = new AUSClaims_Prod_CachePage_NodeOne(browserWindow); AUSClaims_Prod_ConfigPage_NodeOne ConfigPage_NodeOne = new AUSClaims_Prod_ConfigPage_NodeOne(browserWindow); AUSClaims_Prod_CustomConfigPage_NodeOne CustomConfigPage_NodeOne = new AUSClaims_Prod_CustomConfigPage_NodeOne(browserWindow); AUSClaims_Prod_ProcessPage_NodeOne ProcessPage_NodeOne = new AUSClaims_Prod_ProcessPage_NodeOne(browserWindow); AUSClaims_Prod_ServersPage_NodeOne ServersPage_NodeOne = new AUSClaims_Prod_ServersPage_NodeOne(browserWindow); //Select the Cache Link to Navigate to the Cache Page on Node One var nodeOneCacheLink = AdminPage_NodeOne.CacheLink; Mouse.Click(nodeOneCacheLink); //Click the Clear All Caches Button on Node One var clickClearAllCachesButton = CachePage_NodeOne.clearAllCaches_Button; Mouse.Click(clickClearAllCachesButton); //Select the Process Link to Navigate to the Process Page on Node One var nodeOneProcessLink = AdminPage_NodeOne.ProcessLink; Mouse.Click(nodeOneProcessLink); //Stop the AUSClaimAssessment Process on Node One var NodeOne_AusClaimAssessment_Stop = ProcessPage_NodeOne.AUSClaimAssessmentProcessStop; Mouse.Click(NodeOne_AusClaimAssessment_Stop); //Start the AUSClaimAssessment Process on Node One var NodeOne_AUSClaimAssessment_Start = ProcessPage_NodeOne.AUSClaimAssessmentProcessStart; Mouse.Click(NodeOne_AUSClaimAssessment_Start); //Assert the AUSClaimAssessment Process has a status of Running on Node One var AUSClaimAssessmentStatusControl = ProcessPage_NodeOne.AUSClaimAssessmentProcessStatus; string returnedAUSClaimAssessmentStatus = AUSClaimAssessmentStatusControl.GetProperty("InnerText").ToString(); string expectedAUSClaimAssessmentStatus = "Running"; if (returnedAUSClaimAssessmentStatus == expectedAUSClaimAssessmentStatus) { Equals(true, true); } else { Equals(true, false); } //Stop the AUSClaimDocument Process on Node One var NodeOne_AUSClaimDocument_Stop = ProcessPage_NodeOne.AUSClaimDocumentProcessStop; Mouse.Click(NodeOne_AUSClaimDocument_Stop); //Start the AUSClaimDocument Process on Node One var NodeOne_AUSClaimDocument_Start = ProcessPage_NodeOne.AUSClaimDocumentProcessStart; Mouse.Click(NodeOne_AUSClaimDocument_Start); //Assert the AUSClaimDocument Process has a status of Running on Node One var AUSClaimDocumentStatusControl = ProcessPage_NodeOne.AUSClaimDocumentProcessStatus; string returnedAUSClaimDocumentStatus = AUSClaimDocumentStatusControl.GetProperty("InnerText").ToString(); string expectedAUSClaimDocumentStatus = "Running"; if (returnedAUSClaimDocumentStatus == expectedAUSClaimDocumentStatus) { Equals(true, true); } else { Equals(true, false); } //Stop the AUSAssessmentTasks Process on Node One var NodeOne_AUSClaimAssessmentTasks_Stop = ProcessPage_NodeOne.AUSAssessmentTasksProcessStop; Mouse.Click(NodeOne_AUSClaimAssessmentTasks_Stop); //Start the AUSAssessmentTasks Process on Node One var NodeOne_AUSClaimAssessmentTasks_Start = ProcessPage_NodeOne.AUSAssessmentTasksProcessStart; Mouse.Click(NodeOne_AUSClaimAssessmentTasks_Start); //Assert the AUSAssessmentTasks Process has a status of Running on Node One var AUSAssessmentTasksStatusControl = ProcessPage_NodeOne.AUSAssessmentTasksProcessStatus; string returnedAUSAssessmentTasksStatus = AUSAssessmentTasksStatusControl.GetProperty("InnerText").ToString(); string expectedAUSAssessmentTasksStatus = "Running"; if (returnedAUSAssessmentTasksStatus == expectedAUSAssessmentTasksStatus) { Equals(true, true); } else { Equals(true, false); } //Stop the PendBatchProcess on Node One var NodeOne_PendBatchProcess_Stop = ProcessPage_NodeOne.PendBatchProcessStop; Mouse.Click(NodeOne_PendBatchProcess_Stop); //Start the PendBatchProcess on Node One var NodeOne_PendBatchProcess_Start = ProcessPage_NodeOne.PendBatchProcessStart; Mouse.Click(NodeOne_PendBatchProcess_Start); //Assert the PendBatchProcess has a status of Running on Node One var PendBatchProcessStatusControl = ProcessPage_NodeOne.PendBatchProcessStatus; string returnedPendBatchProcessStatus = PendBatchProcessStatusControl.GetProperty("InnerText").ToString(); string expectedPendBatchProcessStatus = "Running"; if (returnedPendBatchProcessStatus == expectedPendBatchProcessStatus) { Equals(true, true); } else { Equals(true, false); } //Stop the ReminderBatchJob Process on Node One var NodeOne_ReminderBatchJob_Stop = ProcessPage_NodeOne.ReminderBatchJobProcessStop; Mouse.Click(NodeOne_ReminderBatchJob_Stop); //Start the ReminderBatchJob Process on Node One var NodeOne_ReminderBatchJob_Start = ProcessPage_NodeOne.ReminderBatchJobProcessStart; Mouse.Click(NodeOne_ReminderBatchJob_Start); //Assert the ReminderBatchJob Process has a status of Running on Node One var ReminderBatchJobStatusControl = ProcessPage_NodeOne.ReminderBatchJobProcessStatus; string returnedReminderBatchJobStatus = ReminderBatchJobStatusControl.GetProperty("InnerText").ToString(); string expectedReminderBatchJobStatus = "Running"; if (returnedReminderBatchJobStatus == expectedReminderBatchJobStatus) { Equals(true, true); } else { Equals(true, false); } //Select the Servers Link to Navigate to the Servers Page on Node One var select_ServersLink = AdminPage_NodeOne.ServersLink; Mouse.Click(select_ServersLink); //Verify the Port Two Label Displays and Grab the Inner Text var PortTwoLabelControl = ServersPage_NodeOne.ServerTwoPortMenu; string returnedPortTwoLabelValue = null; if (PortTwoLabelControl.Exists) { returnedPortTwoLabelValue = PortTwoLabelControl.GetProperty("InnerText").ToString(); } else { this.TestContext.WriteLine("The Port Two Label Control Wasn't Found"); Assert.AreEqual(true, false); } //Select the Configuration Link to Navigate to the Configuration Page on Node One var select_ConfigurationLink = AdminPage_NodeOne.ConfigurationLink; Mouse.Click(select_ConfigurationLink); //Select The Action Dropdown on the Configuration Page on Node One var select_ActionMenu = ConfigPage_NodeOne.ActionsDropdown; Mouse.Click(select_ActionMenu); //Select the Custom Link in the Actions Menu on Node One var select_CustomLink = ConfigPage_NodeOne.CustomLink; Mouse.Click(select_CustomLink); //Get the Value in the Sole Capture Server Custom Property string returnedSoleCaptureServerValue = null; var SoleCaptureServerLabelControl = CustomConfigPage_NodeOne.SoleCaptureServerValueField; if (SoleCaptureServerLabelControl.Exists) { returnedSoleCaptureServerValue = SoleCaptureServerLabelControl.GetProperty("ValueAttribute").ToString(); Assert.AreEqual(true, true); } else { this.testContextInstance.WriteLine("The Sole Capture Custom Property Field Couldn't Be Located on Node One"); Assert.AreEqual(true, false); } //Assert the Port Two Value from Server Page and the Sole Capture Server Custom Property are Equal if (returnedPortTwoLabelValue == returnedSoleCaptureServerValue) { this.testContextInstance.WriteLine("The Values are Equal -- Sole Capture Server is Configured Correctly"); Assert.AreEqual(true, true); } else { //Select the Sole Capture Server Field var select_SoleCaptureServerField = CustomConfigPage_NodeOne.SoleCaptureServerValueField; Mouse.Click(select_SoleCaptureServerField); //Clear out the Current Value in the Sole Capture Server Field for (int j = 0; j < 40; j++) { Keyboard.SendKeys("{BACK}"); } Keyboard.SendKeys(returnedPortTwoLabelValue); Keyboard.SendKeys("{Enter}"); //Verify the Value in the Sole Capture Server Field has Changed string returnedSoleCaptureValue_AfterUpdate = null; var SoleCaptureValueFieldControl_AfterUpdate = CustomConfigPage_NodeOne.SoleCaptureServerValueField; if (SoleCaptureValueFieldControl_AfterUpdate.Exists) { returnedSoleCaptureValue_AfterUpdate = SoleCaptureValueFieldControl_AfterUpdate.GetProperty("ValueAttribute").ToString(); if (returnedSoleCaptureValue_AfterUpdate == returnedPortTwoLabelValue) { this.testContextInstance.WriteLine("The Sole Capture Server Property was updated and is now configured correctly."); Assert.AreEqual(true, true); } else { this.testContextInstance.WriteLine("The Sole Capture Server Custom Property wasn't Updated Correctly"); Assert.AreEqual(true, false); } } else { this.testContextInstance.WriteLine("The Sole Capture Custom Property Field Couldn't Be Located on Node One after the Update"); Assert.AreEqual(true, false); } } //Close the Browser Window browserWindow.Close(); }