Ejemplo n.º 1
0
        public void should_be_able_to_create_fullPage_screenshot_for_chrome_extended_browser_type()
        {
            //Initialize MvcPages
            var browserAdapterConfig = BrowserAdapterConfig.FromAppConfig(TestContext.CurrentContext.TestDirectory);

            browserAdapterConfig.BrowserType         = BrowserType.Chrome;
            browserAdapterConfig.BrowserCameraConfig = new BrowserCameraConfig
            {
                LensType = LensType.ChromeFullPage
            };

            //Initialize VisualAssertions
            var visualAssertionConfig = new VisualAssertionsConfig
            {
                BrowserName        = browserAdapterConfig.BrowserType.ToString(),
                ProjectName        = "Sample Project",
                ScreenshotCategory = "Sample Form",
                ProcessScreenshotsAsynchronously = true
            };

            browserAdapterConfig.VisualAssertion = new TelluriumVisualAssertion(visualAssertionConfig);


            //Prepare infrastructure for test
            using (var browserAdapter = BrowserAdapter.Create(browserAdapterConfig))
            {
                //Test
                browserAdapter.NavigateTo("TestForms/Index/");
                browserAdapter.AssertView("SampleFullPage");
            }
        }
Ejemplo n.º 2
0
        public void should_be_able_to_run_test_with_configuration_from_file_and_use_label_text_to_access_fields()
        {
            //Initialize MvcPages
            var browserAdapterConfig = BrowserAdapterConfig.FromAppConfig(TestContext.CurrentContext.TestDirectory);

            //Initialize VisualAssertions
            var visualAssertionConfig = new VisualAssertionsConfig
            {
                BrowserName        = browserAdapterConfig.BrowserType.ToString(),
                ProjectName        = "Sample Project",
                ScreenshotCategory = "Sample Form",
                ProcessScreenshotsAsynchronously = true
            };

            browserAdapterConfig.VisualAssertion = new TelluriumVisualAssertion(visualAssertionConfig);


            //Prepare infrastructure for test
            using (var browserAdapter = BrowserAdapter.Create(browserAdapterConfig))
            {
                //Test
                browserAdapter.NavigateTo("TestForms/Index/");
                browserAdapter.AssertView("Sample31");

                var detinationForm = browserAdapter.GetForm(FormsIds.TestFormDst);
                var sourcenForm    = browserAdapter.GetForm(FormsIds.TestFormSrc);

                var textInputValue = sourcenForm.GetFieldValueByLabel("Text input");
                detinationForm.SetFieldValueByLabel("Text input", textInputValue);

                var textAreaValue = sourcenForm.GetFieldValueByLabel("Multiline input");
                detinationForm.SetFieldValueByLabel("Multiline input", textAreaValue);

                var passwordValue = sourcenForm.GetFieldValueByLabel("Password input");
                detinationForm.SetFieldValueByLabel("Password input", passwordValue);


                var checkboxValue = sourcenForm.GetFieldValueByLabel("Checkbox input");
                detinationForm.SetFieldValueByLabel("Checkbox input", checkboxValue);

                var selectListValue = sourcenForm.GetFieldValueByLabel("Select input");
                detinationForm.SetFieldValueByLabel("Select input", selectListValue);

                var multiselectListValue = sourcenForm.GetFieldValueByLabel("MultiSelect input");
                detinationForm.SetFieldValueByLabel("MultiSelect input", multiselectListValue);

                browserAdapter.AssertView("Sample33");
            }
        }
Ejemplo n.º 3
0
        //[TestCase(BrowserType.InternetExplorer)]
        public void should_be_able_to_fill_sample_form(BrowserType driverType)
        {
            //Initialize MvcPages
            var browserAdapterConfig = new BrowserAdapterConfig()
            {
                BrowserType          = driverType,
                SeleniumDriversPath  = Path.Combine(TestContext.CurrentContext.TestDirectory, "Drivers"),
                PageUrl              = "http://*****:*****@"c:\selenium\",
                BrowserDimensions    = new BrowserDimensionsConfig
                {
                    Width  = 1200,
                    Height = 768
                },
                BrowserCameraConfig = new BrowserCameraConfig
                {
                    LensType = LensType.Regular
                }
            };

            var visualAssertionConfig = new VisualAssertionsConfig
            {
                BrowserName        = driverType.ToString(),
                ProjectName        = "Sample Project",
                ScreenshotCategory = "Sample Form",
                ProcessScreenshotsAsynchronously = true,
            };

            //Initialize VisualAssertions
            browserAdapterConfig.VisualAssertion = new TelluriumVisualAssertion(visualAssertionConfig);


            //Prepare infrastructure for test
            using (var browserAdapter = BrowserAdapter.Create(browserAdapterConfig))
            {
                //Test
                browserAdapter.NavigateTo <TestFormsController>(c => c.Index());
                browserAdapter.AssertView("Sample11");

                var detinationForm = browserAdapter.GetForm <SampleFormViewModel>(FormsIds.TestFormDst);
                var sourcenForm    = browserAdapter.GetForm <SampleFormViewModel>(FormsIds.TestFormSrc);

                browserAdapter.AssertView("Destination form");
                browserAdapter.AssertView("Source form");

                var textInputValue = sourcenForm.GetFieldValue(x => x.TextInput);
                detinationForm.SetFieldValue(x => x.TextInput, textInputValue);

                var textAreaValue = sourcenForm.GetFieldValue(x => x.TextAreaInput);
                detinationForm.SetFieldValue(x => x.TextAreaInput, textAreaValue);

                var passwordValue = sourcenForm.GetFieldValue(x => x.PasswordInput);
                detinationForm.SetFieldValue(x => x.PasswordInput, passwordValue);


                var checkboxValue = sourcenForm.GetFieldValue(x => x.CheckboxInput);
                detinationForm.SetFieldValue(x => x.CheckboxInput, checkboxValue);

                var selectListValue = sourcenForm.GetFieldValue(x => x.SelectListValue);
                detinationForm.SetFieldValue(x => x.SelectListValue, selectListValue);

                var multiselectListValue = sourcenForm.GetFieldValue(x => x.MultiSelectListValue);
                detinationForm.SetFieldValue(x => x.MultiSelectListValue, multiselectListValue);

                browserAdapter.AssertView("Sample12");

                detinationForm.SetFieldValue("SingleFile", "SampleFileToUpload.docx");
            }
        }