Пример #1
0
 public static void TestAttachment()
 {
     /*
          * base (& only) case:
          * 0. open page             OK
          * 1. login+password        OK
          * 1.1 wait for the page    OK
          * 2. click "write"         OK
          * 3. To = to;              OK
          * 4. click "attach file"   OK
          * 5. select file           OK
          * 6. click OK              OK
          * 7. click "send"          OK
          * 8. open sent             OK
          * 9. select first message  OK
          * 10. check for attach
          * */
     General.WriteLog(DateTime.Now.ToString() + " Performing test for gmail attachments");
     General.WriteLog("Reading credentials and file path from file");
     string[] credentials = File.ReadAllLines(General.credential);
     Initialize();
     logon.Login(credentials[0], credentials[1]).WriteAndSendEmail(credentials[0], credentials[2]);
     Thread.Sleep(5000);
     mail = new MailPage();
     var text = mail.CheckSent().AttachArea.Text;
     if (!text.Contains(credentials[3]))
     {
         General.WriteLog("Incorrect attachments in mail");
         General.WriteLog("Test failed");
         throw new Exception();
     }
     General.WriteLog("Test passed");
     General.WriteLog();
     Clean();
 }
Пример #2
0
 public MailPage CheckSent()
 {
     General.WriteLog("Opening first sent message");
     //Sent.Click();
     Thread.Sleep(1000);
     var temp = new MailPage();
     SentAlert.Click();
     //var alert = new WebDriverWait(General.driver, TimeSpan.FromSeconds(20)).Until<IWebElement>((d) => { return d.FindElement(By.Id("link-vsm")); });
     //alert.Click();
     //temp.First.Click();
     return new MailPage();
 }
Пример #3
0
 public void WriteAndSendEmail(string to, string attachment)
 {
     General.WriteLog("Writing message");
     Write.Click();
     var temp = new MailPage();
     temp.To.SendKeys(to+"@gmail.com");
     General.WriteLog("Attaching file and sending message");
     temp.AttachBtn.Click();
     Thread.Sleep(1000);
     SendKeys.SendWait(attachment);
     SendKeys.SendWait(@"{Enter}");
     //var wait = new WebDriverWait(General.driver, TimeSpan.FromSeconds(10)).Until<bool>((d) => { return SendBtn == null});
     temp.SendBtn.Click();
     //SendKeys.SendWait(@"{Ctrl+Enter}");
     //return new MailPage();
 }