Exemplo n.º 1
0
        public void ClearButtonWorksCorrectly()
        {
            try
            {
                homePage.NavigateToSubMenu(homePage.LocationSearchMenu, homePage.DealerSubMenu);
                dealerPage = new DealerPage();

                TextBoxHelper.TypeInTextBox(dealerPage.SearchTextBox, "some random value");
                TextBoxHelper.TypeInTextBox(dealerPage.LocationTextBox, "some random area");
                CheckBoxHelper.CheckedAllCheckBoxes(dealerPage.CommonCheckBoxLocator);
                GenericHelper.ClickOnElement(dealerPage.ClearButton);
                actualSearchRadius = dealerPage.GetSearchRadiusValue();

                Assert.AreEqual(dealerPage.ClearedSearchRadius, actualSearchRadius,
                                string.Format("Actual search radius: <{0}> is not equal to expected: <{1}>", actualSearchRadius, dealerPage.ClearedSearchRadius));
                Logger.Info("ASSERT - Search radius is cleared");

                Assert.IsTrue(TextBoxHelper.IsTextBoxEmpty(dealerPage.SearchTextBox),
                              string.Format("Textbox: {0} is not empty", dealerPage.SearchTextBox));
                Logger.Info("ASSERT - Textbox " + dealerPage.SearchTextBox.ToString() + " is empty");

                Assert.IsTrue(TextBoxHelper.IsTextBoxEmpty(dealerPage.LocationTextBox),
                              string.Format("Textbox: {0} is not empty", dealerPage.LocationTextBox));
                Logger.Info("ASSERT - Textbox " + dealerPage.LocationTextBox.ToString() + " is empty");

                Assert.IsTrue(CheckBoxHelper.AreCheckBoxesUnchecked(dealerPage.CommonCheckBoxLocator), "Not all checkboxes are unchecked");
                Logger.Info("ASSERT - All checkboxes are unchecked");
            }
            catch (Exception exception)
            {
                GenericHelper.TakeScreenShot();
                Logger.Error(exception.Message);
                Logger.Error(exception.StackTrace);
                throw;
            }
        }