Exemplo n.º 1
0
        public EA_POM Search_Enrolment()
        {
            Thread.Sleep(2000);
            //Clicking on DropDown

            Hash_Drop.ElementAt(0).Click();
            Thread.Sleep(3000);
            //Clicking inside the Search box
            Search_Records.ElementAt(0).Click();
            //Passing data into Search box
            Search_Records.ElementAt(0).SendKeys("1741");
            try
            {
                //Clicking on Search btn
                Search_btn.ElementAt(0).Click();
                //getting button Element
                Search_btn_bool = Search_btn.ElementAt(0).Displayed;
                Thread.Sleep(3000);
                //Search button verify
                if (Search_btn_bool == true)
                {
                    Asserts.Assert_Search_btn(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_btn(false);
            }
            //Verifying Search results
            for (int i = 0; i < Search_Record_Results.Count; i++)
            {
                Id_Bool = Search_Record_Results[i].Displayed;
                Console.WriteLine(Search_Record_Results[i].Text);
            }
            if (Id_Bool == true)
            {
                Asserts.Assert_Id_Found(true);
            }
            else
            {
                Asserts.Assert_Id_Found(false);
            }

            Thread.Sleep(3000);
            Double_click[0] = true;
            // Web_Driver.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
            Double();
            //Clicking on Clear Button
            Thread.Sleep(3000);
            try
            {
                //Verifying Search_Clear button
                Clear_Btn.ElementAt(0).Click();
                Clear_Bool = Clear_Btn.ElementAt(0).Displayed;

                if (Clear_Bool == true)
                {
                    Asserts.Assert_Search_Clear(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_Clear(false);
            }
            //Disapear Drop
            Thread.Sleep(3000);
            Hash_Drop.ElementAt(0).Click();
            //Verifying Search With Name

            //Clicking on DropDown
            Hash_Drop.ElementAt(1).Click();
            Thread.Sleep(3000);
            //Clicking inside the Search box
            Search_Records.ElementAt(1).Click();
            //Passing data into Search box
            Search_Records.ElementAt(1).SendKeys("Usama");
            try
            {
                //Clicking on Search btn
                Search_btn.ElementAt(1).Click();
                //getting button Element
                Search_btn1_bool = Search_btn.ElementAt(1).Displayed;
                Thread.Sleep(3000);
                //Search button verify
                if (Search_btn1_bool == true)
                {
                    Asserts.Assert_Search_btn(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_btn(false);
            }
            //Verifying Search results

            try
            {
                int    i;
                bool[] Name_Bool = new bool[Search_Record_Results.Count];
                Console.WriteLine(Search_Record_Results.Count + "" +
                                  " Records");
                for (i = 0; i < Search_Record_Results.Count; i++)
                {
                    Name_Bool[i] = Search_Record_Results[i].Displayed;
                    Console.WriteLine(Search_Record_Results[i].Text);
                    if (Name_Bool[i] == true)
                    {
                        Asserts.Assert_Name_Found(Name_Bool[i]);
                    }
                }

                if (Search_Record_Results.Count == 0)
                {
                    Asserts.Assert_Name_Found(false);
                }
            }
            catch
            {
            }

            Thread.Sleep(3000);
            Double_click[1] = true;
            // Web_Driver.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
            Double();
            //Clicking on Clear Button
            Thread.Sleep(3000);
            try
            {
                //Verifying Search_Clear button
                Clear_Btn.ElementAt(1).Click();
                Clear_Bool_1 = Clear_Btn.ElementAt(1).Displayed;

                if (Clear_Bool_1 == true)
                {
                    Asserts.Assert_Search_Clear(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_Clear(false);
            }
            //Disapear Drop
            Thread.Sleep(3000);
            Hash_Drop.ElementAt(1).Click();
            //Verifying email Address
            Hash_Drop.ElementAt(2).Click();
            Thread.Sleep(3000);
            //Clicking inside the Search box
            Search_Records.ElementAt(2).Click();
            //Passing data into Search box
            Search_Records.ElementAt(2).SendKeys("*****@*****.**");
            try
            {
                //Clicking on Search btn
                Search_btn2_bool = Search_btn.ElementAt(2).Displayed;
                Search_btn.ElementAt(2).Click();
                //getting button Element

                Console.WriteLine(Search_btn2_bool);
                Thread.Sleep(3000);
                //Search button verify
                if (Search_btn2_bool == true)
                {
                    Asserts.Assert_Search_btn(true);
                }
                else
                {
                    Asserts.Assert_Search_btn(false);
                }
            }
            catch
            {
            }
            try
            {
                //Verifying Search results
                int    i          = 0;
                bool[] Email_Bool = new bool[Search_Record_Results.Count];
                for (i = 0; i < Search_Record_Results.Count; i++)
                {
                    Email_Bool[i] = Search_Record_Results[i].Displayed;
                    Console.WriteLine(Search_Record_Results[i].Text);
                    Console.WriteLine(Email_Bool + "  Email bool");
                    if (Email_Bool[i] == true)
                    {
                        Asserts.Assert_Email_Found(Email_Bool[i]);
                    }
                }

                if (Search_Record_Results.Count == 0)
                {
                    Asserts.Assert_Email_Found(false);
                }
            }
            catch
            {
            }



            Thread.Sleep(3000);
            Double_click[2] = true;
            // Web_Driver.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
            Double();
            //Clicking on Clear Button
            Thread.Sleep(3000);
            try
            {
                //Verifying Search_Clear button
                Clear_Btn.ElementAt(4).Click();
                Clear_Bool_2 = Clear_Btn.ElementAt(2).Displayed;

                if (Clear_Bool_2 == true)
                {
                    Asserts.Assert_Search_Clear(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_Clear(false);
            }
            //Disapear Drop
            Thread.Sleep(3000);
            Hash_Drop.ElementAt(2).Click();
            //Verifying Plan Records
            //Clicking on DropDown
            Hash_Drop.ElementAt(3).Click();
            Thread.Sleep(3000);
            //Clicking inside the Search box
            Search_Records.ElementAt(3).Click();
            //Passing data into Search box
            Search_Records.ElementAt(3).SendKeys("H7607-003-003");
            try
            {
                //Clicking on Search btn
                Search_btn.ElementAt(3).Click();
                //getting button Element
                Search_btn3_bool = Search_btn.ElementAt(3).Displayed;
                Thread.Sleep(3000);
                //Search button verify
                if (Search_btn3_bool == true)
                {
                    Asserts.Assert_Search_btn(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_btn(false);
            }
            //Verifying Search results
            try
            {
                int    i;
                bool[] Plan_Bool = new bool[Search_Record_Results.Count];
                for (i = 0; i < Search_Record_Results.Count; i++)
                {
                    Plan_Bool[i] = Search_Record_Results[20].Displayed;
                    Console.WriteLine(Search_Record_Results[i].Text);
                    if (Plan_Bool[i] == true)
                    {
                        Asserts.Assert_Plan_Found(Plan_Bool[i]);
                    }
                }
                if (Search_Record_Results.Count == 0)
                {
                    Asserts.Assert_Plan_Found(false);
                }
            }
            catch
            {
            }

            Thread.Sleep(3000);
            Double_click[3] = true;
            // Web_Driver.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
            Double();
            //Clicking on Clear Button
            Thread.Sleep(3000);
            try
            {
                //Verifying Search_Clear button
                Clear_Btn.ElementAt(3).Click();
                Clear_Bool_3 = Clear_Btn.ElementAt(3).Displayed;
                Console.WriteLine(Clear_Bool_3);



                if (Clear_Bool_3 == true)
                {
                    Asserts.Assert_Search_Clear(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_Clear(false);
            }
            //Disapear Drop
            Thread.Sleep(3000);
            Hash_Drop.ElementAt(3).Click();

            //Verifying Created
            //Getting Latest date
            Created_Latest_Date = Created_Date.Text;
            Console.WriteLine(Created_Latest_Date);
            Created_Click.Click();
            Thread.Sleep(3000);
            Created_Last_Date = Created_Date.Text;
            Console.WriteLine(Created_Last_Date);
            Asserts.Date_Comparison(Created_Latest_Date, Created_Last_Date);
            //Verifying Status
            Hash_Drop.ElementAt(4).Click();
            Thread.Sleep(3000);
            //Clicking inside the Search box
            Search_Records.ElementAt(4).Click();
            //Passing data into Search box
            Search_Records.ElementAt(4).SendKeys("Draft");
            try
            {
                //Clicking on Search btn

                Search_btn.ElementAt(5).Click();
                //getting button Element
                Search_btn4_bool = Search_btn.ElementAt(5).Displayed;
                Thread.Sleep(3000);
                //Search button verify
                if (Search_btn4_bool == true)
                {
                    Asserts.Assert_Search_btn(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_btn(false);
            }
            //Verifying Search results
            try
            {
                int    i;
                bool[] Status_Bool = new bool[Search_Record_Results.Count];
                for (i = 67; i < Search_Record_Results.Count; i++)
                {
                    Status_Bool[i] = Search_Record_Results[i].Displayed;
                    Console.WriteLine(Search_Record_Results[i].Text);
                    if (Status_Bool[i] == true)
                    {
                        Asserts.Assert_Status_Found(Status_Bool[i]);
                    }
                }
                if (Search_Record_Results.Count == 0)
                {
                    Asserts.Assert_Status_Found(false);
                }
            }
            catch

            {
            }

            Thread.Sleep(3000);
            Double_click[4] = true;
            // Web_Driver.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
            Double();
            //Clicking on Clear Button
            Thread.Sleep(3000);
            try
            {
                //Verifying Search_Clear button
                Clear_Btn.ElementAt(5).Click();
                Clear_Bool_4 = Clear_Btn.ElementAt(5).Displayed;

                if (Clear_Bool_4 == true)
                {
                    Asserts.Assert_Search_Clear(true);
                }
            }
            catch
            {
                Asserts.Assert_Search_Clear(false);
            }
            //Disapear Drop
            Thread.Sleep(3000);
            Hash_Drop.ElementAt(4).Click();
            return(new EA_POM());
        }