Esempio n. 1
0
        public void TestCreateAndSendDraft()
        {
            // Login to the mail box.
            HomePage homePage     = Login();
            string   writeBtnText = homePage.GetWriteBtnText();

            // Assert, that the login is successful: Если появляется кнопка Написать, значит вход выполнен успешно
            StringAssert.Contains("Написать", writeBtnText, "Login failed.");

            // Create a new mail(fill addressee, subject and body fields).
            EmailPage emailPage = homePage.ClickWriteBtn();

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

            // Save the mail as a draft.
            emailPage.SaveAndCloseDraft();

            // Verify, that the mail presents in ‘Drafts’ folder.
            DraftsPage draftsPage            = homePage.OpenDrafts();
            string     subjectOfCreatedDraft = draftsPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfCreatedDraft, "Draft wasn't saved");

            // Verify the draft content(addressee, subject and body – should be the same as in 3).
            emailPage = draftsPage.OpenMailBySubject(this.subject);
            string draftBody    = emailPage.GetBodyText();
            string draftMailTo  = emailPage.GetDraftMailToText();
            string draftSubject = emailPage.GetDraftSubjectText();

            StringAssert.Contains(this.mailTo, draftMailTo, "TO value is not expected");
            StringAssert.Contains(this.subject, draftSubject, "Subject value is not expected");
            StringAssert.Contains(this.text, draftBody, "Body value is not expected");

            // Send the mail.
            emailPage.SendDraft();

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

            Assert.IsFalse(isDraftDisplayed);

            // Verify, that the mail is in ‘Sent’ folder.
            SentPage sentPage          = draftsPage.OpenSent();
            string   subjectOfSentMail = sentPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfSentMail, "Mail is not in 'Sent' folder");

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