Commit 82ec01c7 by Dean Dieker

added accordion.feature and accordion.py, merged with mchang list and array…

added accordion.feature and accordion.py, merged with mchang list and array creation for chapters and sections
parents b2339429 f58339d6
......@@ -25,7 +25,7 @@ from courseware.access import has_access
## end import
from django.core.urlresolvers import reverse
from courseware.courses import course_image_url, get_course_about_section
from courseware.courses import course_image_url, get_course_about_section, get_course_by_id
## support functions
def get_courses():
......@@ -41,6 +41,29 @@ def get_courses():
return courses
def get_courseware(course_id):
"""
Given a course_id (string), return a courseware array of dictionaries for the
top two levels of navigation. Example:
[
{'chapter_name': 'Overview',
'sections': ['Welcome', 'System Usage Sequence', 'Lab0: Using the tools', 'Circuit Sandbox']
},
{'chapter_name': 'Week 1',
'sections': ['Administrivia and Circuit Elements', 'Basic Circuit Analysis', 'Resistor Divider', 'Week 1 Tutorials']
},
{'chapter_name': 'Midterm Exam',
'sections': ['Midterm Exam']
}
]
"""
course = get_course_by_id(course_id)
chapters = course.get_children()
courseware = [ {'chapter_name':c.display_name, 'sections':[s.display_name for s in c.get_children()]} for c in chapters]
return courseware
## course listing step
@step(u'I should see all courses')
def i_should_see_all_courses(step):
......
Feature: I can explore all the courses I am signed up for
In order to learn from the courses I'm signed up for
As a registered user with courses
I want to be able to see all the chapters and all the section in each chapter
for each course
Scenario: We can see all the courses
Given I visit "http://localhost:8000/dashboard"
I should see some courses
\ No newline at end of file
Feature: Use the Accordion
In order to access courseware
As a registered student
We'll attempt to access all the information
Scenario: Click on every Week's Content
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
When I click "LOG IN"
And I login with "ddieker+admin@gmail.com" in the "email" field
And I login with "password" in the "password" field
And I press "Access My Courses"
I should see an element with class of "user" within "3" seconds
I visit "http://stage-edx-001.m.edx.org/courses/MITx/6.00x/2012_Fall/info"
I click "Courseware"
I should see an element with id of "open_close_accordion"
I should see an element with class of "ui-accordion"
I should see an element with id of "accordion"
I click on every item in every week of the course
\ No newline at end of file
from lettuce import * #before, world
from selenium import *
import lettuce_webdriver.webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from helpers import *
import re
@step(u'I should see an element with class of "(.*)" within "(.*)" seconds')
def i_should_see_an_element_with_class_of_classname_within_duraion_seconds(step,classname,duration):
wait_until_class_renders(classname, int(duration))
@step(u'I should see an element with class of "(.*)"')
def i_should_see_an_element_with_class_of_classname(step,classname):
world.browser.find_element_by_class_name(classname)
@step(u'I click on every item in every week of the course')
def i_click_on_every_item_in_every_week_of_the_course(step):
weeks = world.browser.find_elements_by_class_name('ui-accordion-header')
weeks[2].click
#for week in weeks:
# week.click()
# wait_until_class_renders('p',1)
nodes = world.browser.find_elements_by_xpath("//*[@id='accordion']//nav//ul[@class='ui-accordion-content-active']//li")
i = len(nodes)
j = 1
while j <= i:
node = world.browser.find_element_by_xpath("//ul[@class='ui-accordion-content-active']//li["+str(j)+"]//a//p").click()
i += 1
wait_until_class_renders('p',2)
# goodnodetext = re.sub(r'\s','_',node.text)
# wait_until_id_renders("sequence_i4x-MITx-6_00x-sequential-"+goodnodetext,3)
\ No newline at end of file
......@@ -4,8 +4,8 @@ import lettuce_webdriver.webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
url = 'http://anant:agarwal@sandbox-test-001.m.edx.org/'
#url = 'http://anant:agarwal@stage-edx-001.m.edx.org/'
#url = 'http://anant:agarwal@sandbox-test-001.m.edx.org/'
url = 'http://anant:agarwal@stage-edx-001.m.edx.org/'
## Helper methods for selenium tests for EdX
......
......@@ -4,7 +4,7 @@ Feature: Homepage renders
We want to see lots of information about edX on the home page
Scenario: We can see all the courses
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
I should see "3.091x"
I should see "CS50x"
......@@ -15,24 +15,24 @@ Feature: Homepage renders
I should see "6.00x"
Scenario: We can see the "Login" button
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
I should see "Log In"
Scenario: We can see the "Sign up" button
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
I should see "Sign Up"
Scenario: We can see the three partner institutions
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
I should see "MITx"
I should see "HarvardX"
I should see "BerkeleyX"
Scenario: We can see the static content pages
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
I should see "Find Courses"
I should see "About"
......@@ -40,13 +40,13 @@ Feature: Homepage renders
I should see "Jobs"
I should see "Contact"
When I click "Find Courses"
I should be at "http://sandbox-test-001.m.edx.org/courses"
I should be at "http://stage-edx-001.m.edx.org/courses"
When I click "About"
I should be at "http://sandbox-test-001.m.edx.org/about"
I should be at "http://stage-edx-001.m.edx.org/about"
When I click "Jobs"
I should be at "http://sandbox-test-001.m.edx.org/jobs"
I should be at "http://stage-edx-001.m.edx.org/jobs"
When I click "Contact"
I should be at "http://sandbox-test-001.m.edx.org/contact"
I should be at "http://stage-edx-001.m.edx.org/contact"
When I click "Blog"
I should be at "http://blog.edx.org/"
When I click "EDX HOME"
......
......@@ -4,7 +4,7 @@ Feature: Login
We'll see if I can log in to my account and perform user actions
Scenario: Login to an existing account and logout
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
#"http://anant:agarwal@stage-edx-001.m.edx.org/"
When I click "LOG IN"
And I login with "ddieker@gmail.com" in the "email" field
......@@ -12,19 +12,6 @@ Feature: Login
And I press "Access My Courses"
Then I should see an element with class of "user" within "3" seconds
# Scenario: Add a course
# Given I have no courses
# When I click "Find courses now!"
# And I click on a course
# And I register for the course
# Then I should see the course in my dashboard
# Scenario: Drop a course
# Given I have a course
# When I click "Unregister"
# And I confirm the course drop
# Then I should have no courses
Scenario: I register for a course, unregister, then register again
Given I have a list of courses
When I click "Find Courses"
......
......@@ -4,7 +4,7 @@ Feature: Sign up and Sign out
We'll see if I can create an account and log out
Scenario: Visit the homepage to Sign Up
Given I visit "http://anant:agarwal@sandbox-test-001.m.edx.org/"
Given I visit "http://anant:agarwal@stage-edx-001.m.edx.org/"
## "http://anant:agarwal@stage-edx-001.m.edx.org/"
When I click "SIGN UP"
And I signup with "bob62@bob.com" in the "email" field
......
......@@ -7,6 +7,6 @@ def setup_browser():
world.browser = webdriver.Firefox()
@after.all
def teardown_browser(total):
world.browser.quit()
#@after.all
#def teardown_browser(total):
# world.browser.quit()
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