Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
38352d89
Commit
38352d89
authored
Aug 22, 2012
by
Dean Dieker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smart-accordion work
parent
0bcdcad6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
5 deletions
+89
-5
lms/djangoapps/acceptance_testing/features/courses.py
+2
-0
lms/djangoapps/acceptance_testing/features/smart-accordion.feature
+9
-0
lms/djangoapps/acceptance_testing/features/smart-accordion.py
+66
-0
lms/djangoapps/acceptance_testing/features/static/accordion.feature
+2
-1
lms/djangoapps/acceptance_testing/features/static/accordion.py
+6
-1
lms/djangoapps/acceptance_testing/features/static/terrain.py
+4
-3
No files found.
lms/djangoapps/acceptance_testing/features/courses.py
View file @
38352d89
...
@@ -72,3 +72,5 @@ def i_should_see_all_courses(step):
...
@@ -72,3 +72,5 @@ def i_should_see_all_courses(step):
course_link_texts
=
[
(
c
.
location
.
course
,
c
.
display_name
)
for
c
in
courses
]
course_link_texts
=
[
(
c
.
location
.
course
,
c
.
display_name
)
for
c
in
courses
]
for
c
in
course_link_texts
:
for
c
in
course_link_texts
:
assert
world
.
browser
.
find_element_by_partial_link_text
(
c
[
0
]
+
' '
+
c
[
1
])
assert
world
.
browser
.
find_element_by_partial_link_text
(
c
[
0
]
+
' '
+
c
[
1
])
lms/djangoapps/acceptance_testing/features/smart-accordion.feature
0 → 100644
View file @
38352d89
Feature
:
There are courses on the homepage
In order to compared rendered content to the database
As an acceptance test
I want to count all the chapters, sections, and tabs for each course
Scenario
:
We can see all the courses
Given I visit "http
:
//localhost
:
8000/"
I
verify all the content of each course
\ No newline at end of file
lms/djangoapps/acceptance_testing/features/smart-accordion.py
0 → 100644
View file @
38352d89
from
lettuce
import
*
#before, world
from
selenium
import
*
import
lettuce_webdriver.webdriver
import
logging
import
nose.tools
from
selenium.webdriver
import
ActionChains
from
selenium.webdriver.support.ui
import
WebDriverWait
## imported from lms/djangoapps/courseware/courses.py
from
collections
import
defaultdict
from
fs.errors
import
ResourceNotFoundError
from
functools
import
wraps
import
logging
from
path
import
path
from
django.conf
import
settings
from
django.http
import
Http404
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
static_replace
import
replace_urls
,
try_staticfiles_lookup
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
,
get_course_by_id
from
courses
import
*
@step
(
u'I verify all the content of each course'
)
def
i_verify_all_the_content_of_each_course
(
step
):
courses
=
get_courses
()
for
course
in
courses
:
browse_course
(
course
)
## click on a course i'm rgistered for
## extract the course id from the url
## match it to the course id from get_courses() and then walkthrough
def
browse_course
(
step
,
course
,
base_url
=
"http://localhost:8000"
):
for
course
in
courses
:
chapters
=
course
.
get_children
()
world
.
browser
.
get
(
base_url
+
'/courses/'
+
course
+
'/courseware'
)
wait_until_id_renders
(
'accordion'
,
2
)
rendered_chapters
=
len
(
world
.
browser
.
find_elements_by_xpath
(
"//*[@id='accordion']//nav//h3"
))
assert
rendered_chapters
==
len
(
chapters
)
i
=
0
while
i
<
len
(
chapters
):
world
.
browser
.
find_element_by_xpath
(
"//*[@id='accordion']//nav//h3["
+
str
(
i
+
1
)
+
"]"
)
.
click
()
sections
=
chapter
.
get_children
()
accordion_class
=
"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active"
rendered_sections
=
world
.
browser
.
find_element_by_xpath
(
"//*[@id='accordion']//nav//ul[@class='"
+
accordion_class
+
"']//li"
)
assert
rendered_sections
==
len
(
sections
)
i
+=
1
if
world
.
browser
.
find_element_by_xpath
(
"//section[@class='outside-app']"
):
assert
False
else
:
j
=
0
while
j
<
len
(
sections
):
section
=
sections
[
j
]
course
.
id
->
course
url
betwen
/
courses
/
(
.*
)
/
info
\ No newline at end of file
lms/djangoapps/acceptance_testing/features/static/accordion.feature
View file @
38352d89
...
@@ -10,7 +10,7 @@ Feature: Use the Accordion
...
@@ -10,7 +10,7 @@ Feature: Use the Accordion
And
I login with
"password"
in the
"password"
field
And
I login with
"password"
in the
"password"
field
And
I press
"Access My Courses"
And
I press
"Access My Courses"
I
should see an element with class of
"user"
within
"3"
seconds
I
should see an element with class of
"user"
within
"3"
seconds
I visit "http
:
//stage-edx-001.m.edx.org/courses/
MITx/6.00
x/2012_Fall/info"
I visit "http
:
//stage-edx-001.m.edx.org/courses/
BerkeleyX/CS188.1
x/2012_Fall/info"
I
click
"Courseware"
I
click
"Courseware"
I
should see an element with id of
"accordion"
I
should see an element with id of
"accordion"
I
click on every item in every week of the course
I
click on every item in every week of the course
\ No newline at end of file
lms/djangoapps/acceptance_testing/features/static/accordion.py
View file @
38352d89
...
@@ -33,6 +33,7 @@ def i_click_on_every_item_in_every_week_of_the_course(step):
...
@@ -33,6 +33,7 @@ def i_click_on_every_item_in_every_week_of_the_course(step):
section
=
world
.
browser
.
find_element_by_xpath
(
"//*[@id='accordion']//nav//ul[@class='ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active']//li["
+
str
(
j
)
+
"]//a//p"
)
section
=
world
.
browser
.
find_element_by_xpath
(
"//*[@id='accordion']//nav//ul[@class='ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active']//li["
+
str
(
j
)
+
"]//a//p"
)
good_section_text
=
re
.
sub
(
r'\s'
,
'_'
,
section
.
text
)
good_section_text
=
re
.
sub
(
r'\s'
,
'_'
,
section
.
text
)
section
.
click
()
section
.
click
()
assert
world
.
browser
.
find_element_by_xpath
(
"//section[@class='outside-app'//h1[@text='THERE HAS BEEN AN ERROR ON THE edX SERVERS']"
)
==
None
j
+=
1
j
+=
1
clean
=
re
.
sub
(
'
\"
'
,
''
,
good_section_text
)
clean
=
re
.
sub
(
'
\"
'
,
''
,
good_section_text
)
wait_until_id_renders
(
"sequence_i4x-MITx-6_00x-sequential-"
+
clean
,
3
)
wait_until_id_renders
(
"sequence_i4x-MITx-6_00x-sequential-"
+
clean
,
3
)
...
@@ -40,7 +41,11 @@ def i_click_on_every_item_in_every_week_of_the_course(step):
...
@@ -40,7 +41,11 @@ def i_click_on_every_item_in_every_week_of_the_course(step):
num_tabs
=
len
(
tabs
)
num_tabs
=
len
(
tabs
)
l
=
1
l
=
1
while
l
<=
num_tabs
:
while
l
<=
num_tabs
:
tab
=
world
.
browser
.
find_element_by_xpath
(
"//ol[@id='sequence-list']//li["
+
str
(
l
)
+
"]"
)
tab
=
world
.
browser
.
find_element_by_xpath
(
"//ol[@id='sequence-list']//li["
+
str
(
l
)
+
"]"
)
#tab.click()
#tab.click()
tab
.
find_element_by_xpath
(
"//a[@data-element='"
+
str
(
l
)
+
"']"
)
.
click
()
tab
.
find_element_by_xpath
(
"//a[@data-element='"
+
str
(
l
)
+
"']"
)
.
click
()
l
+=
1
if
world
.
browser
.
find_element_by_xpath
(
"//section[@class='outside-app'//h1"
):
assert
False
else
:
l
+=
1
lms/djangoapps/acceptance_testing/features/static/terrain.py
View file @
38352d89
...
@@ -7,6 +7,6 @@ def setup_browser():
...
@@ -7,6 +7,6 @@ def setup_browser():
world
.
browser
=
webdriver
.
Firefox
()
world
.
browser
=
webdriver
.
Firefox
()
#
@after.all
@after.all
#
def teardown_browser(total):
def
teardown_browser
(
total
):
#
world.browser.quit()
world
.
browser
.
quit
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment