FieldAction(HONEYPOT_FIELD_NAME, '', autocomplete=False, error_expected=False),
)
+FIRST_AUTOCOMPLETE_XPATH = "//ul[contains(@style,'display: block')]/li[contains(@class,'ui-menu-item')][1]"
+
class DynamicTestCasesType(type):
"""Borrowed from
def setUpClass(cls):
cls.driver = webdriver.Firefox()
cls.driver.implicitly_wait(3)
+ cls.driver.maximize_window()
cls.wait = WebDriverWait(cls.driver, 10)
super(AddCourseTest, cls).setUpClass()
the first item in the autocomplete menu that appears."""
input = self.driver.find_element_by_name(name)
input.send_keys(keys)
- self.wait.until(EC.element_to_be_clickable(
- (By.XPATH, "//ul[contains(@style,'display: block')]/li[contains(@class,'ui-menu-item')][1]")))
- input.send_keys(Keys.DOWN)
- autocomplete_menu_item = self.driver.find_element_by_id("ui-active-menuitem")
- autocomplete_menu_item.click()
+
+ self.wait.until(EC.element_to_be_clickable((By.XPATH, FIRST_AUTOCOMPLETE_XPATH)))
+ self.driver.find_element_by_xpath(FIRST_AUTOCOMPLETE_XPATH).click()
@staticmethod
def flatten_actions(actions):
"""Fill out the Add Course form with the given actions."""
add_course_button = self.driver.find_element_by_id("add-course-btn")
add_course_button.click()
- self.driver.execute_script("javascript:window.scrollBy(0,200)")
for action in AddCourseTest.flatten_actions(field_actions):
if action.autocomplete:
<div id="course-header">
<div class="row header-byline">
<div class="small-12 columns">
- <span id="course-header-school">{{ course.school.name }}</span> •
+ {% if course.school %}
+ <span id="course-header-school">{{ course.school.name }}</span>
+ {% else %}
+ <span id="course-header-school">{{ course.department.school.name }}</span>
+ {% endif %}
+ •
{% if course.department %}<span class="course-header-department">{{ course.department.name }}</span> • {% endif %}
- <span id="course-header-instructor">{{ course.instructor_name }}</span>
+ {% if course.instructor_name %}
+ <span id="course-header-instructor">{{ course.instructor_name }}</span>
+ {% else %}
+ <span id="course-header-instructor">{{ course.instructor.name }}</span>
+ {% endif %}
</div>
</div>
<div id="course_container">
<div class="row">
<div class="small-12 columns">
- <!-- Main course table -->
- <table id="data_table_list">
- <thead class="hide">
- <tr>
- <th class="no-display" id="data-table-date"> Date </th>
- <th class="no-display" id="data-table-thanks"> Popularity </th>
- <th class="no-display" id="data-table-note"> Note </th>
- </tr>
- </thead>
- <tbody>
- {% for note in note_set %}
- {% include 'notes/note_list_entry.html' with note=note %}
- {% endfor %}
- </tbody>
- </table>
+ {% if not note_set %}
+ <p>This course has no notes yet.</p>
+ {% else %}
+ <!-- Main course table -->
+ <table id="data_table_list">
+ <thead class="hide">
+ <tr>
+ <th class="no-display" id="data-table-date"> Date </th>
+ <th class="no-display" id="data-table-thanks"> Popularity </th>
+ <th class="no-display" id="data-table-note"> Note </th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for note in note_set %}
+ {% include 'notes/note_list_entry.html' with note=note %}
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
</div>
</div> <!-- .row -->