Ejemplo n.º 1
0
        public EA_POM Create_Enrolment()
        {
            Thread.Sleep(3000);
            //   string[] vals = new string[] { "H7607-002-001", "H7607-002-002", "H7607-002-003", "H7607-003-001", "H7607-003-002", "H7607-003-003" };
            En_Tab_Click.Click();
            Thread.Sleep(3000);
            Pre_Id = Previous_ID_txt.ElementAt(0).Text;
            int.TryParse(Pre_Id, out Previous_ID);
            Create_En_btn.Click();
            Url_Creat_En_page = Web_Driver.driver.Url;
            Asserts.Url_Create_En(Url_Creat_En_page, Url_En_page);
            Console.WriteLine(Url_Creat_En_page);
            Console.WriteLine(Url_En_page);
            //Plan radio button verifying
            for (int i = 0; i < Plan_Radio_btn.Count; i++)
            {
                try
                {
                    Plan_Radio_btn.ElementAt(i).Click();
                    radio = Plan_Radio_btn.ElementAt(i).Selected;
                    if (radio = Plan_Radio_btn.ElementAt(i).Selected)
                    {
                        //  Console.WriteLine(Plan_Radio_btn.ElementAt(i).Selected + "Button  clicked");
                        Asserts.Assert_Radiobtn(radio);
                    }
                }
                catch
                {
                    Asserts.Assert_Radiobtn(false);
                }
            }
            // List<string> list = new List<string>();
            IList <IWebElement> rows = Web_Driver.driver.FindElements(By.XPath("//table[@class='table-responsive table-bordered']//tbody//tr"));

            for (int i = 3; i < 6; i++)
            {
                // Console.WriteLine(rows[i].Text);
                if (rows[i].Text == "H7607-002-001 Los Angeles" || rows[i].Text == "H7607-002-002 Orange" || rows[i].Text == "H7607-002-003 San Diego")
                {
                    // Console.WriteLine(rows[i].Text);
                    bool txtverified = true;
                    Asserts.Assert_Plans(txtverified);
                }
                else
                {
                    bool txtverified = false;
                    Asserts.Assert_Plans(txtverified);
                }
                for (int j = 7; j < 10; j++)
                {
                    //Console.WriteLine(rows[i].Text);
                    if (rows[j].Text == "H7607-003-001 Los Angeles" || rows[j].Text == "H7607-003-002 Orange" || rows[j].Text == "H7607-003-003 San Diego")
                    {
                        //  Console.WriteLine(rows[j].Text);
                        bool txtverified = true;
                        Asserts.Assert_Plans1(txtverified);
                    }
                    else
                    {
                        bool txtverified = false;
                        Asserts.Assert_Plans1(txtverified);
                    }
                }
            }



            //First name verified
            Name.SendKeys("Usama");


            //Last name verified
            LName.SendKeys("Sohail");


            //Middle name verified

            MName.SendKeys("Puma");



            //Required Date Of Birth verified
            Dob.SendKeys("05/07/2020");

            //Sex Male/FeeMale radio btns
            for (int i = 0; i < Radio_M_F.Count; i++)
            {
                try
                {
                    Radio_M_F.ElementAt(i).Click();
                    radio_1 = Radio_M_F.ElementAt(i).Selected;
                    if (radio_1 = Radio_M_F.ElementAt(i).Selected)
                    {
                        Console.WriteLine(Radio_M_F.ElementAt(i).Selected + "Button is  clicked");
                        Asserts.Assert_Radiobtn(radio_1);
                    }
                }
                catch
                {
                    Asserts.Assert_Radiobtn(false);
                }
            }
            /// Entring Home Phone
            Hphone.SendKeys("5672348791");
            //Entering Permanent Address
            P_Address.SendKeys("72 Health center");
            //Entering Permanent City
            P_City.SendKeys("Lahore");
            //Entering Permanent County
            P_County.SendKeys("Pak");
            //Entering Permanent State
            P_State.SendKeys("Pakistan");
            //Entering Permanent Zip
            P_Zip.SendKeys("315550");
            //Mailing Adress CheckBox
            Mailing_Adress.Click();
            checkbox = Mailing_Adress.Selected;
            if (checkbox == true)
            {
                Asserts.Mailing_Checkbox(true);
            }
            else
            {
                Asserts.Mailing_Checkbox(false);
            }

            //Entering data into street address input box

            Street_Adress.SendKeys("72 Health center street No 10");
            //Entering data into Mailing City

            Mailing_City.SendKeys("Faisalabad");
            //Entering data into Mailing State

            Mailing_State.SendKeys("England");
            //Entering data into Mailing Zipcode

            Mailing_Zip.SendKeys("4532678");
            //Entering data into MdNumber

            MD_Number.SendKeys("Md-9999");
            //Entering data into AttorneName
            AttorneyName.SendKeys("Gul");
            //Entering data into AttorneAdree
            AttorneyAddress.SendKeys("123 street near new clonoy 1");
            //Entering data into Attorny Phone
            AttorneyPhone.SendKeys("2324445787");
            //Entering data into Attorny Phone
            Attorneyrelation.SendKeys("Cousin");
            for (int i = 0; i < Section_2_Checkbox2.Count; i++)
            {
                try
                {
                    Section_2_Checkbox2.ElementAt(i).Click();
                    Section_2_checked1 = Section_2_Checkbox2.ElementAt(i).Selected;
                    if (Section_2_checked1 = Section_2_Checkbox2.ElementAt(i).Selected)
                    {
                        Console.WriteLine(Section_2_Checkbox2.ElementAt(i).Selected + "Section 2 Button not clicked");
                        Asserts.Section2_Checkbox(Section_2_checked1);
                    }
                }
                catch
                {
                    Asserts.Section2_Checkbox(false);
                }

                {
                }
            }
            for (int i = 0; i < Section_2_Checkbox.Count; i++)
            {
                try
                {
                    Section_2_Checkbox.ElementAt(i).Click();
                    Section_2_checked = Section_2_Checkbox.ElementAt(i).Selected;
                    if (Section_2_checked = Section_2_Checkbox.ElementAt(i).Selected)
                    {
                        Console.WriteLine(Section_2_Checkbox.ElementAt(i).Selected + "Button not clicked");
                        Asserts.Assert_Radiobtn(Section_2_checked);
                    }
                }
                catch
                {
                    Asserts.Assert_Radiobtn(false);
                }

                {
                }
            }
            //Entring email address
            Email_Adress.SendKeys("*****@*****.**");
            Premium_check.Click();
            premium = Premium_check.Selected;
            if (premium == true)
            {
                Asserts.Section2_Checkbox(true);
            }
            else
            {
                Asserts.Section2_Checkbox(false);
            }
            for (int i = 0; i < Attestation.Count; i++)
            {
                try
                {
                    Attestation.ElementAt(i).Click();
                    radio_2 = Attestation.ElementAt(i).Selected;
                    if (radio_2 == true)
                    {
                        Console.WriteLine(Attestation.ElementAt(i).Selected + "Attestation Radio Button  clicked");
                        Asserts.Assert_Radiobtn(radio_2);
                    }
                }
                catch
                {
                    Asserts.Assert_Radiobtn(false);
                }

                Genrete_Enrolment.ElementAt(1).Click();
                Web_Driver.ngWebDriver.WaitForAngular();
                Genrete_Enrolment_Yes_Btn.ElementAt(1).Click();
                Web_Driver.ngWebDriver.WaitForAngular();
                Genrete_Appoinment_Ok_Btn.ElementAt(1).Click();
                Web_Driver.ngWebDriver.WaitForAngular();
                Web_Driver.driver.Navigate().Refresh();
                Web_Driver.ngWebDriver.WaitForAngular();
                Up_Id = Created_ID_txt.ElementAt(0).Text;
                int.TryParse(Up_Id, out Updated_ID);
                Asserts.ID_Compare(Updated_ID, Previous_ID);
                Console.WriteLine(Previous_ID);
                Console.WriteLine(Updated_ID);
            }
            return(new EA_POM());
        }