Skip to content

Commit

Permalink
Merge pull request #4316 from MCGallaspy/4314-increase-timeout
Browse files Browse the repository at this point in the history
Increase timeout for test
  • Loading branch information
aronasorman committed Aug 29, 2015
2 parents 57207b1 + 6037355 commit 10a9303
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion kalite/coachreports/features/steps/coachreports.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ def impl(context):

@when(u"I click on the partial colored cell")
def impl(context):
click_and_wait_for_id_to_appear(context, find_css_with_wait(context, "td.partial"), "details-panel-view")
click_and_wait_for_id_to_appear(context, find_css_with_wait(context, "td.partial"), "details-panel-view",
wait_time=30)

@then(u"I should see a Hide Tabular Report button")
def impl(context):
Expand Down
26 changes: 19 additions & 7 deletions kalite/distributed/features/steps/superuser_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from django.contrib.auth.models import User

modal_container = "superusercreate-container"
PASSWORD_ID = "id_superpassword"
USERNAME_ID = "id_superusername"
PASSWORD_CONFIRM_ID = "id_confirmsuperpassword"

@then("there should be no modal displayed")
def step_impl(context):
Expand Down Expand Up @@ -38,7 +41,7 @@ def step_impl(context):

@then('the username border will turn red')
def impl(context):
is_border_red(context, "id_superusername")
is_border_red(context, USERNAME_ID)

@when("I enter a username longer than 40 letters")
def step_impl(context):
Expand All @@ -54,7 +57,7 @@ def step_impl(context):

@then('the password border will turn red')
def impl(context):
is_border_red(context, "id_superpassword")
is_border_red(context, PASSWORD_ID)

@when("I enter a password longer than 40 letters")
def step_impl(context):
Expand All @@ -66,7 +69,7 @@ def step_impl(context):

@then("the confirmsuperpassword border will turn red")
def impl(context):
is_border_red(context, "id_confirmsuperpassword")
is_border_red(context, PASSWORD_CONFIRM_ID)

@when("I enter username correctly")
def step_impl(context):
Expand All @@ -82,6 +85,12 @@ def step_impl(context):

@then("the modal will dismiss")
def impl(context):
for id_ in (PASSWORD_CONFIRM_ID, PASSWORD_ID, USERNAME_ID):
try:
is_border_red(context, id_)
raise RedBorderException("The border should not be red for the element with id #{0}".format(id_))
except AssertionError:
pass # The border should _not_ be red, so the above function _should_ raise an exception
assert elem_is_invisible_with_wait(context, context.modal_element, wait_time=60), "modal not dismissed!"

def fill_field(context, text, field_id):
Expand All @@ -90,16 +99,19 @@ def fill_field(context, text, field_id):
field.send_keys(text)

def fill_username(context, text):
fill_field(context, text, "id_superusername")
fill_field(context, text, USERNAME_ID)

def fill_password(context, text):
fill_field(context, text, "id_superpassword")
fill_field(context, text, PASSWORD_ID)

def reenter_password(context, text):
fill_field(context, text, "id_confirmsuperpassword")
fill_field(context, text, PASSWORD_CONFIRM_ID)

def is_border_red(context, field_id):
assert find_id_with_wait(context, field_id), "border field is None!"
border = find_id_with_wait(context, field_id)
border_color = border.value_of_css_property('border-color')
assert border_color == 'rgb(169, 68, 66)', "border not red!"
assert border_color == 'rgb(169, 68, 66)', "border not red!"

class RedBorderException(Exception):
pass

0 comments on commit 10a9303

Please sign in to comment.