예제 #1
0
 public void Test5()
 {
     try
     {
         LoginPageSteps.LoginUser(TestsData.user1_email, TestsData.user1_password);
         string city = IpApiService.GetCityFromIp(TestsData.IP);
         BaseSteps.SendMessageWithEmoticons(TestsData.user1_email, TestsData.emoticon_subject, city,
                                            int.Parse(TestsData.emoticon_number_1), int.Parse(TestsData.emoticon_number_2));
         InboxPageSteps.Refresh();
         InboxPageSteps.GoToMessagePage(TestsData.user1_email, TestsData.emoticon_subject);
         Assert.AreEqual(2, MessagePageSteps.CountOfEmoticonsInMessage(), "The number of emoticons in the message is incorrect");
         Assert.IsTrue(MessagePageSteps.IsMessageContainsText(TestsData.City), "The message doesn't contains right city name");
         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;
     }
 }
예제 #2
0
        public void Test2()
        {
            try
            {
                string path = $@"{TestContext.CurrentContext.TestDirectory}\{TestsData.normal_attach_file}";
                LoginPageSteps.LoginUser(TestsData.user1_email, TestsData.user1_password);
                BaseSteps.GoToSettings();
                SettingPageSteps.GoToForwardingAndPOP();
                ForwardPageSteps.AddForwardingAddress(TestsData.user2_email);
                LoginPageSteps.SwitchUser(TestsData.user2_email, TestsData.user2_password);
                InboxPageSteps.GoToMessagePage(TestsData.google_forwarding_email);
                MessagePageSteps.ConfirmForwarding();
                LoginPageSteps.SwitchUser(TestsData.user1_email, TestsData.user1_password);
                BaseSteps.GoToSettings();
                SettingPageSteps.GoToForwardingAndPOP();
                ForwardPageSteps.ChooseForwardingVariant();
                BaseSteps.GoToSettings();
                SettingPageSteps.GoToFiltersAndBlockedAddresses();
                FiltersPageSteps.CreateNewFilter(TestsData.user3_email);
                LoginPageSteps.SwitchUser(TestsData.user3_email, TestsData.user3_password);
                BaseSteps.SendMessage(TestsData.user1_email, TestsData.no_attach_subject, TestsData.no_attach_message);
                BaseSteps.SendMesageWithAttachment(TestsData.user1_email, TestsData.attach_subject, TestsData.attach_message, path);
                LoginPageSteps.SwitchUser(TestsData.user1_email, TestsData.user1_password);

                Assert.IsTrue(InboxPageSteps.IsMessagePresentInInbox(TestsData.user3_email, TestsData.no_attach_subject));
                Assert.IsTrue(ImportantPageSteps.IsMessageMarkedAsImportant(TestsData.user3_email, TestsData.no_attach_subject));//IsFalse

                Assert.IsTrue(TrashPageSteps.IsMessagePresentInTrash(TestsData.user3_email, TestsData.attach_subject));
                Assert.IsFalse(ImportantPageSteps.IsMessageMarkedAsImportant(TestsData.user3_email, TestsData.attach_subject));//IsTrue

                LoginPageSteps.SwitchUser(TestsData.user2_email, TestsData.user2_password);
                Assert.IsTrue(InboxPageSteps.IsMessagePresentInInbox(TestsData.user3_email, TestsData.no_attach_subject));
                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;
            }
        }