コード例 #1
0
ファイル: ValidateSearchCodedUI.cs プロジェクト: XpiritBV/PU
        public void BuyOneProductCodedUI()
        {
            var bw = BrowserWindow.Launch("http://localhost:5001");
            HtmlDiv categoryDiv = new HtmlDiv(bw);
            categoryDiv.SearchProperties.Add(HtmlControl.PropertyNames.Class, "hidden-xs", PropertyExpressionOperator.Contains);

            HtmlHyperlink lightingCategoryLink = new HtmlHyperlink(categoryDiv);
            lightingCategoryLink.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Lighting", PropertyExpressionOperator.Contains);

            Mouse.Click(lightingCategoryLink);
            HtmlDiv Container = new HtmlDiv(bw);
            Container.SearchProperties.Add(HtmlControl.PropertyNames.Class, "container", PropertyExpressionOperator.Contains);

            HtmlHyperlink lightingProduct = new HtmlHyperlink(bw);
            lightingProduct.SearchProperties.Add(HtmlControl.PropertyNames.Title, "Halogen Headlights", PropertyExpressionOperator.Contains);

            Mouse.Click(lightingProduct);

            HtmlHyperlink ProductLink = new HtmlHyperlink(bw);
            ProductLink.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Add to Cart", PropertyExpressionOperator.Contains);

            Assert.IsTrue(ProductLink.TryFind());
        }
