/// <summary> /// Function to verify the redirection url. /// Test case for checking Quick Web Access. /// </summary> /// <param name="version">build version</param> /// <param name="requiredProcessName">required Process Name</param> /// <param name="option">sussi local</param> public void VerifyRedirectionURL(string version, string requiredProcessName, string option) { string locale = option; try { bool executeTest = false; try { //// Get version name from MessagesBuildSanitySmokeToolBL.resx resource file and split it. Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgInitializeVerifyRedirectionTest, Logger.CommentType.Message); string[] versionCollection = MessagesBuildSanitySmokeToolBL.VersionArray.Split(','); string[] searchVersionStr = Array.FindAll(versionCollection, s => s.Equals(version)); if (version.Equals(searchVersionStr[0])) { executeTest = true; } } catch (Exception) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.LowerVersion, Logger.CommentType.Message); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgSkipQuickWebAccess, Logger.CommentType.Message); } if (executeTest) { this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); //// Get Bing Address and verify weather it is as per requirements this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "Name", "Main Toolbar"); this.mauiToolbar = this.myControls.Get_MauiToolBar(this.mauiWindow); Maui.Core.ActiveAccessibility toolBarControl = this.mauiToolbar.AccessibleObject.Children[2]; toolBarControl.Click(); Thread.Sleep(5000); string redirectionURL = this.mauiToolbar.AccessibleObject.Children[0].Children[3].Description; Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNewBrowserWindowWithoutNavBarAndDashboard, Logger.CommentType.Message); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgDisplayofLandingPage, Logger.CommentType.Message); switch (locale) { case "ENUS : DialUp": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "ENUS : Premium": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "DE-DE": if (redirectionURL.Contains("de-DE") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "FR-FR": if (redirectionURL.Contains("fr-FR") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "ES-ES": if (redirectionURL.Contains("es-ES") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "FR-CA": if (redirectionURL.Contains("fr-CA") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "ES-MX": if (redirectionURL.Contains("es-MX") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } break; case "EN-GB": if (redirectionURL.Contains("en-GB") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "EN-AU": if (redirectionURL.Contains("en-AU") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } break; case "EN-CA": if (redirectionURL.Contains("en-CA") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "BC01 EN-CA": if (redirectionURL.Contains("en-CA") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "BC01 FR-CA": if (redirectionURL.Contains("fr-CA") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "Q001": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "Q002": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "VZ01": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "VZ02": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; case "DELL": if (redirectionURL.Contains("en-US") && redirectionURL.Contains("bing")) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgNavigationSuccessful, Logger.CommentType.Pass); } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgRedirectionUrlVeriFailed, Logger.CommentType.Fail); } break; } } else { Logger.AddComment(MessagesBuildSanitySmokeToolBL.LowerVersion, Logger.CommentType.Message); } } catch (Exception) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgBingAddressNotFetched, Logger.CommentType.Fail); } }
/// <summary> /// Function to compose and send mail /// Test case for composemail. /// </summary> /// <param name="requiredProcessName">required process name</param> /// <param name="accountEmail">account email</param> /// <param name="market">sussi locale</param> public void WriteandSendMail(string requiredProcessName, string accountEmail, string market) { System.Threading.Thread.Sleep(2000); try { //// Function to get Message icon. string iconSelected = this.GetClickableIcon(market); //// Select message icon from navigation bar this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "Name", "Main Toolbar"); this.mauiToolbar = this.myControls.Get_MauiToolBar(this.mauiWindow); try { for (int i = 0; i < this.mauiToolbar.AccessibleObject.ChildCount; i++) { string searchMailIcon = this.mauiToolbar.AccessibleObject.Children[i].Name; //// Search the message icon if (searchMailIcon.Contains(iconSelected)) { //// Click the selected message icon. Maui.Core.ActiveAccessibility mailControl = this.mauiToolbar.AccessibleObject.Children[i]; mailControl.Click(); } } } catch (Exception) { Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgMailButtonNotPresent, Logger.CommentType.Message); } Thread.Sleep(5000); try { //// Check window this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "AutomationId", "7"); this.mauiControl = this.myControls.Get_MauiControl(this.mauiWindow); this.mauiControl.Click(); } catch (Exception) { //// Do nothing } Thread.Sleep(1000); try { //// Junk email filter this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "ClassName", "DirectUIHWND"); this.mauiWindow.Extended.AccessibleObject.Children[7].Click(); } catch (Exception) { //// Do nothing } Thread.Sleep(1000); //// Select and click the create message button. this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "Name", "Main Toolbar"); this.mauiToolbar = this.myControls.Get_MauiToolBar(this.mauiWindow); Maui.Core.ActiveAccessibility writeMessageControl = this.mauiToolbar.AccessibleObject.Children[0].Children[0]; writeMessageControl.Click(); Thread.Sleep(8000); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MsgSendMailDialogue, Logger.CommentType.Message); //// Get handle Id of compose mail dialogue box. this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); //// Fill To address this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "AutomationId", "1001"); this.mauiTextBox = this.myControls.Get_MauiTextBox(this.mauiWindow); this.mauiTextBox.Text = accountEmail + MessagesBuildSanitySmokeToolBL.msn; Thread.Sleep(2000); //// Enter Subject Line this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "AutomationId", "1004"); this.mauiTextBox = this.myControls.Get_MauiTextBox(this.mauiWindow); this.mauiTextBox.Text = MessagesBuildSanitySmokeToolBL.MsgSubjectLine; Thread.Sleep(5000); //// Click on send message button. this.msnWindowHandleId = this.objExecuteMSI.Get_WindowHandle(requiredProcessName); this.mauiWindow = this.myWindow.Get_WindowToSpecificControl(this.msnWindowHandleId, "Name", "Main Toolbar"); this.mauiToolbar = this.myControls.Get_MauiToolBar(this.mauiWindow); Maui.Core.ActiveAccessibility sendMessageControl = this.mauiToolbar.AccessibleObject.Children[0].Children[0]; sendMessageControl.Click(); Thread.Sleep(3000); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MessageSuccessfullySend, Logger.CommentType.Pass); } catch (BuildSanityBusinessLogicException bex) { Logger.AddComment(bex.Message, Logger.CommentType.Message); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MessageNotSuccessfullySend, Logger.CommentType.Fail); } catch (Exception ex) { Logger.AddComment(ex.Message, Logger.CommentType.Message); Logger.AddComment(MessagesBuildSanitySmokeToolBL.MessageNotSuccessfullySend, Logger.CommentType.Fail); } }