Exemplo n.º 1
0
        public void buyTicket()
        {
            string[] username = null;
            string[] password = null;
            string[] newusername = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            loginHelper = new AttendeeLoginHelper(GetWebDriver());
            eventHelper = new EventHelper(GetWebDriver());
            ticketHelper = new TicketHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "AttendeeUsername");
            password = oXMLData.getData("settings/credentials", "AttendeePassword");
            newusername = oXMLData.getData("settings/credentials", "Username");

            //Wait for text
            loginHelper.WaitForTextInPage("Use your email to sign in.", 40);

            //Verify Page title
            verifyTitle("Attendee.Events - Log in");

            //Login with email address
            Login(username[0], password[0]);
            Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

            //Click on sigin button
            loginHelper.ClickElement("Signin");

            //Verify Page title
            verifyTitle("Event List");

               // String Eventname = ticketHelper.GetText("FirstEvent");

            //Open first event
            ticketHelper.ClickElement("FirstEvent");

            //wait for text
            ticketHelper.WaitForTextInPage("Total:",30);

            //Click on register tab
            ticketHelper.clickLastElement("RegisterTab");

            //Click on Ticketting
            ticketHelper.ClickElement("Ticketting");

            //Wait for text
            ticketHelper.WaitForTextInPage("New Free Ticket", 30);

            //Click on New Free ticket
            ticketHelper.verifyticket("FreeTicket");

            //Click on home tab
            ticketHelper.ClickElement("HomeTab");

            //Click on user-id
            ticketHelper.ClickElement("LogOff");

            //Wait for text
            ticketHelper.WaitForTextInPage("Log in", 30);

            //Go to registration page
            ticketHelper.ClickElement("Register");

            //Click on Login link
            ticketHelper.ClickElement("Login");

            //Login into the application
            Login(newusername[0],password[0]);

            //Click on sign in button
            loginHelper.ClickElement("Signin");

            //wait for text
            ticketHelper.WaitForTextInPage(newusername[0],30);

            //Go to registration page
            ticketHelper.ClickElement("Register");

            //Enter Quantity of ticket
            ticketHelper.type("QuanTicket", "2");

            //Click on Buy now button
            ticketHelper.performClick("GetRegister");

            //Wait for text
            ticketHelper.WaitForTextInPage("Submit Registration", 20);

            //Click on Submit registration
            ticketHelper.performClick("SubmitRegistration");

            //wait for text
            ticketHelper.WaitForTextInPage("Ticket", 60);

            //verify status
            ticketHelper.WaitForTextInPage("Status:", 20);

            //
            ticketHelper.WaitForTextInPage("approved", 30);

            //Capture screenshot fot the screen
            loginHelper.TakeScreenshot("BuyTicket - Attendee");
        }