コード例 #2
0
        public static void eReg_WorkExperiance()
        {
            //Create browserwindow
            BrowserWindow browind = new BrowserWindow();
            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Work Experience";


            // Is this employer a staffing company? 

            HtmlComboBox empstaff = new HtmlComboBox(browind);
            empstaff.SearchProperties[HtmlComboBox.PropertyNames.Id] = "Employer1_staffingBox";
            //empstaff.DrawHighlight();

            //Employer (If you worked through a staffing company, enter the Staffing Company name as the Employer)

            HtmlEdit employer = new HtmlEdit(browind);
            employer.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_name";
            //employer.DrawHighlight();

            //Current or Former Employer?
            HtmlComboBox currentemp = new HtmlComboBox(browind);
            currentemp.SearchProperties[HtmlComboBox.PropertyNames.Id] = "Employer1_type";
            //currentemp.DrawHighlight();

            //Job Title
            HtmlEdit jobtitle = new HtmlEdit(browind);
            jobtitle.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_jobtitle";
            //jobtitle.DrawHighlight();

            //Pay Rate/Salary  xx.xx
            HtmlEdit empsal = new HtmlEdit(browind);
            empsal.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_salary";
            //empsal.DrawHighlight();

            //Pay Frequency
            HtmlComboBox emprate = new HtmlComboBox(browind);
            emprate.SearchProperties[HtmlComboBox.PropertyNames.Id] = "Employer1_rate";
           // emprate.DrawHighlight();

            //Start Date  mm/yyyy
            HtmlEdit empstart = new HtmlEdit(browind);
            empstart.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_start";
            //empstart.DrawHighlight();

            //End Date  mm/yyyy
            HtmlEdit empend = new HtmlEdit(browind);
            empend.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_end";
            //empend.DrawHighlight();

            //Supervisor/Manager Name
            HtmlEdit supename = new HtmlEdit(browind);
            supename.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_supename";
            //supename.DrawHighlight();

            //Mouse.MoveScrollWheel(-100);

            //Supervisor/Manager Title
            HtmlEdit suptitle = new HtmlEdit(browind);
            suptitle.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_supetitle";
            //suptitle.DrawHighlight();


            //Address
            HtmlEdit empadd = new HtmlEdit(browind);
            empadd.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_address";
            //empadd.DrawHighlight();

            //City
            HtmlEdit empcity = new HtmlEdit(browind);
            empcity.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_city";
            //empcity.DrawHighlight();

            //State/Prov.
            HtmlComboBox empstate = new HtmlComboBox(browind);
            empstate.SearchProperties[HtmlComboBox.PropertyNames.Id] = "Employer1_state";
           // empstate.DrawHighlight();

            //Postal/ZIP Code
            HtmlEdit empzip = new HtmlEdit(browind);
            empzip.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_zip";
            //empzip.DrawHighlight();

            //Country
            HtmlComboBox empcountry = new HtmlComboBox(browind);
            empcountry.SearchProperties[HtmlComboBox.PropertyNames.Id] = "Employer1_country";
            //empcountry.DrawHighlight();

            //Area Code
            HtmlEdit areacode = new HtmlEdit(browind);
            areacode.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_phone_areacode";
           // areacode.DrawHighlight();

            //Phone
            HtmlEdit empphone = new HtmlEdit(browind);
            empphone.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_phone";
            //empphone.DrawHighlight();

            //Ext.
            HtmlEdit empext = new HtmlEdit(browind);
            empext.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_ext";
            //empext.DrawHighlight();

            //Job Duties (2000 characters max)
            HtmlEdit duties = new HtmlEdit(browind);
            duties.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_duties";
            duties.SearchProperties[HtmlEdit.PropertyNames.TagName] = "TEXTAREA";
            //duties.DrawHighlight();

            //Reason for leaving?
            HtmlEdit leaving = new HtmlEdit(browind);
            leaving.SearchProperties[HtmlEdit.PropertyNames.Id] = "Employer1_leaving";
            //leaving.DrawHighlight();

            // Verify any WorkExperience is exist
            
            //Click on Delete
            HtmlHyperlink empdel = new HtmlHyperlink(browind);
            empdel.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Delete";
            while (empdel.TryFind())
            {
                Mouse.MoveScrollWheel(-100);
                Mouse.Click(empdel);
                browind.WaitForControlReady(200);

            }

            //Fill up mandatory field and click "Add and Update" button
            empstaff.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, "No");
            employer.SetProperty(HtmlEdit.PropertyNames.Text, "Kelly Services");
            currentemp.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, "Current Employer");
            jobtitle.SetProperty(HtmlEdit.PropertyNames.Text, "Senior QA Analyst");
            empsal.SetProperty(HtmlEdit.PropertyNames.Text, "4000.00");
            emprate.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, "Monthly");
            empstart.SetProperty(HtmlEdit.PropertyNames.Text, "01/2006");
            empend.SetProperty(HtmlEdit.PropertyNames.Text, "08/2012");
            empcity.SetProperty(HtmlEdit.PropertyNames.Text, "Detroit");
            empstate.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, "Michigan");


            //Click on Add and Update
            HtmlInputButton addupdate = new HtmlInputButton(browind);
            addupdate.SearchProperties[HtmlInputButton.PropertyNames.Id] = "SaveRecordButton_button";
            addupdate.DrawHighlight();
            Mouse.Click(addupdate);


            /*****************/
            /* Progress Meter*/
            /*****************/
            HtmlCustom progress = new HtmlCustom(browind);
            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            progress.DrawHighlight();
            bool availabilty = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");
            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel";
                bar.DrawHighlight();
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                Assert.AreEqual(percentage, "45%");

            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }

            //Button "Save And Continue" 
            HtmlInputButton SaveNContinue = new HtmlInputButton(browind);
            SaveNContinue.SearchProperties[HtmlInputButton.PropertyNames.Id] = "ForwardButton_button";
            SaveNContinue.DrawHighlight();
            Mouse.Click(SaveNContinue);

        }
