Пример #1
0
        public void TestSerializationIosSimulator()
        {
            Uri      url = new Uri("https://another.url.co.il");
            Uri      stitchingServiceUrl = new Uri("https://another.stitchingserviceuri.co.il");
            RGridDom dom = new RGridDom();
            Dictionary <string, RGridResource> resources = new Dictionary <string, RGridResource>();
            SizeMode           target   = SizeMode.FullPage;
            VisualGridSelector selector = null;

            System.Drawing.Rectangle region     = new System.Drawing.Rectangle(40, 50, 60, 70);
            IosDeviceInfo            deviceInfo = new IosDeviceInfo(IosDeviceName.iPhone_XR, ScreenOrientation.Landscape, IosVersion.ONE_VERSION_BACK);
            RenderInfo renderInfo = new RenderInfo(0, 0, target, selector, region, null, deviceInfo);

            VisualGridSelector[] selectorsToFindRegionsFor = new VisualGridSelector[0];
            bool sendDom = true;
            RenderBrowserInfo browserInfo = new RenderBrowserInfo(deviceInfo);

            RenderRequest request = new RenderRequest("id", null, url, stitchingServiceUrl, dom, resources, renderInfo,
                                                      browserInfo.Platform, browserInfo.BrowserType, null, selectorsToFindRegionsFor, sendDom, null, null, null);

            JsonSerializerSettings settings = JsonUtils.CreateSerializerSettings();

            settings.Formatting = Formatting.Indented;
            string json         = JsonConvert.SerializeObject(request, settings);
            string expectedJson = CommonUtils.ReadResourceFile("Test.Eyes.Sdk.Core.DotNet.Resources.TestRenderRequestSerializationIosDevice.json");

            Assert.AreEqual(expectedJson, json);
        }
Пример #2
0
 public RenderInfo(int width, int height, SizeMode target, VisualGridSelector selector,
                   Rectangle?region, EmulationBaseInfo emulationInfo, IosDeviceInfo iosDeviceInfo)
 {
     Width         = width;
     Height        = height;
     Target        = target;
     Selector      = selector;
     Region        = region;
     EmulationInfo = emulationInfo;
     IosDeviceInfo = iosDeviceInfo;
 }
        private Size GetCorrectDeviceSize_(RenderRequest renderRequest)
        {
            Size deviceSize = configuration_.ViewportSize;

            if (deviceSize.IsEmpty)
            {
                IosDeviceInfo       iosDeviceInfo = renderRequest.RenderInfo.IosDeviceInfo;
                ChromeEmulationInfo emulationInfo = renderRequest.RenderInfo.EmulationInfo as ChromeEmulationInfo;
                if (iosDeviceInfo != null)
                {
                    IosDeviceName deviceName = iosDeviceInfo.DeviceName;
                    Dictionary <IosDeviceName, DeviceSize> iosDevicesSizes = EyesConnector.GetIosDevicesSizes();
                    if (!iosDevicesSizes.TryGetValue(deviceName, out DeviceSize deviceSizes))
                    {
                        logger_.Verbose("could not find device in list.");
                        return(Size.Empty);
                    }
                    deviceSize = iosDeviceInfo.ScreenOrientation == ScreenOrientation.Portrait
                        ? deviceSizes.Portrait
                        : deviceSizes.LandscapeLeft;
                }
                else if (emulationInfo != null)
                {
                    DeviceName deviceName = emulationInfo.DeviceName;
                    Dictionary <DeviceName, DeviceSize> emulatedDevicesSizes = EyesConnector.GetEmulatedDevicesSizes();
                    if (!emulatedDevicesSizes.TryGetValue(deviceName, out DeviceSize deviceSizes))
                    {
                        logger_.Verbose("could not find device in list.");
                        return(Size.Empty);
                    }
                    deviceSize = emulationInfo.ScreenOrientation == ScreenOrientation.Portrait
                        ? deviceSizes.Portrait
                        : deviceSizes.Landscape;
                }
            }
            return(deviceSize);
        }
 public RenderBrowserInfo(IosDeviceInfo deviceInfo, string baselineEnvName = null)
 {
     IosDeviceInfo   = deviceInfo;
     BaselineEnvName = baselineEnvName;
     BrowserType     = BrowserType.SAFARI;
 }