Пример #1
0
        public void TestSendAndDeleteMail()
        {
            // Login to the mail box.
            HomePage homePage = Login();

            // Send a mail.
            EmailPage emailPage = homePage.ClickWriteBtn();

            emailPage.CreateDraft(this.mailTo, this.subject, this.text);
            emailPage.SendDraft();

            // Delete sent mail.
            SentPage sentPage = homePage.OpenSent();

            sentPage.SelectMailBySubject(this.subject);
            sentPage.DeleteSelectedMail();

            // Verify, that the mail disappeared from ‘Sent’ folder.
            sentPage.RefreshPage();
            bool isMailDisplayed = sentPage.IsMailDisplayed(this.subject);

            Assert.IsFalse(isMailDisplayed);

            // Verify, that the mail is in ‘Trash’ folder
            TrashPage trashPage            = sentPage.OpenTrash();
            string    subjectOfDeletedMail = trashPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfDeletedMail, "The mail wasn't deleted");

            // Log out.
            trashPage.Logout();
        }
Пример #2
0
        public void TestSearchAndDeleteDraftMailWithContextMenu()
        {
            // Login to the mail box.
            HomePage homePage = Login();

            EmailPage emailPage;
            int       lengthOfSubject = subject.Length;
            int       num             = 5;

            // Create a new mail.
            // Save the mail as a draft.
            // Repeat steps 2-3 4 times.
            do
            {
                string sub = subject.Substring(0, lengthOfSubject);
                emailPage = homePage.ClickWriteBtn();
                emailPage.CreateDraft(this.mailTo, sub, this.text);
                emailPage.SaveAndCloseDraft();
                lengthOfSubject--;
                num--;
            } while (num != 0);


            // Perform search in drafts by clicking Enter key.
            DraftsPage draftsPage = homePage.JsOpenDrafts(); // JsExecutor

            draftsPage.TypeInSearchBox(this.subject);
            draftsPage.ClickEnterKey();                      // Action
            draftsPage.HighlightMailBySubject(this.subject); // JsExecutor
            string subjectOfFoundMail = draftsPage.GetMailSubjectText(this.subject);
            int    numberOfFoundMails = draftsPage.GetNumberOfMailsDisplayed();

            // Verify, that found draft matches searched term
            Assert.AreEqual(1, numberOfFoundMails, "The wrong number of mails was found");
            Assert.AreEqual(this.subject, subjectOfFoundMail, "The wrong mail was found");

            // Delete searched draft.
            homePage.DeleteMailWithContextMenu(this.subject); // Action

            // Verify, that the mail disappeared from ‘Drafts’ folder.
            draftsPage.RefreshPage();
            bool isMailDisplayed = draftsPage.IsMailDisplayed(this.subject);

            Assert.IsFalse(isMailDisplayed);

            // Verify, that the mail is in ‘Trash’ folder
            TrashPage trashPage            = draftsPage.OpenTrash();
            string    subjectOfDeletedMail = trashPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfDeletedMail, "The mail wasn't deleted");

            // Log out.
            trashPage.Logout();
        }