コード例 #3
0
        public static void eReg_EducationHistory()
        {
            //Create browserwindow
            BrowserWindow browind = new BrowserWindow();

            browind.SearchProperties[UITestControl.PropertyNames.Name] = "Education History";

            /********************/
            /*School/Institution*/
            /********************/
            //Education Level
            HtmlComboBox eduLvl = new HtmlComboBox(browind);

            eduLvl.SearchProperties[HtmlComboBox.PropertyNames.Id] = "School1_edu_level_code";
            string eduLevel = (string)eduLvl.GetProperty(HtmlComboBox.PropertyNames.SelectedItem);


            //Education Level Explanation (only if Other)
            HtmlTextArea edulvlexp = new HtmlTextArea(browind);

            edulvlexp.SearchProperties[HtmlTextArea.PropertyNames.Id] = "School1_edu_level_code_explain";


            //Attended/Graduated School As (provide Legal First and Last Name only)
            HtmlEdit AttendedName = new HtmlEdit(browind);

            AttendedName.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_attended_name";
            string name = (string)AttendedName.GetProperty(HtmlEdit.PropertyNames.Text);

            //School/Institution Name (specify if a satellite campus or online)
            HtmlEdit School = new HtmlEdit(browind);

            School.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1";
            string schoolname = (string)School.GetProperty(HtmlEdit.PropertyNames.Text);


            //City
            HtmlEdit ct = new HtmlEdit(browind);

            ct.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_city";
            string schoolcity = (string)ct.GetProperty(HtmlEdit.PropertyNames.Text);

            //State/Prov.
            HtmlComboBox prov = new HtmlComboBox(browind);

            prov.SearchProperties[HtmlComboBox.PropertyNames.Id] = "School1_state";
            string schoolstate = (string)prov.GetProperty(HtmlComboBox.PropertyNames.SelectedItem);

            //Country
            HtmlComboBox ctry = new HtmlComboBox(browind);

            ctry.SearchProperties[HtmlComboBox.PropertyNames.Id] = "School1_country";
            string schoolCountry = (string)ctry.GetProperty(HtmlComboBox.PropertyNames.SelectedItem);

            //Date attended from yyyy
            HtmlEdit From = new HtmlEdit(browind);

            From.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_from";
            string schoolfrom = (string)From.GetProperty(HtmlEdit.PropertyNames.Text);

            //Date attended to yyyy
            HtmlEdit dateto = new HtmlEdit(browind);

            dateto.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_to";

            //Status
            HtmlComboBox status = new HtmlComboBox(browind);

            status.SearchProperties[HtmlComboBox.PropertyNames.Id] = "School1_status";


            //Expected Completion/Graduation Date  mm/dd/yyyy
            HtmlEdit GraduationDate = new HtmlEdit(browind);

            GraduationDate.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_graduate";


            //GPA
            HtmlEdit GPA = new HtmlEdit(browind);

            GPA.SearchProperties[HtmlEdit.PropertyNames.Id] = "School1_GPA";


            //Discipline
            HtmlComboBox Disc = new HtmlComboBox(browind);

            Disc.SearchProperties[HtmlComboBox.PropertyNames.Id] = "School1_Discipline";
            string discipline = (string)Disc.GetProperty(HtmlComboBox.PropertyNames.SelectedItem);

            //Button "Save And Continue"
            HtmlInputButton SaveNContinue = new HtmlInputButton(browind);

            SaveNContinue.SearchProperties[HtmlInputButton.PropertyNames.Id] = "ForwardButton_button";



            /*****************/
            /* Progress Meter*/
            /*****************/
            HtmlCustom progress = new HtmlCustom(browind);

            progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter";
            bool   availabilty   = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists);
            string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW");

            if (workflowEvent == "S1PROSPECT")
            {
                Assert.IsTrue(availabilty, "Progress Meter is not showing");

                HtmlSpan bar = new HtmlSpan(browind);
                bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel";
                string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText);
                Assert.AreEqual(percentage, "40%");
            }
            else
            {
                Assert.IsFalse(availabilty, "Progress Meter is showing");
            }



            HtmlHyperlink del = new HtmlHyperlink(browind);

            del.SearchProperties[HtmlHyperlink.PropertyNames.InnerText] = "Delete";
            while (del.TryFind())
            {
                Mouse.Click(del);
                browind.WaitForControlReady(200);
            }

            //Fill in mandatory field

            eduLvl.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, PersonalInformation1.ReadData(1, "EducationLevel"));
            AttendedName.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "EducationAttendedName"));
            School.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "EducationSchoolName"));
            ct.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "EducationCity"));
            prov.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, PersonalInformation1.ReadData(1, "EducationState"));
            From.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "EducationAttendedFrom"));
            Mouse.MoveScrollWheel(-100);
            status.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, PersonalInformation1.ReadData(1, "EducationStatus"));
            string selectedstatus = (string)status.GetProperty(HtmlComboBox.PropertyNames.SelectedItem);

            if (selectedstatus == "Completed/Graduated")
            {
                GraduationDate.SetProperty(HtmlEdit.PropertyNames.Text, PersonalInformation1.ReadData(1, "GraduationDate"));
            }
            Disc.SetProperty(HtmlComboBox.PropertyNames.SelectedItem, PersonalInformation1.ReadData(1, "EducationDiscipline"));

            Mouse.MoveScrollWheel(-200);


            //Click "Save N Continue" button
            Mouse.Click(SaveNContinue);

            browind.WaitForControlReady(500);
        }