mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-20 15:02:31 +00:00
Add basic calendar button test
Mainly to pickup on FullCalendar loading errors
This commit is contained in:
@@ -304,3 +304,43 @@ class UserPage(BasePage):
|
|||||||
|
|
||||||
def generate_key(self):
|
def generate_key(self):
|
||||||
self.find_element(*self._generation_button_selector).click()
|
self.find_element(*self._generation_button_selector).click()
|
||||||
|
|
||||||
|
|
||||||
|
class CalendarPage(BasePage):
|
||||||
|
URL_TEMPLATE = 'rigboard/calendar'
|
||||||
|
|
||||||
|
_go_locator = (By.ID, 'go-to-date-button')
|
||||||
|
|
||||||
|
_today_selector = (By.ID, 'today-button')
|
||||||
|
|
||||||
|
_prev_selector = (By.ID, 'prev-button')
|
||||||
|
_next_selector = (By.ID, 'next-button')
|
||||||
|
|
||||||
|
_month_selector = (By.ID, 'month-button')
|
||||||
|
_week_selector = (By.ID, 'week-button')
|
||||||
|
_day_selector = (By.ID, 'day-button')
|
||||||
|
|
||||||
|
def go(self):
|
||||||
|
return self.find_element(*self._go_locator).click()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_date(self):
|
||||||
|
return regions.DatePicker(self, self.find_element(By.ID, 'go-to-date-input'))
|
||||||
|
|
||||||
|
def today(self):
|
||||||
|
return self.find_element(*self._today_selector).click()
|
||||||
|
|
||||||
|
def prev(self):
|
||||||
|
return self.find_element(*self._prev_selector).click()
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
return self.find_element(*self._next_selector).click()
|
||||||
|
|
||||||
|
def month(self):
|
||||||
|
return self.find_element(*self._month_selector).click()
|
||||||
|
|
||||||
|
def week(self):
|
||||||
|
return self.find_element(*self._week_selector).click()
|
||||||
|
|
||||||
|
def day(self):
|
||||||
|
return self.find_element(*self._day_selector).click()
|
||||||
|
|||||||
@@ -645,7 +645,18 @@ class TestCalendar(BaseRigboardTest):
|
|||||||
else:
|
else:
|
||||||
self.assertNotContains(response, "TE E" + str(test) + " ")
|
self.assertNotContains(response, "TE E" + str(test) + " ")
|
||||||
|
|
||||||
# Wow - that was a lot of tests
|
def test_calendar_buttons(self): # If FullCalendar fails to load for whatever reason, the buttons don't work
|
||||||
|
self.page = pages.CalendarPage(self.driver, self.live_server_url).open()
|
||||||
|
self.assertIn(timezone.now().strftime("%Y-%m"), self.driver.current_url)
|
||||||
|
|
||||||
|
target_date = datetime.date(2020, 1, 1)
|
||||||
|
self.page.target_date.set_value(target_date)
|
||||||
|
self.page.go()
|
||||||
|
self.assertIn(self.page.target_date.value.strftime("%Y-%m"), self.driver.current_url)
|
||||||
|
|
||||||
|
self.page.next()
|
||||||
|
target_date += datetime.timedelta(days=32)
|
||||||
|
self.assertIn(target_date.strftime("%m"), self.driver.current_url)
|
||||||
|
|
||||||
|
|
||||||
@screenshot_failure_cls
|
@screenshot_failure_cls
|
||||||
|
|||||||
Reference in New Issue
Block a user