public void GmailSendEmailTest(string username1, string username2, string password, string expectedUser) { //Open gmail home page _driver.Url = "https://gmail.com"; //perform login as User1 GmailHomePage homePage = new GmailHomePage(_driver); homePage.Login(username1, password); //Send email to User2 var inboxPage = new InboxPage(_driver); inboxPage.WriteEmailButton.Click(); inboxPage.WriteEmailToEdit.SendKeys(username2); var subject = "Email sent to " + username2 + " at " + DateTime.Now.ToString("yyyyMMddHHmmssffff"); inboxPage.WriteEmailSubjectEdit.SendKeys(subject); inboxPage.WriteEmailSendButton.Click(); //Logout as User1 inboxPage.Logout(); //Perform login as User2 homePage.ProfileIdentifierSelect.Click(); _driver.WaitForElementDisplayed(By.XPath("//div[contains(text(),'Сменить аккаунт')]"), 5); homePage.ChangeAccountButton.Click(); homePage.Login(username2, password); //validate that email with the subject generated is available in the list of emails in the inbox of User2 }
public void Respond(int count, GmailHomePage page) { String subject = String.Format("Response to {0}", page.getSenderName(count)); String body = String.Format("Hi {0},\nI recieved your email at {1}", page.getSenderName(count), page.getSenderTime(count)); sendMail(page.getSenderEmail(count), page.getSenderName(count), "TestPass", subject, body); }
public void sendMailManual(String address, String subject, String body, GmailHomePage page) { ComposeWindow email = page.ClickCompose(); email.InputAddress(address); email.InputSubject(subject); email.InputContent(body); email.SendEmail(); }
public void GetLast10Emails() { GmailHomePage gmailHomePage = new GmailHomePage(myDriver); gmailHomePage.Open(); EmailsListPage emailsListPage = gmailHomePage.Login(); emailsListPage.GetEmailsByCSSSelector(10); }
public void LoginWithWrongCredentials() { GmailHomePage gmailHomePage = new GmailHomePage(myDriver); gmailHomePage.Open(); gmailHomePage.EnterLogin("abcdefgh"); gmailHomePage.ClickNextOnLogin(); //Is password field displayed Assert.IsTrue(gmailHomePage.IsPasswordFieldDisplayed(), "Login was incorrect, the password field is not displayed"); }
public void LoginToGmail() { GmailHomePage gmailHomePage = new GmailHomePage(myDriver); Logger.Get().Info("Open Gmail page"); gmailHomePage.Open(); Logger.Get().Info("Login to Gmail account"); EmailsListPage emailsListPage = gmailHomePage.Login(); //Is messages list displayed Assert.IsTrue(emailsListPage.IsMessagesListDisplayed(), "Messages list was not loaded"); }
public void Test_GmailLogin() { Driver.Navigate().GoToUrl("http://mail.google.com"); GmailHomePage GmailPage = new GmailHomePage(Driver); try { PageFactory.InitElements(Driver, GmailPage); GmailPage.LoginUser("*****@*****.**", "abcd"); } catch (Exception e) { System.Console.WriteLine("LoginUnsuccesful"); GmailPage.takescreenshot("LoginSuccesfulorNot.gif"); throw e; } }
public void GmailLoginTest(string username, string password, string expectedUser) { //Open gmail home page _driver.Url = "https://gmail.com"; //perform login GmailHomePage homePage = new GmailHomePage(_driver); homePage.Login(username, password); var inboxPage = new InboxPage(_driver); var ariaLabelText = inboxPage.AccountButton.GetAttribute("aria-label"); //when Inbox page is opened, validate that the correct user is signed in Assert.IsTrue(ariaLabelText.Contains(expectedUser), $"Aria label {ariaLabelText} does not contain expected text {expectedUser}"); Assert.IsTrue(ariaLabelText.Contains(username), $"Aria label {ariaLabelText} does not contain expected text {username}"); //take screenshot before the final check _driver.TakeScreenshot("GmailLoginTest.png"); }
static void Main(string[] args) { Console.WriteLine("Working"); ChromeOptions options = new ChromeOptions(); //options.AddArgument("--start-maximized"); /* * * * options.AddArgument("--headless"); * options.AddArgument("window-size=1920,1080"); * options.AddArgument("--disable-gpu"); * //*/ const String loginaddress = "DaveTestSe"; const String loginpassword = "******"; SqlLookup lookup = new SqlLookup(); string connectionString = lookup.GetConnectionString(); Console.WriteLine("Enter a destination address"); String destinationaddress = Console.ReadLine(); IWebDriver driver = new ChromeDriver( AppDomain.CurrentDomain.BaseDirectory, options); //"C:\\Users\\Sean\\Source\\Repos\\BabyBronson\\BabyBronson\\POMRun\\Resources" Actions action = new Actions(driver); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3)); Email email = new Email(); User user; GoogleHomePage homepage = new GoogleHomePage(driver, action, wait); homepage.Init(); LoginPage loginpage = homepage.gotoLogin(); GoogleHomePage LoggedInHomepage = loginpage.Login(loginaddress, loginpassword); GmailHomePage gmailhome = LoggedInHomepage.gotoGmail(); EmailPage currentemail; while (true) { while (gmailhome.getNumUnread() > 0) { if (gmailhome.GetUnreadEmails().Count > 0) { currentemail = gmailhome.clickUnreadEmail(1); user = lookup.GetUser(connectionString, currentemail.getAlias()); email.forwardMail(destinationaddress, loginpassword, user, currentemail); gmailhome = currentemail.returnToInbox(); } else { Console.WriteLine("Clicking older"); gmailhome.clickOlder(); } Thread.Sleep(500); } Console.WriteLine("refreshing"); gmailhome.RefreshInbox(); Thread.Sleep(TimeSpan.FromSeconds(15)); } }