示例#1
0
        public List <BookingRecord> FindMatchingBookings(BookingRecord MatchingRecord)
        {
            // an empty list, to add matching records into.
            var matchedBookingRecords = new List <BookingRecord>();
            var allRows = baseDriver.FindElements(_recordRowsLocator);

            foreach (var row in allRows)
            {
                var id = row.GetAttribute("id");

                var ExistingBooking = new BookingRecord
                {
                    Id        = id,
                    FirstName = row.FindElement(By.XPath($"./div[1]/p"))?.Text,
                    Surname   = row.FindElement(By.XPath($"./div[2]/p"))?.Text,
                    Price     = row.FindElement(By.XPath($"./div[3]/p"))?.Text,
                    Deposit   = row.FindElement(By.XPath($"./div[4]/p"))?.Text,
                    CheckIn   = row.FindElement(By.XPath($"./div[5]/p"))?.Text,
                    CheckOut  = row.FindElement(By.XPath($"./div[6]/p"))?.Text,
                };

                if (ExistingBooking.Equals(MatchingRecord))
                {
                    matchedBookingRecords.Add(ExistingBooking);
                }
            }

            return(matchedBookingRecords);
        }
示例#2
0
        public void DeleteMatchingBookings(BookingRecord matchingRecord)
        {
            List <BookingRecord> matchedBookingRecords = FindMatchingBookings(matchingRecord);
            BookingRecord        bookingRecordToDelete = matchedBookingRecords.First();

            var deleteButtonLocator = By.XPath($"//div[@id={bookingRecordToDelete.Id}]/*/input[@value='Delete']");

            Find(deleteButtonLocator).Click();
            //waiting until Delete button of the deleted row gets invisible
            baseWait.Until(ExpectedConditions.InvisibilityOfElementLocated(deleteButtonLocator));
        }
示例#3
0
        public void CreateBooking(BookingRecord bookingRecord)
        {
            EnterText(By.Id("firstname"), bookingRecord.FirstName);
            EnterText(By.Id("lastname"), bookingRecord.Surname);
            EnterText(By.Id("totalprice"), bookingRecord.Price);
            SelectValue(By.Id("depositpaid"), bookingRecord.Deposit);
            EnterText(By.Id("checkin"), bookingRecord.CheckIn);
            EnterText(By.Id("checkout"), bookingRecord.CheckOut);

            Click(_saveButton);
        }