Commit 70d48e2e by JonahStanley

Now referencing css element

parent b9d79aea
......@@ -2,7 +2,7 @@
#pylint: disable=W0621
from lettuce import world, step
from common import create_studio_user, log_into_studio, COURSE_NAME
from common import create_studio_user, log_into_studio, _COURSE_NAME
PASSWORD = 'test'
EMAIL_EXTENSION = '@edx.org'
......@@ -35,7 +35,7 @@ def add_other_user(_step, name):
@step(u'I delete "([^"]*)" from the course team')
def delete_other_user(_step, name):
to_delete_css = '.remove-user[data-id="{name}{extension}"]'.format(name=name, extension=EMAIL_EXTENSION)
to_delete_css = 'a.remove-user[data-id="{name}{extension}"]'.format(name=name, extension=EMAIL_EXTENSION)
world.css_click(to_delete_css)
......@@ -46,22 +46,22 @@ def other_user_login(_step, name):
@step(u'He does( not)? see the course on his page')
def see_course(_step, doesnt_see_course):
class_css = '.class-name'
class_css = 'span.class-name'
all_courses = world.css_find(class_css)
all_names = [item.html for item in all_courses]
if doesnt_see_course:
assert not COURSE_NAME in all_names
assert not _COURSE_NAME in all_names
else:
assert COURSE_NAME in all_names
assert _COURSE_NAME in all_names
@step(u'He cannot delete users')
def cannot_delete(_step):
to_delete_css = '.remove-user'
to_delete_css = 'a.remove-user'
assert world.is_css_not_present(to_delete_css)
@step(u'He cannot add users')
def cannot_add(_step):
add_css = '.new-user'
add_css = 'a.new-user'
assert world.is_css_not_present(add_css)
......@@ -7,23 +7,23 @@ from common import type_in_codemirror
@step(u'I go to the course updates page')
def go_to_uploads(_step):
def go_to_updates(_step):
menu_css = 'li.nav-course-courseware'
uploads_css = '.nav-course-courseware-updates'
updates_css = 'li.nav-course-courseware-updates'
world.css_click(menu_css)
world.css_click(uploads_css)
world.css_click(updates_css)
@step(u'I add a new update with the text "([^"]*)"$')
def add_update(_step, text):
update_css = '.new-update-button'
update_css = 'a.new-update-button'
world.css_click(update_css)
change_text(text)
@step(u'I should( not)? see the update "([^"]*)"$')
def check_update(_step, doesnt_see_update, text):
update_css = '.update-contents'
update_css = 'div.update-contents'
update = world.css_find(update_css)
if doesnt_see_update:
assert len(update) == 0 or not text in update.html
......@@ -33,52 +33,52 @@ def check_update(_step, doesnt_see_update, text):
@step(u'I modify the text to "([^"]*)"$')
def modify_update(_step, text):
button_css = '.post-preview .edit-button'
button_css = 'div.post-preview a.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'
button_css = 'div.post-preview a.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'
button_css = 'div.post-preview a.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'
save_css = 'a.save-button'
world.css_click(save_css)
@step(u'I should see the date "([^"]*)"$')
def check_date(_step, date):
date_css = '.date-display'
date_css = 'span.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'
edit_css = 'div.course-handouts > a.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'
handout_css = 'div.handouts-content'
handouts = world.css_find(handout_css)
assert handout in handouts.html
def change_text(text):
type_in_codemirror(0, text)
save_css = '.save-button'
save_css = 'a.save-button'
world.css_click(save_css)
......@@ -6,16 +6,16 @@ from selenium.webdriver.common.keys import Keys
@step(u'I go to the static pages page')
def go_to_uploads(_step):
def go_to_static(_step):
menu_css = 'li.nav-course-courseware'
uploads_css = '.nav-course-courseware-pages'
static_css = 'li.nav-course-courseware-pages'
world.css_find(menu_css).click()
world.css_find(uploads_css).click()
world.css_find(static_css).click()
@step(u'I add a new page')
def add_page(_step):
button_css = '.new-button'
button_css = 'a.new-button'
world.css_find(button_css).click()
......@@ -30,7 +30,7 @@ def see_page(_step, doesnt, page):
@step(u'I "([^"]*)" the "([^"]*)" page$')
def click_edit_delete(_step, edit_delete, page):
button_css = '.%s-button' % edit_delete
button_css = 'a.%s-button' % edit_delete
index = get_index(page)
assert index != -1
world.css_find(button_css)[index].click()
......@@ -40,13 +40,13 @@ def click_edit_delete(_step, edit_delete, page):
def change_name(_step, new_name):
settings_css = '#settings-mode'
world.css_find(settings_css).click()
input_css = '.setting-input'
input_css = 'input.setting-input'
name_input = world.css_find(input_css)
old_name = name_input.value
for count in range(len(old_name)):
name_input._element.send_keys(Keys.END, Keys.BACK_SPACE)
name_input._element.send_keys(new_name)
save_button = '.save-button'
save_button = 'a.save-button'
world.css_find(save_button).click()
......
......@@ -15,23 +15,23 @@ HTTP_PREFIX = "http://localhost:8001"
@step(u'I go to the files and uploads page')
def go_to_uploads(_step):
menu_css = 'li.nav-course-courseware'
uploads_css = '.nav-course-courseware-uploads'
uploads_css = 'li.nav-course-courseware-uploads'
world.css_find(menu_css).click()
world.css_find(uploads_css).click()
@step(u'I upload the file "([^"]*)"$')
def upload_file(_step, file_name):
upload_css = '.upload-button'
upload_css = 'a.upload-button'
world.css_find(upload_css).click()
file_css = '.file-input'
file_css = 'input.file-input'
upload = world.css_find(file_css)
#uploading the file itself
path = os.path.join(TEST_ROOT, 'uploads/', file_name)
upload._element.send_keys(os.path.abspath(path))
close_css = '.close-button'
close_css = 'a.close-button'
world.css_find(close_css).click()
......@@ -54,7 +54,8 @@ def check_url(_step, file_name):
def delete_file(_step, file_name):
index = get_index(file_name)
assert index != -1
delete_css = ".remove-asset-button"
from pdb import set_trace; set_trace()
delete_css = "a.remove-asset-button"
world.css_click(delete_css, index=index)
prompt_confirm_css = 'li.nav-item > a.action-primary'
......@@ -63,7 +64,7 @@ def delete_file(_step, file_name):
@step(u'I should see only one "([^"]*)"$')
def no_duplicate(_step, file_name):
names_css = '.name-col > a.filename'
names_css = 'td.name-col > a.filename'
all_names = world.css_find(names_css)
only_one = False
for i in range(len(all_names)):
......@@ -91,7 +92,7 @@ def modify_upload(_step, file_name):
def get_index(file_name):
names_css = '.name-col > a.filename'
names_css = 'td.name-col > a.filename'
all_names = world.css_find(names_css)
for i in range(len(all_names)):
if file_name == all_names[i].html:
......
This is an arbitrary file for testing uploads
R2FUIGM88K
\ No newline at end of file
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