Commit f4799f98 by Jonah Stanley

Merge pull request #630 from edx/jonahstanley/fix-courseteam-tests

Jonahstanley/fix courseteam tests
parents 53bda391 0595459c
...@@ -146,12 +146,13 @@ def fill_in_course_info( ...@@ -146,12 +146,13 @@ def fill_in_course_info(
def log_into_studio( def log_into_studio(
uname='robot', uname='robot',
email='robot+studio@edx.org', email='robot+studio@edx.org',
password='test'): password='test',
name='Robot Studio'):
world.log_in(username=uname, password=password, email=email, name='Robot Studio') world.log_in(username=uname, password=password, email=email, name=name)
# Navigate to the studio dashboard # Navigate to the studio dashboard
world.visit('/') world.visit('/')
world.wait_for(lambda _driver: uname in world.css_find('h2.title')[0].text)
def create_a_course(): def create_a_course():
course = world.CourseFactory.create(org='MITx', course='999', display_name='Robot Super Course') course = world.CourseFactory.create(org='MITx', course='999', display_name='Robot Super Course')
......
...@@ -71,7 +71,7 @@ Feature: Course Team ...@@ -71,7 +71,7 @@ Feature: Course Team
And she selects the new course And she selects the new course
And she views the course team settings And she views the course team settings
And she deletes me from the course team And she deletes me from the course team
And I log in And I am logged into studio
Then I do not see the course on my page Then I do not see the course on my page
Scenario: Admins should be able to remove their own admin rights Scenario: Admins should be able to remove their own admin rights
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
#pylint: disable=W0621 #pylint: disable=W0621
from lettuce import world, step from lettuce import world, step
from common import create_studio_user, log_into_studio from common import create_studio_user
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from auth.authz import get_course_groupname_for_role from auth.authz import get_course_groupname_for_role, get_user_by_email
from nose.tools import assert_true
PASSWORD = 'test' PASSWORD = 'test'
EMAIL_EXTENSION = '@edx.org' EMAIL_EXTENSION = '@edx.org'
...@@ -66,6 +67,7 @@ def other_delete_self(_step): ...@@ -66,6 +67,7 @@ def other_delete_self(_step):
email="robot+studio@edx.org") email="robot+studio@edx.org")
world.css_click(to_delete_css) world.css_click(to_delete_css)
# confirm prompt # confirm prompt
world.wait(.5)
world.css_click(".wrapper-prompt-warning .action-primary") world.css_click(".wrapper-prompt-warning .action-primary")
...@@ -89,7 +91,21 @@ def remove_course_team_admin(_step, outer_capture, name): ...@@ -89,7 +91,21 @@ def remove_course_team_admin(_step, outer_capture, name):
@step(u'"([^"]*)" logs in$') @step(u'"([^"]*)" logs in$')
def other_user_login(_step, name): def other_user_login(_step, name):
log_into_studio(uname=name, password=PASSWORD, email=name + EMAIL_EXTENSION) world.browser.cookies.delete()
world.visit('/')
signin_css = 'a.action-signin'
world.is_css_present(signin_css)
world.css_click(signin_css)
def fill_login_form():
login_form = world.browser.find_by_css('form#login_form')
login_form.find_by_name('email').fill(name + EMAIL_EXTENSION)
login_form.find_by_name('password').fill(PASSWORD)
login_form.find_by_name('submit').click()
world.retry_on_exception(fill_login_form)
assert_true(world.is_css_present('.new-course-button'))
world.scenario_dict['USER'] = get_user_by_email(name + EMAIL_EXTENSION)
@step(u'I( do not)? see the course on my page') @step(u'I( do not)? see the course on my page')
......
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