diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py
index a80fbcbb8f..aa4ed56a16 100644
--- a/cms/djangoapps/contentstore/features/common.py
+++ b/cms/djangoapps/contentstore/features/common.py
@@ -58,6 +58,7 @@ def i_have_opened_a_new_course(step):
####### HELPER FUNCTIONS ##############
def open_new_course():
world.clear_courses()
+ create_studio_user()
log_into_studio()
create_a_course()
@@ -90,10 +91,7 @@ def fill_in_course_info(
def log_into_studio(
uname='robot',
email='robot+studio@edx.org',
- password='test',
- is_staff=False):
-
- create_studio_user(uname=uname, email=email, is_staff=is_staff)
+ password='test'):
world.browser.cookies.delete()
world.visit('/')
diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py
index 7bf538157d..cfcd0e053d 100644
--- a/cms/djangoapps/contentstore/features/course-team.py
+++ b/cms/djangoapps/contentstore/features/course-team.py
@@ -2,10 +2,10 @@
#pylint: disable=W0621
from lettuce import world, step
-from common import create_studio_user, COURSE_NAME
+from common import create_studio_user, log_into_studio, COURSE_NAME
-PASS = 'test'
-EXTENSION = '@edx.org'
+PASSWORD = 'test'
+EMAIL_EXTENSION = '@edx.org'
@step(u'I am viewing the course team settings')
@@ -17,49 +17,39 @@ def view_grading_settings(step):
@step(u'The user "([^"]*)" exists$')
def create_other_user(step, name):
- create_studio_user(uname=name, password=PASS, email=(name + EXTENSION))
+ create_studio_user(uname=name, password=PASSWORD, email=(name + EMAIL_EXTENSION))
@step(u'I add "([^"]*)" to the course team')
def add_other_user(step, name):
- new_user_css = '.new-user-button'
- world.css_find(new_user_css).click()
+ new_user_css = 'a.new-user-button'
+ world.css_click(new_user_css)
- email_css = '.email-input'
+ email_css = 'input.email-input'
f = world.css_find(email_css)
- f._element.send_keys(name, EXTENSION)
+ f._element.send_keys(name, EMAIL_EXTENSION)
confirm_css = '#add_user'
- world.css_find(confirm_css).click()
+ world.css_click(confirm_css)
@step(u'I delete "([^"]*)" from the course team')
def delete_other_user(step, name):
- to_delete_css = '.remove-user[data-id="%s%s"]' % (name, EXTENSION,)
- world.css_find(to_delete_css).click()
+ to_delete_css = '.remove-user[data-id="{name}{extension}"]'.format(name=name, extension=EMAIL_EXTENSION,)
+ world.css_click(to_delete_css)
@step(u'"([^"]*)" logs in$')
def other_user_login(step, name):
- world.browser.cookies.delete()
- world.visit('/')
-
- signin_css = 'a.action-signin'
- world.is_css_present(signin_css)
- world.css_click(signin_css)
-
- login_form = world.browser.find_by_css('form#login_form')
- login_form.find_by_name('email').fill(name + EXTENSION)
- login_form.find_by_name('password').fill(PASS)
- login_form.find_by_name('submit').click()
+ log_into_studio(uname=name, password=PASSWORD, email=name + EMAIL_EXTENSION)
@step(u'He does( not)? see the course on his page')
-def see_course(step, doesnt):
+def see_course(step, doesnt_see_course):
class_css = '.class-name'
all_courses = world.css_find(class_css)
all_names = [item.html for item in all_courses]
- if doesnt:
+ if doesnt_see_course:
assert not COURSE_NAME in all_names
else:
assert COURSE_NAME in all_names
diff --git a/cms/djangoapps/contentstore/features/course-updates.feature b/cms/djangoapps/contentstore/features/course-updates.feature
index 7266e4f9a6..81714c43ae 100644
--- a/cms/djangoapps/contentstore/features/course-updates.feature
+++ b/cms/djangoapps/contentstore/features/course-updates.feature
@@ -4,41 +4,34 @@ Feature: Course updates
Scenario: Users can add updates
Given I have opened a new course in Studio
And I go to the course updates page
- When I add a new update
- And I make the text "Hello"
+ When I add a new update with the text "Hello"
Then I should see the update "Hello"
Scenario: Users can edit updates
Given I have opened a new course in Studio
And I go to the course updates page
- When I add a new update
- And I make the text "Hello"
- And I click the "edit" button
- And I make the text "Goodbye"
+ When I add a new update with the text "Hello"
+ And I modify the text to "Goodbye"
Then I should see the update "Goodbye"
Scenario: Users can delete updates
Given I have opened a new course in Studio
And I go to the course updates page
- And I add a new update
- And I make the text "Hello"
+ And I add a new update with the text "Hello"
When I will confirm all alerts
- And I click the "delete" button
+ And I delete the update
Then I should not see the update "Hello"
Scenario: Users can edit update dates
Given I have opened a new course in Studio
And I go to the course updates page
- And I add a new update
- And I make the text "Hello"
- When I click the "edit" button
- And I make the date "June 1, 2013"
+ And I add a new update with the text "Hello"
+ When I edit the date to "June 1, 2013"
Then I should see the date "June 1, 2013"
Scenario: Users can change handouts
Given I have opened a new course in Studio
And I go to the course updates page
- When I edit the handouts
- And I make the text "
Test
"
+ When I modify the handout to "Test
"
Then I see the handout "Test"
diff --git a/cms/djangoapps/contentstore/features/course-updates.py b/cms/djangoapps/contentstore/features/course-updates.py
index 4d0b5ef174..dbb9cbc958 100644
--- a/cms/djangoapps/contentstore/features/course-updates.py
+++ b/cms/djangoapps/contentstore/features/course-updates.py
@@ -9,18 +9,75 @@ from selenium.webdriver.common.keys import Keys
def go_to_uploads(step):
menu_css = 'li.nav-course-courseware'
uploads_css = '.nav-course-courseware-updates'
- world.css_find(menu_css).click()
- world.css_find(uploads_css).click()
+ world.css_click(menu_css)
+ world.css_click(uploads_css)
-@step(u'I add a new update')
-def add_update(step):
+@step(u'I add a new update with the text "([^"]*)"$')
+def add_update(step, text):
update_css = '.new-update-button'
- world.css_find(update_css).click()
+ world.css_click(update_css)
+ change_text(text)
-@step(u'I make the text "([^"]*)"$')
-def change_text(step, text):
+@step(u'I should( not)? see the update "([^"]*)"$')
+def check_update(step, doesnt_see_update, text):
+ update_css = '.update-contents'
+ update = world.css_find(update_css)
+ if doesnt_see_update:
+ assert len(update) == 0 or not text in update.html
+ else:
+ assert text in update.html
+
+
+@step(u'I modify the text to "([^"]*)"$')
+def modify_update(step, text):
+ button_css = '.post-preview .edit-button'
+ world.css_click(button_css)
+ change_text(text)
+
+
+@step(u'I delete the update$')
+def click_button(step):
+ button_css = '.post-preview .delete-button'
+ world.css_click(button_css)
+
+
+@step(u'I edit the date to "([^"]*)"$')
+def change_date(step, new_date):
+ button_css = '.post-preview .edit-button'
+ world.css_click(button_css)
+ date_css = 'input.date'
+ date = world.css_find(date_css)
+ for i in range(len(date.value)):
+ date._element.send_keys(Keys.END, Keys.BACK_SPACE)
+ date._element.send_keys(new_date)
+ save_css = '.save-button'
+ world.css_click(save_css)
+
+
+@step(u'I should see the date "([^"]*)"$')
+def check_date(step, date):
+ date_css = '.date-display'
+ date_html = world.css_find(date_css)
+ assert date == date_html.html
+
+
+@step(u'I modify the handout to "([^"]*)"$')
+def edit_handouts(step, text):
+ edit_css = '.course-handouts > .edit-button'
+ world.css_click(edit_css)
+ change_text(text)
+
+
+@step(u'I see the handout "([^"]*)"$')
+def check_handout(step, handout):
+ handout_css = '.handouts-content'
+ handouts = world.css_find(handout_css)
+ assert handout in handouts.html
+
+
+def change_text(text):
text_css = 'div.CodeMirror > div > textarea'
prev_css = 'div.CodeMirror-lines > div > div:last-child > pre'
all_lines = world.css_find(prev_css)
@@ -32,51 +89,4 @@ def change_text(step, text):
text_area._element.send_keys(Keys.END, Keys.BACK_SPACE)
text_area._element.send_keys(text)
save_css = '.save-button'
- world.css_find(save_css).click()
-
-
-@step(u'I should( not)? see the update "([^"]*)"$')
-def check_update(step, doesnt, text):
- update_css = '.update-contents'
- update = world.css_find(update_css)
- if doesnt:
- assert len(update) == 0 or not text in update.html
- else:
- assert text in update.html
-
-
-@step(u'I click the "([^"]*)" button$')
-def click_button(step, edit_delete):
- button_css = '.post-preview .%s-button' % edit_delete
- world.css_find(button_css).click()
-
-
-@step(u'I make the date "([^"]*)"$')
-def change_date(step, new_date):
- date_css = 'input.date'
- date = world.css_find(date_css)
- for i in range(len(date.value)):
- date._element.send_keys(Keys.END, Keys.BACK_SPACE)
- date._element.send_keys(new_date)
- save_css = '.save-button'
- world.css_find(save_css).click()
-
-
-@step(u'I should see the date "([^"]*)"$')
-def check_date(step, date):
- date_css = '.date-display'
- date_html = world.css_find(date_css)
- assert date == date_html.html
-
-
-@step(u'I edit the handouts')
-def edit_handouts(step):
- edit_css = '.course-handouts > .edit-button'
- world.css_find(edit_css).click()
-
-
-@step(u'I see the handout "([^"]*)"$')
-def check_handout(step, handout):
- handout_css = '.handouts-content'
- handouts = world.css_find(handout_css)
- assert handout in handouts.html
+ world.css_click(save_css)
diff --git a/cms/djangoapps/contentstore/features/courses.py b/cms/djangoapps/contentstore/features/courses.py
index a3e838a9d1..5b279d402f 100644
--- a/cms/djangoapps/contentstore/features/courses.py
+++ b/cms/djangoapps/contentstore/features/courses.py
@@ -10,6 +10,7 @@ from common import *
@step('There are no courses$')
def no_courses(step):
world.clear_courses()
+ create_studio_user()
@step('I click the New Course button$')
diff --git a/cms/djangoapps/contentstore/features/static-pages.feature b/cms/djangoapps/contentstore/features/static-pages.feature
index 99a4e802dd..9997df69f0 100644
--- a/cms/djangoapps/contentstore/features/static-pages.feature
+++ b/cms/djangoapps/contentstore/features/static-pages.feature
@@ -22,13 +22,3 @@ Feature: Static Pages
When I "edit" the "Empty" page
And I change the name to "New"
Then I should see a "New" static page
-
- Scenario: Users can reorder static pages
- Given I have opened a new course in Studio
- And I go to the static pages page
- And I add a new page
- And I "edit" the "Empty" page
- And I change the name to "New"
- And I add a new page
- When I move "New" after "Empty"
- Then I see the order is "Empty New"
diff --git a/cms/djangoapps/contentstore/features/static-pages.py b/cms/djangoapps/contentstore/features/static-pages.py
index 2a1110de40..56d12f18aa 100644
--- a/cms/djangoapps/contentstore/features/static-pages.py
+++ b/cms/djangoapps/contentstore/features/static-pages.py
@@ -50,27 +50,10 @@ def change_name(step, new_name):
world.css_find(save_button).click()
-@step(u'I move "([^"]*)" after "([^"]*)"$')
-def change_list(step, item1, item2):
- index1 = get_index(item1)
- index2 = get_index(item2)
- assert index1 != -1 and index2 != -1
- world.drag_sortable_after(".component", index1, index2, ".ui-sortable")
-
-
-@step(u'I see the order is "([^"]*)"$')
-def check_order(step, items):
- items = items.split(' ')
- name_css = 'section[data-type="HTMLModule"]'
- all_elements = world.css_find(name_css)
- for i in range(len(items)):
- assert all_elements[i].html == '\n %s\n' % items[i]
-
-
def get_index(name):
page_name_css = 'section[data-type="HTMLModule"]'
all_pages = world.css_find(page_name_css)
for i in range(len(all_pages)):
- if all_pages[i].html == '\n %s\n' % name:
+ if all_pages[i].html == '\n {name}\n'.format(name=name):
return i
return -1
diff --git a/cms/djangoapps/contentstore/features/studio-overview-togglesection.py b/cms/djangoapps/contentstore/features/studio-overview-togglesection.py
index 3a39f3cc15..3aca2aee92 100644
--- a/cms/djangoapps/contentstore/features/studio-overview-togglesection.py
+++ b/cms/djangoapps/contentstore/features/studio-overview-togglesection.py
@@ -50,7 +50,8 @@ def have_a_course_with_two_sections(step):
@step(u'I navigate to the course overview page$')
def navigate_to_the_course_overview_page(step):
- log_into_studio(is_staff=True)
+ create_studio_user(is_staff=True)
+ log_into_studio()
course_locator = '.class-name'
world.css_click(course_locator)
diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py
index d7a6eba999..16e38e3ff7 100644
--- a/cms/djangoapps/contentstore/features/upload.py
+++ b/cms/djangoapps/contentstore/features/upload.py
@@ -20,6 +20,7 @@ def upload_file(step, file_name):
file_css = '.file-input'
upload = world.css_find(file_css)
+ #uploading the file itself
upload._element.send_keys(os.getcwd() + '/' + file_name)
close_css = '.close-button'
diff --git a/common/djangoapps/terrain/ui_helpers.py b/common/djangoapps/terrain/ui_helpers.py
index c59d7030ff..ecd43eb719 100644
--- a/common/djangoapps/terrain/ui_helpers.py
+++ b/common/djangoapps/terrain/ui_helpers.py
@@ -158,15 +158,3 @@ def click_tools():
tools_css = 'li.nav-course-tools'
if world.browser.is_element_present_by_css(tools_css):
world.css_click(tools_css)
-
-
-@world.absorb
-def drag_sortable_after(item_css, index1, index2, sortable_css):
- """
- This is a hack in order to simulate jQuery's sortable list dragging as Selenium cannot currently do it with action_chains
- Please note that this is very finnicky with keeping the changes after refreshing the page so be careful when testing persistant changes
- Also note that this is mainly for visualization of the sortable list and the true sortable drag and drop fires many events
- """
- world.browser.execute_script('$("%(item_css)s:eq(%(index_one)s)").insertAfter($("%(item_css)s:eq(%(index_two)s)"));\
- $("%(sortable_css)s").trigger("sortupdate")' %
- {'item_css': item_css, 'index_one': index1, 'index_two': index2, 'sortable_css': sortable_css})