Esempio n. 1
0
        private void FillAllDetails()
        {
            AutomationElement aeNameTextBox = MVVMRIPage<SilverlightAppLauncher>.NameTextBox;
            aeNameTextBox.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("Name"));
            Thread.Sleep(1000);

            AutomationElement aeAgeTextBox = MVVMRIPage<SilverlightAppLauncher>.AgeTextBox;
            aeAgeTextBox.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidAge"));
            Thread.Sleep(1000);


            String validText = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidText");
            AutomationElementCollection aeQuestion1 = MVVMRIPage<SilverlightAppLauncher>.OpenQuestions;
            aeQuestion1[0].SetValue(validText);
            Thread.Sleep(1000);

            AutomationElement aeQuestion4 = MVVMRIPage<SilverlightAppLauncher>.NumericQuestion;
            aeQuestion4.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidNumber"));
            Thread.Sleep(1000);

            AutomationElementCollection aeQuestion2 = MVVMRIPage<SilverlightAppLauncher>.CheckBox;
            Assert.IsNotNull(aeQuestion2[1], "Choice 2 is not loaded");
            aeQuestion2[1].SetFocus();
            System.Windows.Forms.SendKeys.SendWait(" ");
            Thread.Sleep(1000);

            String textwithSpecChar = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars");
            AutomationElementCollection aeOpenQuestions2 = MVVMRIPage<SilverlightAppLauncher>.OpenQuestions;
            aeOpenQuestions2[1].SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars"));
            Thread.Sleep(1000);
        }
        public static void AssertPositionSummaryRowCount()
        {
            GridPattern gridPattern = GetGridPattern();
            //read number of account positions from the AccountPosition.xml data file
            string positionRowCount = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("PositionSummaryRowCount");

            //testDataInfrastructure.GetCount<AccountPositionDataProvider, AccountPosition>();
            Assert.AreEqual(positionRowCount, gridPattern.Current.RowCount.ToString());
        }
Esempio n. 3
0
        private static void InternalAssertContent(AutomationElement aeControl, string nameValue, string message)
        {
            //find text block using AutomationElement of window
            string            actualValue;
            string            expectedValue;
            ResXConfigHandler resx = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile"));

            actualValue   = aeControl.Current.Name;
            expectedValue = resx.GetValue(nameValue);
            Assert.AreEqual(actualValue, expectedValue, true, message);
        }
Esempio n. 4
0
        public void SilverlightvalidateItemsRemaining()
        {
            String validText = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidText");
            AutomationElementCollection aeOpenQuestions = BasicMVVMPage <SilverlightAppLauncher> .OpenQuestions;

            aeOpenQuestions[0].SetValue(validText);
            Thread.Sleep(1000);

            AutomationElement aeNumberOfCharRemaining = BasicMVVMPage <SilverlightAppLauncher> .NumberOfQuesRemaining;

            Assert.IsNotNull(aeNumberOfCharRemaining, "Number Of Questions Remaining is not loaded Or calculation might be wrong");
        }
Esempio n. 5
0
        public void SilverlightAnswerOpenQuestion1()
        {
            String validText = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidText");
            AutomationElementCollection aeOpenQuestions = BasicMVVMPage <SilverlightAppLauncher> .OpenQuestions;

            Assert.IsNotNull(aeOpenQuestions[0], "Open Question 1 is loaded");
            aeOpenQuestions[0].SetFocus();
            aeOpenQuestions[0].SetValue(validText);
            Thread.Sleep(2000);
            Assert.AreEqual(aeOpenQuestions[0].GetValue().ToString(), validText);

            //Check Number of characters remaining
            AutomationElement aeNumberOfCharRemaining = BasicMVVMPage <SilverlightAppLauncher> .NumberOfCharRemainingOQ1;

            Assert.IsNotNull(aeNumberOfCharRemaining, "Number Of Char Remaining for Question1 is not loaded Or calculation might be wrong");
        }
Esempio n. 6
0
        public void SilverlightValidateOpenQuestion2()
        {
            String textwithSpecChar = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars");
            AutomationElementCollection aeOpenQuestions2 = BasicMVVMPage <SilverlightAppLauncher> .OpenQuestions;

            Assert.IsNotNull(aeOpenQuestions2[1], "Open Question 2 is not loaded");
            aeOpenQuestions2[1].SetFocus();
            aeOpenQuestions2[1].SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars"));
            Thread.Sleep(2000);
            Assert.AreEqual(aeOpenQuestions2[1].GetValue().ToString(), textwithSpecChar);

            //Check Number of characters remaining
            AutomationElement aeNumberOfCharRemaining = BasicMVVMPage <SilverlightAppLauncher> .NumberOfCharRemainingOQ2;

            Assert.IsNotNull(aeNumberOfCharRemaining, "Number Of Char Remaining for Open Question 2 is not loaded Or calculation might be wrong");

            //Check that maximum of 25 characters can be entered
            //aeOpenQuestions2[1].SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("MaxCharsQ3"));
            //Thread.Sleep(10000);
            //Assert.AreEqual(aeOpenQuestions2[1].GetValue().ToString(), new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("MaxCharsAllowedQ3"));
        }
