Skip to content

Commit

Permalink
Merge branch '0.16.x' into init_content_items_w_contentpack_minimal
Browse files Browse the repository at this point in the history
Conflicts:
	Makefile
  • Loading branch information
benjaoming committed Feb 22, 2016
2 parents e6d4de0 + 9502bf9 commit ca21814
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 15 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -63,7 +63,6 @@ secretkey.txt
# Documentation
docs/_build
docs/images/*
docs/kalite.1.gz

# oh-my-zsh convention for automatically
# switching on a venv
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in.dist
Expand Up @@ -33,3 +33,5 @@ recursive-exclude python-packages *pyc

# Docs
recursive-include docs/_build/html *
include docs/kalite.1.gz

4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -49,7 +49,7 @@ lint:
test:
bin/kalite manage test --bdd-only

test-bdd:
test-bdd: docs
bin/kalite manage test --bdd-only

test-nobdd:
Expand Down Expand Up @@ -96,7 +96,7 @@ assets:
cp kalite/database/data.sqlite kalite/database/templates/
bin/kalite manage retrievecontentpack download en --minimal --foreground --template

release: clean clean-dev-db docs assets
release: clean clean-dev-db docs assets man
python setup.py sdist --formats=gztar,zip upload --sign
python setup.py sdist --formats=gztar,zip upload --sign --static
ls -l dist
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Expand Up @@ -8,7 +8,7 @@ dependencies:
- "data"
- "sc-latest-linux"
override:
- pip install -r requirements_test.txt
- pip install -r requirements_sphinx.txt
- pip install -e .
# This cannot be done because pip on Circle doesn't understand our sdist
# - make sdist
Expand Down
Binary file added docs/kalite.1.gz
Binary file not shown.
20 changes: 17 additions & 3 deletions kalite/distributed/features/steps/ui_regression.py
@@ -1,19 +1,21 @@
from behave import *
from behave import given, then, when
from django.core.urlresolvers import reverse

from kalite.testing.behave_helpers import *
from kalite.testing.behave_helpers import find_id_with_wait, assert_no_element_by_id, \
elem_is_visible_with_wait, build_url, login_as_coach

DROPDOWN_MENU_ID = "username"
NAVBAR_TOGGLE_ID = "navbar_toggle"
LOGOUT_LINK_ID = "nav_logout"
DOCS_LINK_ID = "nav_documentation"


@given("I'm logged in as a coach")
def step_impl(context):
login_as_coach(context)


@given("I can see the username dropdown menu")
@given(u"I can see the username dropdown menu")
def step_impl(context):
go_to_homepage(context)
context.dropdown_menu = dropdown_menu = find_id_with_wait(context, DROPDOWN_MENU_ID)
Expand All @@ -36,5 +38,17 @@ def step_impl(context):
assert elem_is_visible_with_wait(context, logout_link), "Logout link is not visible!"


@then(u"I see the documentation link")
def step_impl(context):
docs_link = find_id_with_wait(context, DOCS_LINK_ID)
assert elem_is_visible_with_wait(context, docs_link), "Documentation link is not visible!"


@then(u"I do not see the documentation link")
def step_impl(context):
find_id_with_wait(context, 'user-name') # Ensure the menu has loaded at all
assert_no_element_by_id(context, '#' + DOCS_LINK_ID)


def go_to_homepage(context):
context.browser.get(build_url(context, reverse("homepage")))
17 changes: 16 additions & 1 deletion kalite/distributed/features/ui_regression.feature
Expand Up @@ -11,4 +11,19 @@ Feature: UI regression tests
Given superuser is deleted
Given I'm on update_videos page
Then I'm redirected to the homepage
Then I see only superusercreate modal
Then I see only superusercreate modal

@as_coach
Scenario: Documentation link shown to coaches
Given I am on the homepage
Then I see the documentation link

@as_admin
Scenario: Documentation link shown to admins
Given I am on the homepage
Then I see the documentation link

@as_learner
Scenario: Documentation link not shown to learners
Given I am on the homepage
Then I do not see the documentation link
Expand Up @@ -10,6 +10,16 @@
<li role="menuitem"><a href="{{ url "facility_user_signup" }}" id="nav_signup">{{_ "Sign Up" }}</a></li>
{{/unless}}

{{#if docs_exist}}
{{#if is_admin}}
<li role="menuitem" id="nav_documentation">
<a role="menuitem" tabindex="-1" id="documentation_a" href="/static/html/usermanual/userman_main.html">
{{_ "User Manual" }}
</a>
</li>
{{/if}}
{{/if}}

<hr class="nav-divider">
{{#if is_admin}}
<hr class="nav-divider">
Expand Down Expand Up @@ -41,13 +51,6 @@
{{_ "Logout" }}
</a>
</li>
{{#if docs_exist}}
<li role="presentation" id="documentation">
<a role="menuitem" tabindex="-1" id="documentation_a" href="/static/html/index.html">
{{_ "Documentation" }}
</a>
</li>
{{/if}}
</ul>
</li>
{{/if}}
9 changes: 9 additions & 0 deletions kalite/testing/behave_helpers.py
Expand Up @@ -86,6 +86,15 @@ def _assert_no_element_by(context, by, value, wait_time=MAX_PAGE_LOAD_TIME):
)


def assert_no_element_by_id(context, _id, wait_time=MAX_PAGE_LOAD_TIME):
"""
Assert that no element is found. Use a wait in case the element currently exists
on the page, and we want to wait for it to disappear before doing the assert.
Finds the element using an id.
"""
_assert_no_element_by(context, By.ID, _id, wait_time)


def assert_no_element_by_css_selector(context, css_value, wait_time=MAX_PAGE_LOAD_TIME):
"""
Assert that no element is found. Use a wait in case the element currently exists
Expand Down

0 comments on commit ca21814

Please sign in to comment.