Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
added functional test for registration
  • Loading branch information
dtraviglia committed Mar 20, 2015
1 parent 3ff4451 commit d26a2cc072d9c13f9072e84ed33f0fd3547ae1ce
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 16 deletions.
Empty file.
@@ -0,0 +1,31 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from django.test import LiveServerTestCase

class NewVisitorTest(LiveServerTestCase):

def setUp(self):
self.browser = webdriver.Chrome()
self.browser.implicitly_wait(3)

def tearDown(self):
self.browser.close()

def test_can_register_and_navigate_to_task_list(self):
# browse to online portal
self.browser.get(self.live_server_url)

# click the sign in page
self.browser.find_element_by_link_text("Register").click()

# click to accept the intro material
self.browser.find_element_by_id("intro-complete").submit()

# register a new user
inputemail = self.browser.find_element_by_name("email")
inputpassword = self.browser.find_element_by_name("password")
inputemail.send_keys("dftnew@test.com")
inputpassword.send_keys("dft")
self.browser.find_element_by_name("submit").submit()
self.browser.implicitly_wait(5)

@@ -8,7 +8,7 @@ <h2>Thank you for registering!</h2>
{% else %}
<h2>Create an account</h2>

<form role="form" id="user_form" method="post" action="/op_tasks/register/" enctype="multipart/form-data">
<form role="form" id="user_form" method="post" action="/op_tasks/register" enctype="multipart/form-data">
{% csrf_token %}

<!-- Display each form. The as_p method wraps each element in a paragraph
@@ -8,9 +8,16 @@
<b class="panel-title">Achievements</b>
</div>
<div class="panel-body">
<br>achievement 1
<br>achievement 2
<br>achievement 3
<div class="media">
<div class="media-body">
<h4 class="media-heading">Achievement 1</h4>
</div>
<div class="media-right">
<a href="#">
<img class="media-object" src="/static/images/Colonel_Grade_3.png" alt="...">
</a>
</div>
</div>
</div>
</div>

@@ -23,7 +30,7 @@ <h1><b>Status</b></h1>

<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60"
aria-valuemin="0" aria-valuemax="100" style="width: {{user.userprofile.progress}}%;">
aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: {{user.userprofile.progress}}%;">
{{user.userprofile.progress}}% Complete
</div>
</div>
@@ -137,7 +137,8 @@ def register(request):
# Update our variable to tell the template registration was successful.
registered = True
print "successful registration"
return HttpResponseRedirect("/op_tasks/task_list/")
login_participant(request)
return render(request, 'instructions/exp_instructions.html', {'user': request.user})

# Invalid form or forms - mistakes or something else?
# Print problems to the terminal.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -58,11 +58,8 @@

WSGI_APPLICATION = 'xdata.wsgi.application'



AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
# 'op_tasks.models.MyBackend'
)

# AUTH_PROFILE_MODULE = 'op_tasks.UserProfile'
@@ -78,8 +75,6 @@
}
}



# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

@@ -93,7 +88,6 @@

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

@@ -6,8 +6,8 @@
{% endblock %}
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>XDATA | Online Experiment</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{% static "css/styles.css" %}">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="{% static "css/styles.css" %}">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
</head>
@@ -27,12 +27,12 @@

<div class="container-fluid">
<div class="row">
<div class="col-md-3 sidebar">
<div class="col-md-4 sidebar">

{% block side_block %} {% endblock %}

</div>
<div class="col-md-9 main">
<div class="col-md-8 main">

{% block content %} {% endblock %}

0 comments on commit d26a2cc

Please sign in to comment.