Commit e7450a81 by Dean Dieker

fixed a bug that where only the sections under the first chapter would ever be clicked

parent 37277863
...@@ -62,8 +62,6 @@ def i_verify_all_the_content_of_each_course(step): ...@@ -62,8 +62,6 @@ def i_verify_all_the_content_of_each_course(step):
i += 1 i += 1
def browse_course(course_id): def browse_course(course_id):
world.browser.find_element_by_xpath("//div[@id='accordion']//nav//div[1]").click() world.browser.find_element_by_xpath("//div[@id='accordion']//nav//div[1]").click()
...@@ -79,7 +77,6 @@ def browse_course(course_id): ...@@ -79,7 +77,6 @@ def browse_course(course_id):
## Iterate the chapters ## Iterate the chapters
while chapter_it < num_chapters: while chapter_it < num_chapters:
world.browser.find_element_by_xpath("//*[@id='accordion']//nav//div["+str(chapter_it+1)+"]//h3").click() world.browser.find_element_by_xpath("//*[@id='accordion']//nav//div["+str(chapter_it+1)+"]//h3").click()
num_sections = len(chapters[chapter_it]['sections']) num_sections = len(chapters[chapter_it]['sections'])
accordion_class = "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" accordion_class = "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active"
rendered_sections = len(world.browser.find_elements_by_xpath("//*[@id='accordion']//nav//div["+str(chapter_it+1)+"]//ul//li")) rendered_sections = len(world.browser.find_elements_by_xpath("//*[@id='accordion']//nav//div["+str(chapter_it+1)+"]//ul//li"))
...@@ -87,14 +84,18 @@ def browse_course(course_id): ...@@ -87,14 +84,18 @@ def browse_course(course_id):
assert num_sections == rendered_sections, '%d sections expected, %d sections found on page, iteration number %d' % (num_sections, rendered_sections, chapter_it) assert num_sections == rendered_sections, '%d sections expected, %d sections found on page, iteration number %d' % (num_sections, rendered_sections, chapter_it)
section_it = 0 section_it = 0
## Iterate the sections ## Iterate the sections
while section_it < num_sections: while section_it < num_sections:
world.browser.find_element_by_xpath("//*[@id='accordion']//nav//div//ul[@class='"+accordion_class+"']//li["+str(section_it+1)+"]//a").click() world.browser.find_element_by_xpath("//*[@id='accordion']//nav//div["+str(chapter_it+1)+"]//ul[@class='"+accordion_class+"']//li["+str(section_it+1)+"]//a").click()
wait_until_class_renders('p',3) wait_until_class_renders('p',3)
chapter_it += 1
section_it += 1 section_it += 1
## Iterate the tabs
chapter_it += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment