예제 #1
0
        public void TC15_UserFilterWithDepartStation()
        {
            Console.WriteLine("TC15 - User can filter \"Manager ticket\" table with Depart Station");
            //1. Navigate to QA Railway Website
            HomePage homePage = new HomePage();

            homePage.Open();

            //2. Login with a valid account
            LoginPage loginPage = homePage.GoToLoginPage();

            homePage = loginPage.Login(user.Email, user.Password);

            //3. Book more than 6 tickets with different Depart Stations
            string[] departStations = { "Sài Gòn", "Phan Thiết", "Nha Trang", "Đà Nẵng", "Quảng Ngãi", "Huế" };
            for (int i = 0; i < 6; i++)
            {
                //Book a ticket
                BookTicketPage bookTicketPage = homePage.GoToBookTicketPage();

                DateTime dateTime = DateTime.Now.AddDays(5);

                Ticket ticket = new Ticket();

                ticket.DepartDate    = dateTime.ToString("M/d/yyyy");
                ticket.DepartStation = departStations[i];
                ticket.SeatType      = "Soft bed with air conditioner";
                ticket.Amount        = "1";

                BookTicketSuccessPage bookTicketSuccessPage = bookTicketPage.BookTicket(ticket);
            }

            //4. Click on "My ticket" tab
            //5. Select one of booked Depart Station in "Depart Station" dropdown list
            //6. Click "Apply filter" button
            //VP. "Manage ticket" table shows correct ticket(s)
            TicketFilter ticketFilter = new TicketFilter();

            ticketFilter.DepartStation = "Nha Trang";
            MyTicketPage myTicketPage = homePage.GoToMyTicketPage().ApplyFilter(ticketFilter);

            Assert.IsTrue(myTicketPage.CheckTicketsExistWithFilter(ticketFilter));

            //Clean-up: Cancel all tickets
            myTicketPage.GoToMyTicketPage().CancelAllTickets();
        }
예제 #2
0
        public void TC11_UserBookManyTickets()
        {
            Console.WriteLine("TC11 - User can book many tickets at a time");

            //1. Navigate to QA Railway Website
            HomePage homePage = new HomePage();

            homePage.Open();

            //2. Login with a valid account
            LoginPage loginPage = homePage.GoToLoginPage();

            homePage = loginPage.Login(user.Email, user.Password);

            //3. Click on "Book ticket" tab
            BookTicketPage bookTicketPage = homePage.GoToBookTicketPage();

            //4. Select a "Depart date" from the list
            //5. Select "Nha Trang" for "Depart from" and "Sài Gòn" for "Arrive at".
            //6. Select "Soft seat with air conditioner" for "Seat type"
            //7. Select "5" for "Ticket amount"
            //8. Click on "Book ticket" button
            //VP. Message "Ticket booked successfully!" displays.Ticket information display correctly (Depart Date, Depart Station, Arrive Station, Seat Type, Amount)
            DateTime dateTime = DateTime.Now.AddDays(5);

            Ticket ticket = new Ticket();

            ticket.DepartDate    = dateTime.ToString("M/d/yyyy");
            ticket.DepartStation = "Nha Trang";
            ticket.ArriveStation = "Sài Gòn";
            ticket.SeatType      = "Soft seat with air conditioner";
            ticket.Amount        = "5";

            BookTicketSuccessPage bookTicketSuccessPage = bookTicketPage.BookTicket(ticket);

            string actualMsg   = bookTicketSuccessPage.GetSuccessMessage();
            string expectedMsg = "Ticket booked successfully!";

            Assert.AreEqual(expectedMsg, actualMsg);

            Assert.IsTrue(bookTicketSuccessPage.CheckTicketExists(ticket));

            //Clean-up: Cancel all tickets
            bookTicketSuccessPage.GoToMyTicketPage().CancelAllTickets();
        }
예제 #3
0
        public void TC14_UserCancelsTicket()
        {
            Console.WriteLine("TC14 - User can cancel a ticket");
            //1. Navigate to QA Railway Website
            HomePage homePage = new HomePage();

            homePage.Open();

            //2. Login with a valid account
            LoginPage loginPage = homePage.GoToLoginPage();

            homePage = loginPage.Login(user.Email, user.Password);

            //3. Book a ticket
            BookTicketPage bookTicketPage = homePage.GoToBookTicketPage();

            DateTime dateTime = DateTime.Now.AddDays(5);

            Ticket ticket = new Ticket();

            ticket.DepartDate    = dateTime.ToString("M/d/yyyy");
            ticket.DepartStation = "Sài Gòn";
            ticket.ArriveStation = "Nha Trang";
            ticket.SeatType      = "Soft bed with air conditioner";
            ticket.Amount        = "1";

            BookTicketSuccessPage bookTicketSuccessPage = bookTicketPage.BookTicket(ticket);

            //4. Click on "My ticket" tab
            //5. Click on "Cancel" button of ticket which user want to cancel.
            //6. Click on "OK" button on Confirmation message "Are you sure?"
            //VP. The canceled ticket is disappeared.
            MyTicketPage myTicketPage = bookTicketSuccessPage.GoToMyTicketPage().CancelTicket(ticket);

            Assert.IsFalse(myTicketPage.CheckTicketExists(ticket));
        }