Ejemplo n.º 1
0
        public void IShouldSeeValueInControl(string not, string expectedValue, string controlName,
                                             string frame)
        {
            var actualValue = ControlAction.ExecuteFunction(controlName, ActionType.GetText,
                                                            frame.ToString()).ToString();

            if (string.IsNullOrEmpty(not))
            {
                Assert.AreEqual(expectedValue.ToString(), actualValue,
                                $"Value '{expectedValue}' is not present in {controlName}.");
            }
            else
            {
                Assert.AreNotEqual(expectedValue.ToString(), actualValue,
                                   $"Value '{expectedValue}' is present in {controlName}");
            }
        }
        public void Test_ControlAction_ItIsPossibleBuildABurguer()
        {
            BrowserAction.GoTo(Config.WebAppUrl);
            var  frame               = "";
            var  burgerBuilderMenu   = "Burger Builder";
            bool isBurgerLinkClicked = ControlAction.Execute(burgerBuilderMenu, ActionType.Click, frame);

            Assert.True(isBurgerLinkClicked, $"Unable to click control {burgerBuilderMenu}");

            var  lessSalad = "More Salad";
            bool isLessSaladButtonClicked = ControlAction.Execute(lessSalad, ActionType.Click, frame);

            Assert.True(isLessSaladButtonClicked, $"Unable to click control {lessSalad }");
            var    currentPriceLabel  = "current Price";
            string actualCurrentPrice = (string)ControlAction.ExecuteFunction(currentPriceLabel, ActionType.GetText, frame);

            const string expectedCurrentPrice = "4.50";

            Assert.AreEqual(expectedCurrentPrice, actualCurrentPrice, $"{currentPriceLabel} value is {actualCurrentPrice} expected was {expectedCurrentPrice}");
        }