diff options
author | Prabhu Ramachandran | 2017-03-03 18:33:57 +0530 |
---|---|---|
committer | GitHub | 2017-03-03 18:33:57 +0530 |
commit | 27fa11322e4b6ca2477a5979884e8e77388d8705 (patch) | |
tree | b7f0e215ba5070ed6a9837739f753ed1ebb29ab0 /yaksh/live_server_tests/selenium_test.py | |
parent | b001bc98db69e1ef1926b0f2103bf5a291682f93 (diff) | |
parent | ea58f85532a6a5cc42780d90c907cfb6e8a6d95d (diff) | |
download | online_test-27fa11322e4b6ca2477a5979884e8e77388d8705.tar.gz online_test-27fa11322e4b6ca2477a5979884e8e77388d8705.tar.bz2 online_test-27fa11322e4b6ca2477a5979884e8e77388d8705.zip |
Merge pull request #231 from ankitjavalkar/fix-selen-test
Fix selenium tests:
Diffstat (limited to 'yaksh/live_server_tests/selenium_test.py')
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 7eeb22c..d91f3ec 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -8,6 +8,9 @@ from selenium.common.exceptions import WebDriverException import multiprocessing import argparse +class SeleniumTestError(Exception): + pass + class SeleniumTest(): def __init__(self, url, quiz_name): self.driver = webdriver.Firefox() @@ -24,9 +27,12 @@ class SeleniumTest(): self.logout() self.driver.close() except Exception as e: - with open("/tmp/yaksh_load_test_log.txt", "ab") as f: - f.write('Username: {0}\nError: {1}\n'.format(username, e)) self.driver.close() + msg = ("An Error occurred while running the Selenium load" + " test on Yaksh!" + "Error:\n ".format(e)) + + raise SeleniumTestError(msg) def login(self, username, password): # get the username, password and submit form elements @@ -44,7 +50,7 @@ class SeleniumTest(): for count in range(loop_count): self.driver.find_element_by_link_text(question_label).click() submit_answer_elem = self.driver.find_element_by_id("check") - self.driver.execute_script('editor.setValue({})'.format(answer)) + self.driver.execute_script('global_editor.editor.setValue({});'.format(answer)) submit_answer_elem.click() def test_c_question(self, question_label): @@ -105,9 +111,9 @@ class SeleniumTest(): ) start_exam_elem.click() - self.test_c_question(question_label=1) + self.test_c_question(question_label=2) self.test_python_question(question_label=3) - self.test_bash_question(question_label=2) + self.test_bash_question(question_label=1) def close_quiz(self): quit_link_elem = WebDriverWait(self.driver, 5).until( |