public void Test1() { try { LoginPageSteps.LoginUser(TestsData.user2_email, TestsData.user2_password); BaseSteps.SendMessage(TestsData.user1_email, TestsData.subject, TestsData.message); LoginPageSteps.SwitchUser(TestsData.user1_email, TestsData.user1_password); InboxPageSteps.ReportMessageAsSpam(TestsData.user2_email, TestsData.subject); LoginPageSteps.SwitchUser(TestsData.user2_email, TestsData.user2_password); BaseSteps.SendMessage(TestsData.user1_email, TestsData.subject2, TestsData.message2); LoginPageSteps.SwitchUser(TestsData.user1_email, TestsData.user1_password); Assert.IsTrue(SpamPageSteps.IsMessagePresentInSpam(TestsData.user2_email, TestsData.subject2), "Second message isn't in spam, but it should be"); log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Pass}"); } catch (Exception ex) when(ex is NoSuchElementException || ex is TimeoutException) { log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Failed}"); log.Error(ex); } catch (AssertionException ex) { log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Failed}"); log.Error(ex.Message); throw; } }
public void Test11() { try { LoginPageSteps.LoginUser(TestsData.user1_email, TestsData.user1_password); BaseSteps.SendMessage(TestsData.user1_email, TestsData.subject, TestsData.message); InboxPageSteps.Refresh(); InboxPageSteps.ReportMessageAsSpam(TestsData.user1_email, TestsData.subject); Assert.IsTrue(SpamPageSteps.IsMessagePresentInSpam(TestsData.user1_email, TestsData.subject), "The message isn't moved from inbox to spam, but it should be"); SpamPageSteps.MoveMessageToInbox(TestsData.user1_email, TestsData.subject); Assert.IsTrue(InboxPageSteps.IsMessagePresentInInbox(TestsData.user1_email, TestsData.subject), "The message isn't moved from spam to inbox, but it should be"); log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Pass}"); } catch (Exception ex) when(ex is NoSuchElementException || ex is TimeoutException) { log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Failed}"); log.Error(ex); } catch (AssertionException ex) { log.Info($"{TestContext.CurrentContext.Test.Name} - {TestsData.Failed}"); log.Error(ex.Message); throw; } }
static void Main(string[] args) { LoginPageSteps loginPage = new LoginPageSteps(); LogoutPageSteps logoutPage = new LogoutPageSteps(); MainPageSteps mainPage = new MainPageSteps(); ThemesPageSteps themePage = new ThemesPageSteps(); SettingPageSteps settPage = new SettingPageSteps(); MailBoxPageSteps mailPage = new MailBoxPageSteps(); LetterPageSteps letterPage = new LetterPageSteps(); StarredPageSteps starredPage = new StarredPageSteps(); SpamPageSteps spamPage = new SpamPageSteps(); //MailBoxPageSteps mailPage = new MailBoxPageSteps(); //StarredPageSteps starredPage = new StarredPageSteps(); loginPage.Open(); loginPage.Authorize(D.user2, D.password); mailPage.WriteMessage(D.user3, "For starred", "XO"); logoutPage.CommonExit(); loginPage.Authorize(D.user3, D.password); Console.WriteLine(mainPage.CheckIfItIsStarred()); mainPage.GoToStarred(); Console.WriteLine(starredPage.CheckIfItIsStarredPage("https://mail.google.com/mail/u/0/#starred")); Console.WriteLine(starredPage.CheckTheTopic("For starred")); Console.ReadLine(); }
[Test]//1 public void CheckAddToSpamAndDeleteFromSpamFunctions() { MailBoxPageSteps mailPage = new MailBoxPageSteps(); SpamPageSteps spamPage = new SpamPageSteps(); loginPage.Authorize(Data.user1, Data.password); mailPage.WriteMessage(Data.user2, "for spam", "Spam"); logoutPage.CommonExit(); loginPage.Authorize(Data.user2, Data.password); mainPage.AddToSpam(); mainPage.GoToSpam(); spamPage.DeleteFromSpam(); Assert.True(mainPage.CheckTopicInInbox("for spam")); }
public void CheckTheSpam() { IpHandler hand = new IpHandler(); MailBoxPageSteps mailPage = new MailBoxPageSteps(); SpamPageSteps spamPage = new SpamPageSteps(); loginPage.Authorize(Data.user1, Data.password); mailPage.WriteMessage(Data.user2, "for spam1", "Spam.123" + hand.GetIp(Data.ip)); logoutPage.CommonExit(); loginPage.Authorize(Data.user2, Data.password); mainPage.AddToSpam(); logoutPage.CommonExit(); loginPage.Authorize(Data.user1, Data.password); mailPage.WriteMessage(Data.user2, "for spam2", "Spam.456"); logoutPage.CommonExit(); loginPage.Authorize(Data.user2, Data.password); mainPage.GoToSpam(); spamPage.CheckSpam(); Assert.AreEqual("for spam2", spamPage.topic); }