public void DeleteSentMessagesFrom(string email) { IWebElement deleteSelectedMessagesButton; IList <IWebElement> checkboxes = GetAllMessageCheckbox(); int countOfMessages; fluentWait = FluentWait.GetFluentWait(this.currentDriver); countOfMessages = GetMessagesFrom(email).Count; for (int i = 0; i < countOfMessages; i++) { checkboxes.ElementAt(i).Click(); } try { IWebElement windowsValidationAppearance; deleteSelectedMessagesButton = fluentWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='T-I J-J5-Ji nX T-I-ax7 T-I-Js-Gs mA']"))); deleteSelectedMessagesButton.Click(); windowsValidationAppearance = fluentWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='vh']/span[@class='aT']/span[@class='bAq'][contains (text(),' moved to Bin.')]"))); } catch (OpenQA.Selenium.WebDriverTimeoutException e) { Console.WriteLine(e.Message + $"\nMessages from {email} to delete not found"); } }
public void SentEmptyMessage() { fluentWait = FluentWait.GetFluentWait(this.currentDriver); OpenNewMessageForm(); SentMessageButton(); }
public void SetThemeOfMessage(string themeOfMessage) { IWebElement theme; fluentWait = FluentWait.GetFluentWait(this.currentDriver); theme = fluentWait.Until(x => x.FindElement(By.Name("subjectbox"))); theme.SendKeys(themeOfMessage); }
public void OpenNewMessageForm() { IWebElement writeMessageButton; fluentWait = FluentWait.GetFluentWait(this.currentDriver); writeMessageButton = fluentWait.Until(x => x.FindElement(By.XPath("//div[@class='T-I J-J5-Ji T-I-KE L3']"))); writeMessageButton.Click(); }
public void SetMessageBody(string messageText) { IWebElement bodyOfMessage; fluentWait = FluentWait.GetFluentWait(this.currentDriver); bodyOfMessage = fluentWait.Until(x => x.FindElement(By.XPath("//td[@class='Ap']/div[2]/div[1]"))); bodyOfMessage.SendKeys(messageText); }
public void OpenGetAddonsForm() { IWebElement getAddOns; fluentWait = FluentWait.GetFluentWait(this.currentDriver); getAddOns = fluentWait.Until(x => x.FindElement(By.XPath("//div[@id='p2DdMb']//div[@class='aT5-aOt-I-JX-Jw']"))); getAddOns.Click(); }
public IList <IWebElement> GetAllMessageCheckbox() { IList <IWebElement> checkboxes; fluentWait = FluentWait.GetFluentWait(this.currentDriver); checkboxes = fluentWait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.XPath("//div[@class='oZ-jc T-Jo J-J5-Ji ']"))); return(checkboxes); }
public void DeleteSentMessagesFrom_DeleteAllMessagesFromGivenEmail() { fluentWait = FluentWait.GetFluentWait(this.currentDriver); gmailController.DeleteSentMessagesFrom(this.firstMail); bool isNotFoundMessage = fluentWait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath($"//div[2]/span[@class='bA4']/span[@email='{this.firstMail}']"))); Assert.IsTrue(isNotFoundMessage); }
public void SentMessage(string email, string themeOfMessage, string messageText) { fluentWait = FluentWait.GetFluentWait(this.currentDriver); OpenNewMessageForm(); SetRecipientOfMessage(email); SetThemeOfMessage(themeOfMessage); SetMessageBody(messageText); SentMessageButton(); }
public void StartGmail(string mail, string password) { string webSiteUrl = "https://gmail.com/"; fluentWait = FluentWait.GetFluentWait(this.currentDriver); this.currentDriver.Navigate().GoToUrl(webSiteUrl); SetMailInLogInWindow(mail); SetPasswordInLogInWindow(password); }
public void QuitFromAccount() { fluentWait = FluentWait.GetFluentWait(this.currentDriver); string currentURL = "https://accounts.google.com/ServiceLogin/signinchooser?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin"; gmailController.QuitFromAccount(); bool isUrlContainsCurrentUrl = fluentWait.Until(ExpectedConditions.UrlContains(currentURL)); Assert.IsTrue(isUrlContainsCurrentUrl); }
public void SentEmptyMessage_IsDisplayedErrorWindow() { IWebElement errorForm; fluentWait = FluentWait.GetFluentWait(this.currentDriver); gmailController.SentEmptyMessage(); errorForm = fluentWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='Kj-JD-K7 Kj-JD-K7-bsT']"))); Assert.IsTrue(errorForm.Displayed); }
public void SerachMessageByTheme(string themeOfMessage) { IWebElement searchInMailField; IWebElement searchButton; fluentWait = FluentWait.GetFluentWait(this.currentDriver); searchInMailField = fluentWait.Until(x => x.FindElement(By.XPath("//input[@placeholder='Search mail']"))); searchInMailField.SendKeys(themeOfMessage); searchButton = fluentWait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@aria-label='Search Mail']"))); searchButton.Click(); }
public void QuitFromAccount() { IWebElement account; IWebElement logOutFromAccount; fluentWait = FluentWait.GetFluentWait(this.currentDriver); account = fluentWait.Until(x => x.FindElement(By.XPath("//a[@class='gb_D gb_Fa gb_i']"))); account.Click(); logOutFromAccount = fluentWait.Until(x => x.FindElement(By.XPath("//a[@id='gb_71']"))); logOutFromAccount.Click(); }
public void SentMessage() { themeOfMessage = "Test method SentMessage"; messageBody = "sent a message to the method being tested SentMessage()"; fluentWait = FluentWait.GetFluentWait(this.currentDriver); gmailController.SentMessage(this.firstMail, themeOfMessage, messageBody); foundMessage = fluentWait.Until(x => x.FindElement(By.XPath($"//span[contains(text(),'{themeOfMessage}')]"))); Assert.IsNotNull(foundMessage); }
public void SearchMessageByTheme() { IWebElement foundMessage; string themeOfMessage = "Xinuos"; fluentWait = FluentWait.GetFluentWait(currentDriver); gmailController.SerachMessageByTheme(themeOfMessage); foundMessage = fluentWait.Until(ExpectedConditions.ElementExists(By.XPath("//span[contains(text(),'Xinuos Inc.')]"))); Assert.IsNotNull(foundMessage); }
public void StartGmail_LogIn() { IWebElement accountButton; IWebElement currentAccountMailOnPage; string currentMail = gmailController.GetFirstMail(); fluentWait = FluentWait.GetFluentWait(this.currentDriver); accountButton = fluentWait.Until(x => x.FindElement(By.XPath("//a[@class='gb_D gb_Fa gb_i']"))); accountButton.Click(); currentAccountMailOnPage = fluentWait.Until(x => x.FindElement(By.XPath("//div[@class='gb_jb']"))); Assert.IsTrue(currentAccountMailOnPage.Text == currentMail); }
public void SentMessageWithAttachedFile_SentCorrectFileExtension() { themeOfMessage = "Message with attached file"; messageBody = "sent a message to the method being tested SentMessageWithAttachedFile()"; string fileName = "Account.txt"; string path = gmailController.GetFilePath(fileName); fluentWait = FluentWait.GetFluentWait(this.currentDriver); gmailController.SentMessageWithAttachedFile(this.firstMail, themeOfMessage, messageBody, path); foundMessage = fluentWait.Until(ExpectedConditions.ElementIsVisible(By.XPath($"//span[contains(text(),'{fileName}')]"))); Assert.IsNotNull(foundMessage); }
public void GetAddOns_IsVisible() { IWebElement addOnsFrame; IWebElement addOnsFrameTitle; fluentWait = FluentWait.GetFluentWait(currentDriver); gmailController.OpenGetAddonsForm(); addOnsFrame = fluentWait.Until(x => x.FindElement(By.XPath("//div[@id='glass-content']/iframe"))); currentDriver.SwitchTo().Frame(addOnsFrame); addOnsFrameTitle = fluentWait.Until(x => x.FindElement(By.XPath("//span[@class='yQsxXc']"))); Assert.IsTrue(addOnsFrameTitle.Displayed); }
public void SentMessageWithAttachedFile_SentIncorrectFileExtension() { themeOfMessage = "Message with incorrect file extension"; messageBody = "sent a message to the method being tested SentMessageWithAttachedFile() with incorrect file extension"; string fileName = "iTechArt.7z"; string path = gmailController.GetFilePath(fileName); fluentWait = FluentWait.GetFluentWait(this.currentDriver); gmailController.SentMessageWithAttachedFile(this.firstMail, themeOfMessage, messageBody, path); IAlert alert = fluentWait.Until(ExpectedConditions.AlertIsPresent()); alert.Accept(); foundMessage = fluentWait.Until(x => x.FindElement(By.XPath($"//span[contains(text(),'{themeOfMessage}')]"))); Assert.IsNotNull(foundMessage); }
public IList <IWebElement> GetMessagesFrom(string email) { List <IWebElement> listOfFoundMessages = new List <IWebElement>(); IList <IWebElement> tempFoundMessages; try { fluentWait = FluentWait.GetFluentWait(this.currentDriver); tempFoundMessages = fluentWait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.XPath($"//div[2]/span[@class='bA4']/span[@email='{email}']"))); foreach (IWebElement message in tempFoundMessages) { listOfFoundMessages.Add(message); } return(listOfFoundMessages); } catch (OpenQA.Selenium.WebDriverTimeoutException e) { Console.WriteLine(e.Message + $"\nMessages from {email} not found"); return(listOfFoundMessages); } }