Exemplo n.º 1
0
        public void BuilderJsonConfigStringProducesCorrectSerialisation(
            Browser browser,
            WindowSize windowSize,
            bool headless,
            bool isLocal,
            string gridUri,
            PlatformType platformType)
        {
            // Arrange
            var webDriverConfigurationBuilder = WebDriverConfigurationBuilder.Start()
                                                .WithBrowser(browser)
                                                .WithHeadless(headless)
                                                .WithWindowSize(windowSize)
                                                .WithIsLocal(isLocal)
                                                .WithGridUri(new Uri(gridUri))
                                                .WithPlatformType(platformType);
            WebDriverConfiguration expectedConfig = webDriverConfigurationBuilder.Build();
            string requestedJson = expectedConfig.SerializeToJson();


            string jsonConfigString = webDriverConfigurationBuilder.GetJsonConfigString();

            // Act
            WebDriverConfiguration returnedConfig             = WebDriverConfiguration.DeserializeFromJson(requestedJson);
            WebDriverConfiguration configFromJsonConfigString = WebDriverConfiguration.DeserializeFromJson(jsonConfigString);

            // Assert
            configFromJsonConfigString.Should().BeEquivalentTo(returnedConfig);
        }
Exemplo n.º 2
0
        public void ConfigurationCorrectlySerialisesAndDeserialises(int width, int height)
        {
            // Arrange
            WebDriverConfiguration testConfig = WebDriverConfigurationBuilder.Start().WithCustomSize(new Size(width, height)).Build();

            // Act
            string serialisedConfig = testConfig.SerializeToJson();
            WebDriverConfiguration deserialisedConfig = WebDriverConfiguration.DeserializeFromJson(serialisedConfig);

            // Assert
            deserialisedConfig.Should().BeEquivalentTo(testConfig);
        }
Exemplo n.º 3
0
        public void CustomSizeConfigurationDeSerialisesWithCorrectWidthAndHeight(int width, int height)
        {
            // Arrange
            var webDriverConfigurationBuilder     = WebDriverConfigurationBuilder.Start().WithCustomSize(new Size(width, height));
            WebDriverConfiguration expectedConfig = webDriverConfigurationBuilder.Build();
            string requestedJson = expectedConfig.SerializeToJson();

            // Act
            WebDriverConfiguration returnedConfig = WebDriverConfiguration.DeserializeFromJson(requestedJson);

            // Assert
            returnedConfig.Should().BeEquivalentTo(expectedConfig);
        }
Exemplo n.º 4
0
        private void CompareJsonEquivalence(WebDriverConfigurationBuilder webDriverConfigurationBuilder)
        {
            // Arrange
            string formattedString = webDriverConfigurationBuilder.GetJsonConfigString();
            WebDriverConfiguration expectedConfig = webDriverConfigurationBuilder.Build();
            string requestedJson = expectedConfig.SerializeToJson();

            // Act
            WebDriverConfiguration returnedConfig            = WebDriverConfiguration.DeserializeFromJson(requestedJson);
            WebDriverConfiguration configFromFormattedString =
                WebDriverConfiguration.DeserializeFromJson(formattedString);

            // Assert
            returnedConfig.Should().BeEquivalentTo(configFromFormattedString);
        }