示例#1
0
        public void TestCase649AddReviewTest(IProductReview review)
        {
            Application.Get().Browser.OpenUrl(URL);

            HomePage homePage;

            Assert.DoesNotThrow(() => { homePage = new HomePage(); },
                                "Step 1 Failed: Not home page");

            List <ProductItem> searchPage = new SearchMethods()
                                            .Search(review.GetProductName())
                                            .GetListProduct();

            Assert.True(searchPage.Any(),
                        "Step 3 Failed: No search results");

            ProductPageLogic productPage = searchPage
                                           .FirstOrDefault(x => x.GetTextFromProductName() == review.GetProductName())
                                           .ClickProductName();

            Assert.True(productPage.ProductPage.IsProductPageOf(review),
                        $"Step 4 Failed: Not {review.GetProductName()} product page");

            ProductPageReviewLogic productReviewPage = productPage.ProductPage.ClickWriteReviewLink();

            Assert.True(productReviewPage.ProductPageReview.IsReviewPage(),
                        "Step 5 Failed: Not reviews page");

            SuccessfullyAddedReviewPage addedReview = productReviewPage.InputValidReviewAndClickOnAddReviewButton(review);

            Assert.AreEqual(addedReview.GetTextFromSuccessAllert(), REVIEW_ADDED_ALERT_TEXT,
                            "Step 6 Failed: " + REVIEW_ADDED_ALERT_TEXT + " message not appeared");
            TestCase649 = true;
        }
示例#2
0
        public void TestCase704VerifyInvalidTextMessage(IProductReview validReview, IProductReview invalidReview)
        {
            Application.Get().Browser.OpenUrl(URL);

            HomePage homePage;

            Assert.DoesNotThrow(() => { homePage = new HomePage(); },
                                "Step 1 Failed: Not home page");

            List <ProductItem> searchPage = new SearchMethods()
                                            .Search(validReview.GetProductName())
                                            .GetListProduct();

            Assert.True(searchPage.Any(),
                        "Step 3 Failed: No search results");

            ProductPageLogic productPage = searchPage
                                           .FirstOrDefault(x => x.GetTextFromProductName() == validReview.GetProductName())
                                           .ClickProductName();

            Assert.True(productPage.ProductPage.IsProductPageOf(validReview),
                        $"Step 4 Failed: Not {validReview.GetProductName()} product page");

            ProductPageReviewLogic productReviewPage = productPage.ProductPage.ClickWriteReviewLink();

            Assert.True(productReviewPage.ProductPageReview.IsReviewPage(),
                        "Step 5 Failed: Not reviews page");

            UnsuccessfullyAddedReviewPage emptyReviewTextAlertPage = productReviewPage.InputReviewWithInvalidReviewTextAndClickOnAddReviewButton(validReview, invalidReview);

            Assert.AreEqual(emptyReviewTextAlertPage.GetTextFromWarningAlert(), INVALID_REVIEW_TEXT_ALERT_TEXT,
                            "Step 7 Failed: " + INVALID_REVIEW_TEXT_ALERT_TEXT + " message not appeared");
        }
示例#3
0
        /// <summary>
        /// Checks if review data is equal to another. Support IProductReview or ReviewItem
        /// </summary>
        /// <param name="obj">Can be IProductReview or ReviewItem</param>
        /// <returns>true if review data equals to obj data</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            else if (obj is IProductReview)
            {
                IProductReview productReview = obj as IProductReview;

                return(this.GetProductName().Equals(productReview.GetProductName()) &&
                       this.GetReviewerName().Equals(productReview.GetReviewerName()) &&
                       this.GetReviewDate().Equals(productReview.GetDate()) &&
                       this.GetReviewRaiting().Equals(productReview.GetRating()));
            }
            else if (obj is ReviewItem)
            {
                ReviewItem productReview = obj as ReviewItem;

                return(this.GetProductName().Equals(productReview.GetProductName()) &&
                       this.GetReviewerName().Equals(productReview.GetReviewerName()) &&
                       this.GetReviewDate().Equals(productReview.GetReviewDate()) &&
                       this.GetReviewRaiting().Equals(productReview.GetReviewRaiting()));
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// Checks if data on page is equal to some obj
        /// </summary>
        /// <param name="obj">Can be IProductReview or ReviewItem,  represents Review that will be checked to equals</param>
        /// <returns>True is two reviews data are equal and false if not</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            else if (obj is IProductReview)
            {
                IProductReview productReview = obj as IProductReview;

                return(GetTextFomProductNameInput().Equals(productReview.GetProductName()) &&
                       GetTextFomReviewerNameInput().Equals(productReview.GetReviewerName()) &&
                       GetDateFomReviewDateInput().Equals(productReview.GetDate()) &&
                       GetSelectedRating().Equals(productReview.GetRating()));
            }
            else if (obj is ReviewItem)
            {
                ReviewItem productReview = obj as ReviewItem;

                return(GetTextFomProductNameInput().Equals(productReview.GetProductName()) &&
                       GetTextFomReviewerNameInput().Equals(productReview.GetReviewerName()) &&
                       GetDateFomReviewDateInput().Equals(productReview.GetReviewDate()) &&
                       GetSelectedRating().Equals(productReview.GetReviewRaiting()));
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        public void TestCase672CheckReviewTest(IProductReview review)
        {
            Assert.IsTrue(TestCase649 && TestCase670,
                          "Blocked. Preconditions fail: add review test failed or approve review test failed");

            Application.Get().Browser.OpenUrl(URL);

            HomePage homePage;

            Assert.DoesNotThrow(() => { homePage = new HomePage(); },
                                "Step 1 Failed: Not home page");

            List <ProductItem> searchPage = new SearchMethods()
                                            .Search(review.GetProductName())
                                            .GetListProduct();

            Assert.True(searchPage.Any(),
                        "Step 3 Failed: No search results");

            ProductPageLogic productPage = searchPage
                                           .FirstOrDefault(x => x.GetTextFromProductName() == review.GetProductName())
                                           .ClickProductName();

            Assert.True(productPage.ProductPage.IsProductPageOf(review),
                        $"Step 4 Failed: Not {review.GetProductName()} product page");

            ProductPageReviewLogic productReviewPage = productPage.ProductPage.ClickWriteReviewLink();

            Assert.True(productReviewPage.ProductPageReview.IsReviewPage(),
                        "Step 5 Failed: Not reviews page");

            bool hasReview = productReviewPage.ProductPageReview.ReviewExistInListOfReview(review);

            Assert.True(hasReview,
                        "Step 6 Failed: Review not exist");
        }
示例#6
0
 /// <summary>
 /// Check is it product page of specific product
 /// </summary>
 /// <param name="productReview">Produc review in IProductReview format</param>
 /// <returns>True if product name equals and false if not</returns>
 public bool IsProductPageOf(IProductReview productReview)
 {
     return(GetTextFromProductName().Equals(productReview.GetProductName()));
 }