Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-dashboard
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-analytics-dashboard
Commits
71699eb4
Commit
71699eb4
authored
Jul 22, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add first a11y test and run it in travis builds
parent
426fe52a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
128 additions
and
6 deletions
+128
-6
.travis.yml
+2
-1
Makefile
+4
-1
a11y_tests/__init__.py
+0
-0
a11y_tests/mixins.py
+14
-0
a11y_tests/pages.py
+54
-0
a11y_tests/test_course_enrollment_demographics_axs.py
+43
-0
runTests.sh
+11
-4
No files found.
.travis.yml
View file @
71699eb4
...
@@ -14,7 +14,8 @@ script:
...
@@ -14,7 +14,8 @@ script:
-
make static -e DJANGO_SETTINGS_MODULE="analytics_dashboard.settings.test"
-
make static -e DJANGO_SETTINGS_MODULE="analytics_dashboard.settings.test"
-
make validate
-
make validate
-
make generate_fake_translations
-
make generate_fake_translations
-
bash ./runAcceptance.sh
-
make accept
-
make a11y
branches
:
branches
:
only
:
only
:
-
master
-
master
...
...
Makefile
View file @
71699eb4
...
@@ -39,7 +39,10 @@ test_python: clean
...
@@ -39,7 +39,10 @@ test_python: clean
--with-ignore-docstrings
--cover-xml
--cover-xml-file
=
$(COVERAGE)
/coverage.xml
--with-ignore-docstrings
--cover-xml
--cover-xml-file
=
$(COVERAGE)
/coverage.xml
accept
:
accept
:
nosetests
-v
acceptance_tests
--exclude-dir
=
acceptance_tests/course_validation
./runTests.sh acceptance_tests
a11y
:
SELENIUM_BROWSER
=
phantomjs ./runTests.sh a11y_tests
course_validation
:
course_validation
:
python
-m
acceptance_tests.course_validation.generate_report
python
-m
acceptance_tests.course_validation.generate_report
...
...
a11y_tests/__init__.py
0 → 100644
View file @
71699eb4
a11y_tests/mixins.py
0 → 100644
View file @
71699eb4
from
acceptance_tests.mixins
import
LoginMixin
,
AnalyticsApiClientMixin
class
CoursePageTestsMixin
(
LoginMixin
,
AnalyticsApiClientMixin
):
""" Mixin for course page tests. """
DASHBOARD_DATE_FORMAT
=
'
%
B
%
d,
%
Y'
page
=
None
def
setUp
(
self
):
super
(
CoursePageTestsMixin
,
self
)
.
setUp
()
self
.
api_date_format
=
self
.
analytics_api_client
.
DATE_FORMAT
self
.
api_datetime_format
=
self
.
analytics_api_client
.
DATETIME_FORMAT
a11y_tests/pages.py
0 → 100644
View file @
71699eb4
"""
Tests for course analytics pages
"""
from
bok_choy.page_object
import
PageObject
from
acceptance_tests
import
TEST_COURSE_ID
,
DASHBOARD_SERVER_URL
class
DashboardPage
(
PageObject
):
# pylint: disable=abstract-method
path
=
None
basic_auth_username
=
None
basic_auth_password
=
None
@property
def
url
(
self
):
return
self
.
page_url
def
__init__
(
self
,
browser
,
path
=
None
):
super
(
DashboardPage
,
self
)
.
__init__
(
browser
)
path
=
path
or
self
.
path
self
.
server_url
=
DASHBOARD_SERVER_URL
self
.
page_url
=
'{0}/{1}'
.
format
(
self
.
server_url
,
path
)
class
CoursePage
(
DashboardPage
):
def
__init__
(
self
,
browser
,
course_id
=
None
):
# Create the path
self
.
course_id
=
course_id
or
TEST_COURSE_ID
path
=
'courses/{}'
.
format
(
self
.
course_id
)
# Call the constructor and setup the URL
super
(
CoursePage
,
self
)
.
__init__
(
browser
,
path
)
def
is_browser_on_page
(
self
):
return
self
.
browser
.
current_url
==
self
.
page_url
class
CourseEnrollmentDemographicsPage
(
CoursePage
):
demographic
=
None
def
__init__
(
self
,
browser
,
course_id
=
None
):
super
(
CourseEnrollmentDemographicsPage
,
self
)
.
__init__
(
browser
,
course_id
)
self
.
page_url
+=
'/enrollment/demographics/{0}/'
.
format
(
self
.
demographic
)
def
is_browser_on_page
(
self
):
return
(
super
(
CourseEnrollmentDemographicsPage
,
self
)
.
is_browser_on_page
()
and
'Enrollment Demographics by {0}'
.
format
(
self
.
demographic
.
title
())
in
self
.
browser
.
title
)
class
CourseEnrollmentDemographicsAgePage
(
CourseEnrollmentDemographicsPage
):
demographic
=
'age'
a11y_tests/test_course_enrollment_demographics_axs.py
0 → 100644
View file @
71699eb4
from
bok_choy.web_app_test
import
WebAppTest
from
a11y_tests.pages
import
CourseEnrollmentDemographicsAgePage
from
a11y_tests.mixins
import
CoursePageTestsMixin
_multiprocess_can_split_
=
True
class
CourseEnrollmentDemographicsAgeTests
(
CoursePageTestsMixin
,
WebAppTest
):
"""
A test for the accessibility of the CourseEnrollmentDemographicsAgePage.
"""
def
setUp
(
self
):
super
(
CourseEnrollmentDemographicsAgeTests
,
self
)
.
setUp
()
self
.
page
=
CourseEnrollmentDemographicsAgePage
(
self
.
browser
)
def
test_axs
(
self
):
# Log in and navigate to page
self
.
login
()
self
.
page
.
visit
()
# Generate accessibillity report
report
=
self
.
page
.
do_axs_audit
()
# Check that there was one page reviewed in this report
self
.
assertEqual
(
1
,
len
(
report
))
result
=
report
[
0
]
# Verify that this page has no accessibility errors.
self
.
assertEqual
(
0
,
len
(
result
.
errors
))
# Verify that this page currently has 2 accessibility warnings.
self
.
assertEqual
(
2
,
len
(
result
.
warnings
))
# And that these are the warnings that the page currently gives.
for
warning
in
result
.
warnings
:
self
.
assertTrue
(
warning
.
startswith
((
'Warning: AX_FOCUS_01'
,
'Warning: AX_COLOR_01'
,
)),
msg
=
"Unexpected warning: {}"
.
format
(
warning
)
)
run
Acceptance
.sh
→
run
Tests
.sh
View file @
71699eb4
#!/usr/bin/env bash
#!/usr/bin/env bash
TEST_DIR
=
${
1
?arg missing, specify a directory to find tests
}
# this stops the django servers
# this stops the django servers
stopServers
()
{
stopServers
()
{
kill
$(
ps aux |
grep
"[m]anage.py"
| awk
'{print $2}'
)
kill
$(
ps aux |
grep
"[m]anage.py"
| awk
'{print $2}'
)
...
@@ -25,15 +27,16 @@ echo "Preparing Analytics Data API..."
...
@@ -25,15 +27,16 @@ echo "Preparing Analytics Data API..."
cd
edx-analytics-data-api/
cd
edx-analytics-data-api/
make travis
make travis
cd
-
cd
-
mkdir
-p
logs
echo
"Starting Analytics Data API Server..."
echo
"Starting Analytics Data API Server..."
./edx-analytics-data-api/manage.py runserver 9001
--noreload
&
./edx-analytics-data-api/manage.py runserver 9001
--noreload
>
logs/api.log 2>&1
&
echo
"Starting Analytics Dashboard Server..."
echo
"Starting Analytics Dashboard Server..."
./manage.py runserver 9000
--noreload
&
./manage.py runserver 9000
--noreload
--traceback
>
logs/dashboard.log 2>&1
&
echo
"Running
acceptance
tests..."
echo
"Running
$TEST_DIR
tests..."
make accept
-e
NUM_PROCESSES
=
1
nosetests
-v
$TEST_DIR
-e
NUM_PROCESSES
=
1
--exclude-dir
=
acceptance_tests/course_validation
# capture the exit code from the test. Anything more than 0 indicates failed cases.
# capture the exit code from the test. Anything more than 0 indicates failed cases.
EXIT_CODE
=
$?
EXIT_CODE
=
$?
...
@@ -45,5 +48,9 @@ if [[ "$EXIT_CODE" = "0" ]]; then
...
@@ -45,5 +48,9 @@ if [[ "$EXIT_CODE" = "0" ]]; then
echo
"All tests passed..."
echo
"All tests passed..."
else
else
echo
"Failed tests..."
echo
"Failed tests..."
echo
-e
"
\0
33[33;34m Server Logs for Analytics Data API Server...
\0
33[0m "
cat
logs/api.log
echo
-e
"
\0
33[33;34m Server logs for Analytics Dashboard Server...
\0
33[0m "
cat
logs/dashboard.log
fi
fi
exit
$EXIT_CODE
exit
$EXIT_CODE
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