def test_118(self):
     get_driver().maximize_window()
     page = GuidePage()
     page.profile_dropdown.click()
     wait = WebDriverWait(get_driver(), 15)
     wait.until(lambda driver: page.is_element_present('logout_button'))
     page.logout_button.click()
     page = loginpage()
     assert page.url == get_driver().current_url
 def test_117(self):
     get_driver().maximize_window()
     page = loginpage()
     page.open()
     page.login_field.send_keys(guide1_login)
     page.password_field.send_keys(guide1_password)
     page.button.click()
     time.sleep(5)
     page = GuidePage()
     assert page.url == get_driver().current_url
 def test_983(self):
     get_driver().maximize_window()
     page = loginpage()
     page.open()
     page.login_field.send_keys(admin_login)
     page.password_field.send_keys(admin_password)
     page.button.click()
     page = ActivityHubPage()
     page.open()
     time.sleep(5)
     page.search_activity_field.send_keys(ActivityName)
     time.sleep(5)
     page.activity_actions.click()
     page.edit_activity.click()
     page = AddEditActivityPage()
     time.sleep(15)
     select = Select(page.first_guide)
     if page.switcher_minimum_enforce.get_attribute(
             "outerHTML"
     ) != switcher_OFF and page.ticket_minimum.get_attribute(
             'value'
     ) == '5' and select.first_selected_option.text == GuideName and page.switchers2[
             0].get_attribute(
                 "outerHTML") == switcher_OFF:  #First Sale Closes Event::
         page.cancel_button.click()
     else:
         if page.switcher_minimum_enforce.get_attribute(
                 "outerHTML") == switcher_OFF:
             page.switcher_minimum_enforce.click()
             time.sleep(2)
             assert page.switcher_minimum_enforce.get_attribute(
                 "outerHTML") != switcher_OFF  # Tickets Minimum Enforce
         if page.ticket_minimum.get_attribute('value') != '5':
             page.ticket_minimum.clear()
             page.ticket_minimum.send_keys('5')
         if select.first_selected_option.text != GuideName:
             select.select_by_visible_text(GuideName)
         if page.switchers2[0].get_attribute("outerHTML") != switcher_OFF:
             page.switchers2[0].click()
             time.sleep(2)
             assert page.switchers2[0].get_attribute(
                 "outerHTML") == switcher_OFF  #First Sale Closes Event:
         page.save_button.click()
     page = EventCalendarPage()
     page.open()
     time.sleep(2)
     select = Select(page.activity_name)
     select.select_by_visible_text(ActivityName)
     time.sleep(5)
     page.hide_events.click()
     time.sleep(5)
     page.event_tickets[0].click()
     time.sleep(5)
     for i in range(0, len(page.event_tickets)):
         if 'Ticket Sold: 0' not in page.manifest_title.get_attribute(
                 "innerText"):
             page.close_button.click()
             time.sleep(5)
             page.event_tickets[i + 1].click()
             time.sleep(5)
             continue
         else:
             time.sleep(5)
             EventHeaderDateTimeList.append(
                 page.date_time_title.get_attribute('textContent'))
             page.add_booking_button.click()
         break
     time.sleep(5)
     page = AdminBookingPage()
     time.sleep(5)
     TimeList.append(page.time_current_booking.get_attribute('textContent'))
     DateList.append(page.date_current_booking.get_attribute('textContent'))
     page.first_tickets_type.send_keys('5')
     time.sleep(5)
     page.enter_customer_information_button.click()
     time.sleep(5)
     NewFirstName = 'James'
     page.first_name.send_keys(NewFirstName)
     NewLastName = 'James'
     NewFullName = NewFirstName + ' ' + ''.join(NewLastName)
     page.last_name.send_keys(NewLastName)
     NewEmail = ('*****@*****.**')
     page.email_address.send_keys(NewEmail)
     time.sleep(10)
     page.complete_booking_button.click()
     time.sleep(5)
     wait = WebDriverWait(get_driver(), 15)
     wait.until(lambda driver: page.is_element_present('payment_type_list'))
     select = Select(page.payment_type_list)
     PaymentType = "Cash"
     select.select_by_visible_text(PaymentType)
     page.cash_recieved.click()
     time.sleep(5)
     page.submit_booking_button.click()
     time.sleep(5)
     assert page.final_alert.get_attribute(
         "textContent") == 'Booking Successful!'
     page.final_alert_ok_button.click()
     page = EventCalendarPage()
     page.open()
     time.sleep(2)
     select = Select(page.activity_name)
     select.select_by_visible_text(ActivityName)
     time.sleep(5)
     page.hide_events.click()
     time.sleep(5)
     page.event_tickets[0].click()
     time.sleep(5)
     for i in range(0, len(page.event_tickets)):
         if EventHeaderDateTimeList[
                 0] != page.date_time_title.get_attribute('textContent'):
             page.close_button.click()
             time.sleep(5)
             page.event_tickets[i + 1].click()
             time.sleep(5)
             continue
         else:
             time.sleep(5)
             assert 'Tickets Sold: 5' in page.manifest_title.get_attribute(
                 "innerText")
             assert page.event_status.get_attribute(
                 'textContent') == 'Pending'
         break
     time.sleep(5)
     select = Select(page.guide_list)
     select.select_by_visible_text(GuideName)
     page.save_guide.click()
     assert page.info_pop_up.get_attribute(
         'textContent') == "Information was saved successfully."
     page.OK_info_pop_up.click()
     page = loginpage()
     page.open()
     page.login_field.send_keys(guide_flat_login)
     page.password_field.send_keys(guide_flat_password)
     page.button.click()
     page = GuidePage()
     time.sleep(5)
     page.search_field.send_keys(ActivityName)  #STEP1
     time.sleep(5)
     EventDate = DateList[0].partition(' ')[2]
     for i in range(0, len(page.event_tickets)):  # STEP7
         page.event_tickets[i].click()
         time.sleep(10)
         if EventDate in page.date_time_title.get_attribute('textContent'):
             if TimeList[0] in page.date_time_title.get_attribute(
                     'textContent'):
                 break
             else:
                 get_driver().back()
                 time.sleep(5)
                 i += 1
                 continue
         else:
             get_driver().back()
             time.sleep(5)
             i += 1
             continue
     assert '(5)' in page.customer_tickets.get_attribute("innerText")
     time.sleep(5)
     page.add_booking.click()  #STEP2
     page = AdminBookingPage()
     page.first_tickets_type.send_keys('1')  #STEP3
     time.sleep(5)
     page.enter_customer_information_button.click()  # STEP4
     time.sleep(5)
     NewFirstName = 'James'
     page.first_name.send_keys(NewFirstName)  # STEP5
     NewLastName = 'James'
     NewFullName = NewFirstName + ' ' + ''.join(NewLastName)
     page.last_name.send_keys(NewLastName)
     NewEmail = ('*****@*****.**')
     page.email_address.send_keys(NewEmail)
     time.sleep(10)
     page.complete_booking_button.click()  # STEP6
     time.sleep(5)
     wait = WebDriverWait(get_driver(), 15)
     wait.until(lambda driver: page.is_element_present('payment_type_list'))
     select = Select(page.payment_type_list)  # STEP7
     PaymentType = "Credit Card"
     select.select_by_visible_text(PaymentType)
     select = Select(page.credit_card_list)
     time.sleep(5)
     select.select_by_visible_text('New Card')
     time.sleep(5)
     get_driver().switch_to.frame(page.stripe)
     page.card_number_input.send_keys(CC_Number)
     page.card_date_input.send_keys(ExpDate)
     page.card_cvc_input.send_keys(CVC)
     page.card_zip_input.send_keys(CCZip)
     get_driver().switch_to.default_content()
     page.submit_booking_button.click()  # STEP8
     time.sleep(5)
     assert page.final_alert.get_attribute(
         "textContent") == 'Booking Successful!'
     page.final_alert_ok_button.click()  # STEP9
 def test_8(self):
     get_driver().maximize_window()
     page = loginpage()
     page.open()
     page.login_field.send_keys(admin_login)
     page.password_field.send_keys(admin_password)
     page.button.click()
     page = ChannelPayrollPage()
     page.open()
     page.channel_payment_due.click()
     time.sleep(3)
     try:
         for i in range(0, len(page.channel_entries)):
             if channel in page.channel_entries[i].get_attribute(
                     'textContent'):
                 page.channel_detail[i].click()
             else:
                 continue
             break
         time.sleep(3)
         for i in range(0, len(page.cash)):
             if page.cash[i].is_displayed():
                 page.cash[i].click()
             else:
                 continue
             break
         time.sleep(6)
         for i in range(0, len(page.pay_button)):
             if page.pay_button[i].is_displayed():
                 page.pay_button[i].click()
             else:
                 continue
             break
         time.sleep(6)
         alert = get_driver().switch_to_alert()
         alert.accept()
         time.sleep(2)
         page.OK_button.click()
         time.sleep(2)
     except WebDriverException:
         print("Channel has no payment due")
     page = NavigationBar()
     page.main_actions_drop_down.click()
     time.sleep(2)
     page.add_a_booking.click()
     page = AdminBookingPage()
     select = Select(page.activity_list)
     select.select_by_visible_text(ActivityName)
     page.first_tickets_type.send_keys(AdultTickets)
     time.sleep(5)
     page.datepicker_next_month.click()
     time.sleep(5)
     EventDate = str(random.randint(2, 30))
     for i in range(0, len(page.dates)):
         if page.dates[i].get_attribute("textContent") == EventDate:
             page.dates[i].click()
         else:
             continue
         break
     time.sleep(5)
     EventTimeHours = str(random.randint(2, 11))
     minutes_values = ('00', '15', '30', '45')
     EventTimeMinutes = random.choice(minutes_values)
     timeday = random.choice(('AM', 'PM'))
     EventTimeWithZone = (EventTimeHours + ':' + ''.join(EventTimeMinutes) +
                          ' ' + ''.join(timeday) + ' ' +
                          ''.join(ActivityTimezone))
     nextMonthDate = (datetime.now() +
                      relativedelta(months=1)).strftime('%#m')
     NextMonthName = (datetime.now() +
                      relativedelta(months=1)).strftime("%B")
     NewFullDate = (NextMonthName + ' ' + ''.join(str(EventDate)))
     select = Select(page.time)
     select.select_by_visible_text(EventTimeWithZone)
     time.sleep(5)
     page.enter_customer_information_button.click()
     FirstName = "Alexey"
     page.first_name.send_keys(FirstName)
     LastName = "Kolennikov"
     page.last_name.send_keys(LastName)
     EmailAddress = '*****@*****.**'
     page.email_address.send_keys(EmailAddress)
     page.complete_booking_button.click()
     time.sleep(2)
     select = Select(page.channel_list)
     time.sleep(5)
     select.select_by_visible_text(channel)
     select = Select(page.payment_type_list)
     time.sleep(5)
     PaymentType = "Cash"
     select.select_by_visible_text(PaymentType)
     time.sleep(2)
     page.cash_recieved.click()
     page.submit_booking_button.click()
     time.sleep(5)
     page = EventCalendarPage()
     page.open()
     time.sleep(2)
     select = Select(page.activity_name)
     select.select_by_visible_text(ActivityName)
     page.date_picker.click()
     time.sleep(2)
     page.date_picker_next.click()
     time.sleep(2)
     for i in range(0, len(page.days_date_picker)):
         if page.days_date_picker[i].get_attribute("textContent") == str(
                 EventDate):
             page.days_date_picker[i].click()
         else:
             continue
         break
     page.day_button.click()
     time.sleep(6)
     EventTime = (EventTimeHours + ':' + ''.join(EventTimeMinutes) + ' ' +
                  ''.join(timeday))
     assert str(NewFullDate) in page.date_header.get_attribute(
         "textContent")
     for ticket in page.day_slots:
         for i in range(0, len(page.day_slots)):
             if EventTime in ticket.day_slot_time[i].get_attribute(
                     'textContent'):
                 page.day_slots[i].click()
                 time.sleep(6)
                 assert NewFullDate and EventTime in page.date_time_title.get_attribute(
                     'textContent')
                 assert ActivityName == page.activity_name_title.get_attribute(
                     'textContent')
                 select = Select(page.guide_list)
                 select.select_by_visible_text(GuideName)
                 page.save_guide.click()
                 page.close_button.click()
             else:
                 continue
         break
     page = loginpage()
     page.open()
     page.login_field.send_keys(guide_login)
     page.password_field.send_keys(guide_password)
     page.button.click()
     page = GuidePage()
     time.sleep(2)
     page.day_button.click()
     time.sleep(2)
     page.date_picker.click()
     time.sleep(2)
     page.next_month.click()
     time.sleep(2)
     for i in range(0, len(page.days_date_picker)):
         if page.days_date_picker[i].get_attribute("textContent") == str(
                 EventDate):
             page.days_date_picker[i].click()
         else:
             continue
         break
     time.sleep(2)
     assert str(NewFullDate) in page.date_header.get_attribute(
         "textContent")
     for ticket in page.day_slots:
         for i in range(0, len(page.day_slots)):
             if EventTime in ticket.day_slot_time[i].get_attribute(
                     'textContent'):
                 page.day_slots[i].click()
                 time.sleep(6)
                 assert NextMonthName and EventDate and EventTimeWithZone in page.date_time_title.get_attribute(
                     'textContent')
                 assert ActivityName in page.activity_name_title.get_attribute(
                     'textContent')
             else:
                 continue
         break
     time.sleep(4)
     page.check_in.click()
     page.event_complete.click()
     alert = get_driver().switch_to_alert()
     alert.accept()
     page = loginpage()
     page.open()
     page.login_field.send_keys(admin_login)
     page.password_field.send_keys(admin_password)
     page.button.click()
     page = ChannelPayrollPage()
     page.open()
     page.channel_payment_due.click()
     time.sleep(5)
     L = []
     for i in range(0, len(page.channel_entries)):
         if channel in page.channel_entries[i].get_attribute('textContent'):
             assert comission_amount in page.channel_entries[
                 i].get_attribute('textContent')
             L.append(page.channel_entries[i].get_attribute('textContent'))
         else:
             continue
         break
     assert len(L) == 1