diff --git a/.gitignore b/.gitignore index 93e13220af..137bcb30c0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/MANIFEST.in.dist b/MANIFEST.in.dist index e0334b2fe4..d5301d9838 100644 --- a/MANIFEST.in.dist +++ b/MANIFEST.in.dist @@ -33,3 +33,5 @@ recursive-exclude python-packages *pyc # Docs recursive-include docs/_build/html * +include docs/kalite.1.gz + diff --git a/Makefile b/Makefile index c66359e350..c516023cd7 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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 diff --git a/circle.yml b/circle.yml index 19c09bbbb3..6588cb8970 100644 --- a/circle.yml +++ b/circle.yml @@ -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 diff --git a/docs/kalite.1.gz b/docs/kalite.1.gz new file mode 100644 index 0000000000..935053e677 Binary files /dev/null and b/docs/kalite.1.gz differ diff --git a/kalite/distributed/features/steps/ui_regression.py b/kalite/distributed/features/steps/ui_regression.py index 1cc97dd5ac..68bf47e668 100644 --- a/kalite/distributed/features/steps/ui_regression.py +++ b/kalite/distributed/features/steps/ui_regression.py @@ -1,11 +1,13 @@ -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") @@ -13,7 +15,7 @@ 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) @@ -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"))) \ No newline at end of file diff --git a/kalite/distributed/features/ui_regression.feature b/kalite/distributed/features/ui_regression.feature index f29b8c376e..66e0eb9425 100644 --- a/kalite/distributed/features/ui_regression.feature +++ b/kalite/distributed/features/ui_regression.feature @@ -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 \ No newline at end of file + 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 diff --git a/kalite/distributed/static/js/distributed/user/hbtemplates/navigation.handlebars b/kalite/distributed/static/js/distributed/user/hbtemplates/navigation.handlebars index 0a286ce737..a56636168e 100644 --- a/kalite/distributed/static/js/distributed/user/hbtemplates/navigation.handlebars +++ b/kalite/distributed/static/js/distributed/user/hbtemplates/navigation.handlebars @@ -10,6 +10,16 @@
  • {{_ "Sign Up" }}
  • {{/unless}} +{{#if docs_exist}} + {{#if is_admin}} + + {{/if}} +{{/if}} + {{#if is_admin}} @@ -41,13 +51,6 @@ {{_ "Logout" }} - {{#if docs_exist}} - - {{/if}} {{/if}} \ No newline at end of file diff --git a/kalite/testing/behave_helpers.py b/kalite/testing/behave_helpers.py index 6718d099d8..eebfa97b4b 100644 --- a/kalite/testing/behave_helpers.py +++ b/kalite/testing/behave_helpers.py @@ -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