def i_click_on_the_tab_and_check(step): for tab_title in step.hashes: tab_text = tab_title['TabName'] title = tab_title['PageTitle'] world.click_link(tab_text) world.wait_for(lambda _driver:title in world.browser.title) assert(title in world.browser.title)
def i_verify_all_the_content_of_each_course(step): all_possible_courses = get_courses() logger.debug('Courses found:') for c in all_possible_courses: logger.debug(c.id) ids = [c.id for c in all_possible_courses] # Get a list of all the registered courses registered_courses = world.browser.find_by_css('article.my-course') if len(all_possible_courses) < len(registered_courses): assert False, "user is registered for more courses than are uniquely posssible" else: pass for test_course in registered_courses: test_course.css_click('a') check_for_errors() # Get the course. E.g. 'MITx/6.002x/2012_Fall' current_course = sub('/info', '', sub('.*/courses/', '', world.browser.url)) validate_course(current_course, ids) world.click_link('Courseware') assert world.is_css_present('accordion') check_for_errors() browse_course(current_course) # clicking the user link gets you back to the user's home page world.css_click('.user-link') check_for_errors()
def i_click_on_the_tab_and_check(step): for tab_title in step.hashes: tab_text = tab_title['TabName'] title = tab_title['PageTitle'] world.click_link(tab_text) world.wait_for(lambda _driver: title in world.browser.title) assert (title in world.browser.title)
def upload_file(_step, is_test_file, file_name): world.click_link('Upload New File') if not is_test_file: _write_test_file(file_name, "test file") # uploading the file itself path = os.path.join(TEST_ROOT, 'uploads/', file_name) world.browser.execute_script("$('input.file-input').css('display', 'block')") world.browser.attach_file('file', os.path.abspath(path)) close_css = 'a.close-button' world.css_click(close_css)
def upload_file(_step, is_test_file, file_name): world.click_link('Upload New File') if not is_test_file: _write_test_file(file_name, "test file") # uploading the file itself path = os.path.join(TEST_ROOT, 'uploads/', file_name) world.browser.execute_script( "$('input.file-input').css('display', 'block')") world.browser.attach_file('file', os.path.abspath(path)) close_css = 'a.close-button' world.css_click(close_css)
def i_click_on_the_tab(step, tab_text): world.click_link(tab_text)
def click_the_link_with_the_text_group1(step, linktext): world.click_link(linktext)
def click_the_link_called(step, text): world.click_link(text)
def return_to_course(step): step.given('I visit the homepage') world.click_link("View Course") world.click_link("Courseware")
def and_i_return_to_the_courseware(step): world.visit('/') world.click_link("View Course") world.click_link("Courseware")
def and_i_return_to_the_course(step): world.visit('/') world.click_link("View Course") course = 'a[href*="/courseware"]' world.css_click(course)
def i_click_on_the_link(step, link_text): world.click_link(link_text)
def i_click_on_the_tab(step, tab_text): world.click_link(tab_text) world.save_the_html()
def i_visit_the_staff_grading_page(step): world.click_link('Instructor') world.click_link('Staff grading')