Exemplo n.º 1
0
        public UIConversionCheck(IWebDriver browser, UIFoundTags foundKeyWord)
        {
            UIConversionEvidence.Feature       = Feature.UIConversionCheck;
            UIConversionEvidence.HelperMessage = messages.UIConversionCheck;

            var uiInputHandler = new InputingToUI(browser, foundKeyWord);

            foreach (var key in UIKeywords.PROPER_INPUT)
            {
                var errs = uiInputHandler.InputData(key);
                if (errs.Any())
                {
                    SetCheckUndefined(errs);
                    return;
                }

                try
                {
                    browser.FindElement(By.XPath($"//*[contains(text(),\"{GetCorrectClampedNum(double.Parse(key) * unitConvertValue)}\")]"));
                }
                catch (NoSuchElementException)
                {
                    UIConversionEvidence.SetFailed(new SimpleEvidenceBuilder("Values were converted incorrectly"));
                    UIConversionEvidence.FeatureRating = 0;
                    browser.Navigate().Back();
                    return;
                }
                browser.Navigate().Back();
            }

            UIConversionEvidence.SetPassed(new SimpleEvidenceBuilder("Successfully converted from miles to kilometres"));
            UIConversionEvidence.FeatureRating = 1;
        }
        public UIBadInputChecker(IWebDriver browser, UIFoundTags foundKeyWord)
        {
            UIBadInputCheckEvidence.Feature       = Feature.UIBadInputCheck;
            UIBadInputCheckEvidence.HelperMessage = messages.UIBadInputCheck;

            this.browser = browser;

            UIKeywords.GARBAGE_INPUT.ToList().ForEach(a => InputCheckResult.Add(a, false));

            var uiInputhandler = new InputingToUI(browser, foundKeyWord);

            resultsOutput.AppendLine(string.Format($"\n{"Input name",TitleColumnFormatter} {"FIXED",ValueColumnFormatter}"));
            resultsOutput.AppendLine(messages.ParagraphDivider);

            foreach (var key in UIKeywords.GARBAGE_INPUT)
            {
                var errs = uiInputhandler.InputData(key);
                if (errs.Any())
                {
                    SetCheckUndefined(errs);
                    return;
                }

                OutputCheck(key);
            }
            UIBadInputCheckEvidence.FeatureRating = GetOutputCheckRating();

            var featureImplemented = !ratingsList.Contains(false) && ratingsList.Any();

            if (featureImplemented)
            {
                UIBadInputCheckEvidence.SetPassed(new SimpleEvidenceBuilder(resultsOutput.ToString()));
            }
            else
            {
                UIBadInputCheckEvidence.SetFailed(new SimpleEvidenceBuilder(resultsOutput.ToString()));
            }
        }
Exemplo n.º 3
0
 public InputingToUI(IWebDriver browser, UIFoundTags foundTagsInfo)
 {
     this.browser       = browser;
     this.foundTagsInfo = foundTagsInfo;
 }