Esempio n. 7
0
        public static string GetControlId(string key)
        {
            ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile"));

            return(testInputHandler.GetValue(key));
        }
Esempio n. 8
0
        public static string GetTestInputData(string key)
        {
            ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile"));

            return(testInputHandler.GetValue(key));
        }
Esempio n. 9
0
        public void TakeSurveyTest()
        {
            AutomationElement TakeSurveyButton = MVVMRIPage<SilverlightAppLauncher>.TakeSurvey;
            Assert.IsNotNull(TakeSurveyButton, "Take Survey button is not loaded");
            TakeSurveyButton.Click();

            //See if any control is accessible
            MVVMRIPage<SilverlightAppLauncher>.Window = GetSurveyWindow();

            #region Name validation
            AutomationElement aeNameTextBox = MVVMRIPage<SilverlightAppLauncher>.NameTextBox;
            Assert.IsNotNull(aeNameTextBox, "Name field is not loaded");
            aeNameTextBox.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("Name"));
            Thread.Sleep(2000);
            Assert.AreEqual(aeNameTextBox.GetValue().ToString(), new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("Name"));
            #endregion

            #region Age Validation
            //Positive test case to validate Age
            AutomationElement aeAgeTextBox = MVVMRIPage<SilverlightAppLauncher>.AgeTextBox;
            Assert.IsNotNull(aeAgeTextBox, "Age Field is not loaded");
            aeAgeTextBox.SetFocus();
            aeAgeTextBox.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidAge"));
            Thread.Sleep(2000);
            Assert.AreEqual(aeAgeTextBox.GetValue().ToString(), new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidAge"));
            AutomationElement aeValidateAgeP = MVVMRIPage<SilverlightAppLauncher>.AgeValidation;
            Assert.IsNull(aeValidateAgeP, "Validation Error for Age");
            //AutomationElement aeValidation = BasicMVVMPage<SilverlightAppLauncher>.ValidationSummary;
            //Assert.IsTrue(aeValidation.Current.Name == new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("DefaultValidationText"), "Age  - Validation error");
                      
            #endregion
          
            #region Open Question1
            String validText = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidText");
            AutomationElementCollection aeOpenQuestions = MVVMRIPage<SilverlightAppLauncher>.OpenQuestions;
            Assert.IsNotNull(aeOpenQuestions[0], "Open Question 1 is loaded");
            aeOpenQuestions[0].SetFocus();
            aeOpenQuestions[0].SetValue(validText);
            Thread.Sleep(2000);
            Assert.AreEqual(aeOpenQuestions[0].GetValue().ToString(), validText);
            #endregion
          
            #region Numeric question
            AutomationElement aeNumQuestion = MVVMRIPage<SilverlightAppLauncher>.NumericQuestion;
            Assert.IsNotNull(aeNumQuestion, "Numeric Question is not loaded");
            aeNumQuestion.SetFocus();
            aeNumQuestion.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ValidNumber"));
            Thread.Sleep(2000);
            AutomationElement aeValidatePositiveNumQ = MVVMRIPage<SilverlightAppLauncher>.ValidationNumericQ;
            Assert.IsNull(aeValidatePositiveNumQ, "Validation Error for Numeric Question");

            //Negative Test Case
            aeNumQuestion.SetFocus();
            aeNumQuestion.SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("InvalidNumber"));
            Thread.Sleep(2000);
            AutomationElement aeValidateNumQ = MVVMRIPage<SilverlightAppLauncher>.ValidationNumericQ;
            //Assert.IsNotNull(aeValidateNumQ, "No Validation for Numeric Question");
            #endregion
         
            #region multiple choice question
            AutomationElementCollection aeQuestion2 = MVVMRIPage<SilverlightAppLauncher>.CheckBox;
            Assert.IsNotNull(aeQuestion2[1], "Choice 2 is not loaded");
            aeQuestion2[1].SetFocus();
            System.Windows.Forms.SendKeys.SendWait(" ");
            Thread.Sleep(1000);
            aeQuestion2[2].SetFocus();
            System.Windows.Forms.SendKeys.SendWait(" ");
            Thread.Sleep(1000);
            aeQuestion2[3].SetFocus();
            System.Windows.Forms.SendKeys.SendWait(" ");
            Thread.Sleep(1000);
            #endregion
            
            #region Open question2
            String textwithSpecChar = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars");
            AutomationElementCollection aeOpenQuestions2 = MVVMRIPage<SilverlightAppLauncher>.OpenQuestions;
            Assert.IsNotNull(aeOpenQuestions2[1], "Open Question 2 is not loaded");
            aeOpenQuestions2[1].SetFocus();
            aeOpenQuestions2[1].SetValue(new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("TextWithSpecChars"));
            Thread.Sleep(2000);
            Assert.AreEqual(aeOpenQuestions2[1].GetValue().ToString(), textwithSpecChar);
            #endregion
        }