public IList <FloatingMatchSettings> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { ReadOnlyCollection <IWebElement> elements = ((SeleniumEyes)eyesBase).GetDriver().FindElements(selector_); IList <FloatingMatchSettings> retVal = new List <FloatingMatchSettings>(); foreach (IWebElement element in elements) { Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(element); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); retVal.Add( new FloatingMatchSettings() { Left = pTag.X, Top = pTag.Y, Width = r.Width, Height = r.Height, MaxLeftOffset = maxLeftOffset_, MaxUpOffset = maxUpOffset_, MaxRightOffset = maxRightOffset_, MaxDownOffset = maxDownOffset_ } ); } return(retVal); }
public IList <FloatingMatchSettings> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { ReadOnlyCollection <IWebElement> elements = ((Eyes)eyesBase).GetDriver().FindElements(selector_); IList <FloatingMatchSettings> retVal = new List <FloatingMatchSettings>(); double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); foreach (IWebElement element in elements) { Region r = new Region(element.Location, element.Size); r = r.Scale(scaleRatio); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); retVal.Add( new FloatingMatchSettings() { Left = pTag.X, Top = pTag.Y, Width = r.Width, Height = r.Height, MaxLeftOffset = maxLeftOffset_, MaxUpOffset = maxUpOffset_, MaxRightOffset = maxRightOffset_, MaxDownOffset = maxDownOffset_ } ); } return(retVal); }
public static string GetStepDom(EyesBase eyes, ActualAppOutput actualAppOutput) { ArgumentGuard.NotNull(eyes, nameof(eyes)); ArgumentGuard.NotNull(actualAppOutput, nameof(actualAppOutput)); UriBuilder uriBuilder = new UriBuilder(eyes.ServerUrl); uriBuilder.Path = $"/api/images/dom/{actualAppOutput.Image.DomId}"; NameValueCollection query = HttpUtility.ParseQueryString(uriBuilder.Query); query["apiKey"] = eyes.ApiKey; uriBuilder.Query = query.ToString(); HttpRestClient client = new HttpRestClient(uriBuilder.Uri); client.ConfigureRequest += Client_ConfigureRequest; HttpWebResponse response = client.GetJson(uriBuilder.ToString()); Stream stream = response.GetResponseStream(); string result; using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) { result = reader.ReadToEnd(); } client.ConfigureRequest -= Client_ConfigureRequest; return(result); }
public IList <AccessibilityRegionByRectangle> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(element_); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new AccessibilityRegionByRectangle[] { new AccessibilityRegionByRectangle(new Rectangle(pTag, r.Size), regionType_) }); }
public IList <IMutableRegion> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { if (!(element_ is EyesRemoteWebElement eyesElement)) { eyesElement = new EyesRemoteWebElement(eyesBase.Logger, ((SeleniumEyes)eyesBase).GetDriver(), element_); } Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(eyesElement); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new MutableRegion[] { new MutableRegion(pTag.X, pTag.Y, r.Width, r.Height) }); }
public IList <IMutableRegion> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { IWebElement element = element_; double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); Region r = new Region(element.Location, element.Size); r = r.Scale(scaleRatio); eyesBase.Logger.Verbose("screenshot: {0}", screenshot); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new MutableRegion[] { new MutableRegion(pTag.X, pTag.Y, r.Width, r.Height) }); }
public IList <AccessibilityRegionByRectangle> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); Region r = new Region(element_.Location, element_.Size); r = r.Scale(scaleRatio); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new AccessibilityRegionByRectangle[] { new AccessibilityRegionByRectangle(new Rectangle(pTag, r.Size), regionType_) }); }
public IList <AccessibilityRegionByRectangle> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { ReadOnlyCollection <IWebElement> elements = ((SeleniumEyes)eyesBase).GetDriver().FindElements(selector_); IList <AccessibilityRegionByRectangle> retVal = new List <AccessibilityRegionByRectangle>(); foreach (IWebElement element in elements) { Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(element); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); retVal.Add(new AccessibilityRegionByRectangle(new Rectangle(pTag, r.Size), regionType_)); } return(retVal); }
public IList <IMutableRegion> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { EyesWebDriver driver = ((SeleniumEyes)eyesBase).GetDriver(); ReadOnlyCollection <IWebElement> elements = driver.FindElements(selector_); IList <IMutableRegion> mutableRegions = new List <IMutableRegion>(); foreach (IWebElement element in elements) { Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(element); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); mutableRegions.Add(new MutableRegion(pTag.X, pTag.Y, r.Width, r.Height)); } return(mutableRegions); }
public IList <AccessibilityRegionByRectangle> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { ReadOnlyCollection <IWebElement> elements = ((Eyes)eyesBase).GetDriver().FindElements(selector_); IList <AccessibilityRegionByRectangle> retVal = new List <AccessibilityRegionByRectangle>(); double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); foreach (IWebElement element in elements) { Region r = new Region(element.Location, element.Size); r = r.Scale(scaleRatio); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); retVal.Add(new AccessibilityRegionByRectangle(new Rectangle(pTag, r.Size), regionType_)); } return(retVal); }
public IList <IMutableRegion> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { IWebDriver driver = ((Eyes)eyesBase).GetDriver(); ReadOnlyCollection <IWebElement> elements = driver.FindElements(selector_); IList <IMutableRegion> mutableRegions = new List <IMutableRegion>(); double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); foreach (IWebElement element in elements) { Region r = new Region(element.Location, element.Size); r = r.Scale(scaleRatio); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); mutableRegions.Add(new MutableRegion(pTag.X, pTag.Y, r.Width, r.Height)); } return(mutableRegions); }
protected override TestResultsSummary GetAllTestResultsImpl(bool shouldThrowException) { if (shouldThrowException && Exception != null) { throw Exception; } List <TestResultContainer> result = new List <TestResultContainer>(); foreach (TestResults testResults in allTestResult_) { result.Add(new TestResultContainer(testResults, null, null)); EyesBase.LogSessionResultsAndThrowException(Logger, shouldThrowException, testResults); } return(new TestResultsSummary(result)); }
public IList <FloatingMatchSettings> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { Rectangle r = EyesSeleniumUtils.GetVisibleElementBounds(element_); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new FloatingMatchSettings[] { new FloatingMatchSettings() { Left = pTag.X, Top = pTag.Y, Width = r.Width, Height = r.Height, MaxLeftOffset = maxLeftOffset_, MaxUpOffset = maxUpOffset_, MaxRightOffset = maxRightOffset_, MaxDownOffset = maxDownOffset_ } }); }
public IList <FloatingMatchSettings> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot) { double scaleRatio = ((Eyes)eyesBase).GetScaleRatioForRegions(); Region r = new Region(element_.Location, element_.Size); r = r.Scale(scaleRatio); Point pTag = screenshot.ConvertLocation(r.Location, CoordinatesTypeEnum.CONTEXT_RELATIVE, CoordinatesTypeEnum.SCREENSHOT_AS_IS); return(new FloatingMatchSettings[] { new FloatingMatchSettings() { Left = pTag.X, Top = pTag.Y, Width = r.Width, Height = r.Height, MaxLeftOffset = maxLeftOffset_, MaxUpOffset = maxUpOffset_, MaxRightOffset = maxRightOffset_, MaxDownOffset = maxDownOffset_ } }); }
public static void SetupLogging(EyesBase eyes, [CallerMemberName] string testName = null) { ILogHandler logHandler = null; if (!RUNS_ON_CI) { string path = InitLogPath(testName); eyes.DebugScreenshotProvider = new FileDebugScreenshotProvider() { Path = path, Prefix = testName + "_" }; logHandler = new FileLogHandler(Path.Combine(path, testName + ".log"), true, true); } else { logHandler = new NunitLogHandler(false); } if (logHandler != null) { eyes.SetLogHandler(logHandler); } }