Example #1
0
        public static void ConfirmProductDetailsPageHasBeenLoaded(string itemType, string expectedHeading)
        {
            Assert.IsTrue(ProductsDetail.ProductName.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));

            var actualHeading = ProductsDetail.ProductName.Text;

            Assert.AreEqual(expectedHeading, actualHeading,
                            TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeading));
        }
Example #2
0
        public static void ConfirmInformationalPageHasBeenLoaded(string itemType, string expectedItem)
        {
            Assert.IsTrue(InformationalPagesGenericItems.GenericPageHeading.Displayed,
                          TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedItem));

            var actualHeading = InformationalPagesGenericItems.GenericPageHeading.Text;

            Assert.AreEqual(expectedItem, actualHeading,
                            TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedItem, actualHeading));
        }
Example #3
0
        public void ThenCorrectArticleWillBeDisplayed(string expectedArticle)
        {
            var itemType = "heading";

            Assert.IsTrue(NewsArticlesGenericItems.ArticlePageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedArticle));

            var actualPageHeading = NewsArticlesGenericItems.ArticlePageHeading.Text;

            Assert.AreEqual(expectedArticle, actualPageHeading, TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedArticle, actualPageHeading));
        }
Example #4
0
        public void ThenTheYourAddressesPageWillBeDisplayed()
        {
            var expectedHeading = "Your Addresses";
            var itemType        = "page heading";

            Assert.IsTrue(YourAddresses.YourAddressesHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));

            var actualHeading = YourAddresses.YourAddressesHeading.Text;

            Assert.AreEqual(expectedHeading, actualHeading, TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeading));
        }
Example #5
0
        public void ThenThePageWillBeDisplayed(string expectedPage)
        {
            var itemType = "page heading";

            Assert.IsTrue(MyAccount.MyAccountPageHeading.Displayed,
                          TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedPage));

            var actualHeading = MyAccount.MyAccountPageHeading.Text;

            Assert.AreEqual(expectedPage, actualHeading,
                            TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedPage, actualHeading));
        }
Example #6
0
        public void GivenTheLinkIsPresent(string hyperLink)
        {
            var itemType = "hyperLink";

            switch (hyperLink)
            {
            case "return policy link":
                Assert.IsTrue(Faq.ReturnPolicyLink.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "homepage link one":
                Assert.IsTrue(PrivacyPolicy.PoochWarehouseHyperlinkOne.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "homepage link two":
                Assert.IsTrue(PrivacyPolicy.PoochWarehouseHyperlinkOne.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "all about cookies link":
                Assert.IsTrue(PrivacyPolicy.AllAboutCookiesLink.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "shopify link":
                Assert.IsTrue(PrivacyPolicy.ShopifyLegalLink.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "google privacy link":
                Assert.IsTrue(PrivacyPolicy.GooglePrivacy.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "google opt out link":
                Assert.IsTrue(PrivacyPolicy.GoogleOptOut.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "facebook advertising link":
                Assert.IsTrue(PrivacyPolicy.FacebookAdvertising.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            case "contact us link":
                Assert.IsTrue(ReturnsPolicy.ContactUsLink.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, hyperLink));
                break;

            default:
                Assert.Inconclusive(TestErrorHelper.CaseValueNotRecognised(hyperLink));
                break;
            }
        }
Example #7
0
        public void ThenTheAddressDetailsWillBeSavedAsEntered()
        {
            Assert.IsTrue(YourAddresses.AddressOneHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed("heading", "Default"));

            var actualDisplayedAddress = _addressActions.GetCustomerAddressOne();

            Assert.IsNotNull(actualDisplayedAddress);

            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Address), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Address));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Apartment), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Apartment));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().City), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().City));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Company), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Company));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Country), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Country));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().FirstName), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().FirstName));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Postcode), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Postcode));
            Assert.IsTrue(actualDisplayedAddress.Contains(_expectedAddress.DefaultAddressDetails().Surname), TestErrorHelper.ExpectedAddressNotDisplayed(_expectedAddress.DefaultAddressDetails().Surname));

            Console.WriteLine($"The actual address was {actualDisplayedAddress}");
        }
Example #8
0
        public void ThenTheProductsPageWillLoad(string expectedHeading)
        {
            var itemType = "page heading";

            var actualHeading = string.Empty;

            if (expectedHeading == "Products")
            {
                Assert.IsTrue(AllProducts.ProductsPageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));
                actualHeading = AllProducts.ProductsPageHeading.Text;
                var actualHeadingManipulated = actualHeading.Substring(13);
                Assert.AreEqual(expectedHeading, actualHeadingManipulated,
                                TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeadingManipulated));
            }
            else if (expectedHeading == "Sale Items")
            {
                ThenTheProductsCollectionPageWillLoad(expectedHeading);
            }
            else if (expectedHeading == "Login")
            {
                Assert.IsTrue(LoginForm.LoginPageheader.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));
                actualHeading = LoginForm.LoginPageheader.Text;
                Assert.AreEqual(expectedHeading, actualHeading, TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeading));
            }
            else if (expectedHeading == "Your cart")
            {
                Assert.IsTrue(YourCart.YourCartPageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));
                actualHeading = YourCart.YourCartPageHeading.Text;
                Assert.AreEqual(expectedHeading, actualHeading, TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeading));
            }
            else if (expectedHeading == "News")
            {
                Assert.IsTrue(News.NewsPageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));
                actualHeading = News.NewsPageHeading.Text;
                Assert.AreEqual(expectedHeading, actualHeading, TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeading));
            }
            else
            {
                Assert.Inconclusive(TestErrorHelper.CaseValueNotRecognised(expectedHeading));
            }
        }
Example #9
0
 public void ThenTheMyAccountPageWillBeDisplayed()
 {
     Assert.IsTrue(MyAccount.MyAccountPageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed("heading", "My Account"));
 }
Example #10
0
        public static void ConfirmProductCollectionPageHasBeenLoaded(string itemType, string expectedHeading)
        {
            Assert.IsTrue(ProductsPagesGenericItems.ProductsGenericPageHeading.Displayed, TestErrorHelper.ExpectedItemNotDisplayed(itemType, expectedHeading));

            var actualHeading = ProductsPagesGenericItems.ProductsGenericPageHeading.Text;

            var actualHeadingManipulated = actualHeading.Substring(13);
            Assert.AreEqual(expectedHeading, actualHeadingManipulated,
                TestErrorHelper.ExpectedActualPageHeadingsDoNotMatch(expectedHeading, actualHeadingManipulated));
        }