summaryrefslogtreecommitdiff
path: root/yaksh/live_server_tests
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-09-15 16:31:50 +0530
committerGitHub2017-09-15 16:31:50 +0530
commit7419e3b3f4e14f86f21f9464843f9263638fe7a2 (patch)
treea046617f76879ea5c056ae2c8f39b0a97c8a18a7 /yaksh/live_server_tests
parente3a43662d2aae8688039671d3de532e48fbdfda9 (diff)
parentf65102cf4b6a117a3ff86971ad9c1ddd3362c9fd (diff)
downloadonline_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.tar.gz
online_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.tar.bz2
online_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.zip
Merge pull request #326 from FOSSEE/improve-code-server
Improve code server
Diffstat (limited to 'yaksh/live_server_tests')
-rw-r--r--yaksh/live_server_tests/load_test.py4
-rw-r--r--yaksh/live_server_tests/selenium_test.py16
2 files changed, 19 insertions, 1 deletions
diff --git a/yaksh/live_server_tests/load_test.py b/yaksh/live_server_tests/load_test.py
index 47d267c..5ab1cc2 100644
--- a/yaksh/live_server_tests/load_test.py
+++ b/yaksh/live_server_tests/load_test.py
@@ -26,7 +26,9 @@ class YakshSeleniumTests(StaticLiveServerTestCase):
"yaksh.cpp_code_evaluator.CppCodeEvaluator"
settings.code_evaluators['bash']['standardtestcase'] = \
"yaksh.bash_code_evaluator.BashCodeEvaluator"
- code_server_pool = ServerPool(ports=settings.SERVER_PORTS, pool_port=settings.SERVER_POOL_PORT)
+ code_server_pool = ServerPool(
+ n=settings.N_CODE_SERVERS, pool_port=settings.SERVER_POOL_PORT
+ )
cls.code_server_pool = code_server_pool
cls.code_server_thread = t = Thread(target=code_server_pool.run)
t.start()
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py
index bc400fd..31efcac 100644
--- a/yaksh/live_server_tests/selenium_test.py
+++ b/yaksh/live_server_tests/selenium_test.py
@@ -8,6 +8,20 @@ from selenium.common.exceptions import WebDriverException
import multiprocessing
import argparse
+
+class ElementDisplay(object):
+ '''Custom expected condition '''
+ def __init__(self, locator):
+ self.locator = locator
+
+ def __call__(self, driver):
+ try:
+ element = EC._find_element(driver, self.locator)
+ return element.value_of_css_property("display") == "none"
+ except Exception as e:
+ return False
+
+
class SeleniumTestError(Exception):
pass
@@ -53,6 +67,8 @@ class SeleniumTest():
submit_answer_elem = self.driver.find_element_by_id("check")
self.driver.execute_script('global_editor.editor.setValue({});'.format(answer))
submit_answer_elem.click()
+ WebDriverWait(self.driver, 90).until(ElementDisplay(
+ (By.XPATH, "//*[@id='ontop']")))
def test_c_question(self, question_label):
# Incorrect Answer