summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh2017-09-01 16:51:37 +0530
committerprathamesh2017-09-01 16:51:37 +0530
commite2c65655dcdc5558cfb4ab668c3012024d27ac75 (patch)
tree9ec6504e6bdc2f35f37260981ab584d1b9b3b9b4
parent3d9bce5471d04bf50e03155d3cd67bdae44a4fcc (diff)
downloadonline_test-e2c65655dcdc5558cfb4ab668c3012024d27ac75.tar.gz
online_test-e2c65655dcdc5558cfb4ab668c3012024d27ac75.tar.bz2
online_test-e2c65655dcdc5558cfb4ab668c3012024d27ac75.zip
Removed all the checkpoints set for selenium tests on travis
javascript strings includes method changed to indexOf, as includes belongs to ES6. This was the main reason for failure of selenium tests on travis.
-rwxr-xr-xyaksh/code_server.py2
-rw-r--r--yaksh/live_server_tests/selenium_test.py12
-rw-r--r--yaksh/models.py2
-rw-r--r--yaksh/static/yaksh/js/requesthandler.js2
-rw-r--r--yaksh/views.py4
5 files changed, 6 insertions, 16 deletions
diff --git a/yaksh/code_server.py b/yaksh/code_server.py
index fc8ef4c..75dd9b2 100755
--- a/yaksh/code_server.py
+++ b/yaksh/code_server.py
@@ -203,7 +203,6 @@ def submit(url, uid, json_data, user_dir):
user_dir : str
User directory.
'''
- print("submitted")
requests.post(
url, data=dict(uid=uid, json_data=json_data, user_dir=user_dir)
)
@@ -230,7 +229,6 @@ def get_result(url, uid, block=False):
Set to True if you wish to block till result is done.
'''
- print("get triggered")
def _get_data():
r = requests.get(urllib.parse.urljoin(url, str(uid)))
return json.loads(r.content.decode('utf-8'))
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py
index d9ae9cd..21a9e42 100644
--- a/yaksh/live_server_tests/selenium_test.py
+++ b/yaksh/live_server_tests/selenium_test.py
@@ -17,11 +17,8 @@ class ElementDisplay(object):
def __call__(self, driver):
try:
element = EC._find_element(driver, self.locator)
- a = element.value_of_css_property("display") == "none"
- print(a)
- return a
+ return element.value_of_css_property("display") == "none"
except Exception as e:
- print(e)
return False
@@ -65,7 +62,6 @@ class SeleniumTest():
def submit_answer(self, question_label, answer, loop_count=1):
self.driver.implicitly_wait(2)
for count in range(loop_count):
- print("in")
self.driver.find_element_by_link_text(question_label).click()
submit_answer_elem = self.driver.find_element_by_id("check")
self.driver.execute_script('global_editor.editor.setValue({});'.format(answer))
@@ -75,7 +71,7 @@ class SeleniumTest():
def test_c_question(self, question_label):
# Incorrect Answer
- loop_count = 3
+ loop_count = 10
answer = '\"int add(int a, int b, int c)\\n{return;}\"'
self.submit_answer(question_label, answer, loop_count)
@@ -91,7 +87,7 @@ class SeleniumTest():
def test_python_question(self, question_label):
# Incorrect Answer
- loop_count = 3
+ loop_count = 10
answer = '\"def is_palindrome(s):\\n return s\"'
self.submit_answer(question_label, answer, loop_count)
@@ -107,7 +103,7 @@ class SeleniumTest():
def test_bash_question(self, question_label):
# Incorrect Answer
- loop_count = 3
+ loop_count = 10
answer = '\"#!/bin/bash\\nls\"'
self.submit_answer(question_label, answer, loop_count)
diff --git a/yaksh/models.py b/yaksh/models.py
index 2aee435..9b3cabe 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1329,7 +1329,7 @@ class AnswerPaper(models.Model):
user_dir = self.user.profile.get_user_dir()
url = 'http://localhost:%s' % SERVER_POOL_PORT
submit(url, uid, json_data, user_dir)
- result = {"uid": uid, "state": "running"}
+ result = {'uid': uid, 'state': 'running'}
return result
def regrade(self, question_id):
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js
index 39114e7..9890b54 100644
--- a/yaksh/static/yaksh/js/requesthandler.js
+++ b/yaksh/static/yaksh/js/requesthandler.js
@@ -116,7 +116,7 @@ $(document).ready(function(){
global_editor.editor.clearHistory();
}
$('#code').submit(function(e) {
- checker = setInterval(check_lock_screen, 20000);
+ checker = setInterval(check_lock_screen, 30000);
lock_screen();
$.ajax({
type: 'POST',
diff --git a/yaksh/views.py b/yaksh/views.py
index dd50d24..fc550ed 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -475,7 +475,6 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
current_question = get_object_or_404(Question, pk=q_id)
if request.method == 'POST':
- print("check post")
# Add the answer submitted, regardless of it being correct or not.
if current_question.type == 'mcq':
user_answer = request.POST.get('answer')
@@ -559,8 +558,6 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
result)
return show_question(request, next_question, paper, error_message)
else:
- print("post response")
- print(result)
return JsonResponse(result)
else:
next_question, error_message, paper = _update_paper(request, uid, result)
@@ -579,7 +576,6 @@ def get_results(request, uid):
result = json.loads(result_state.get('result'))
next_question, error_message, paper = _update_paper(request, uid, result)
return show_question(request, next_question, paper, error_message)
- print("get result")
return JsonResponse(result)