diff options
author | adityacp | 2017-11-23 12:11:39 +0530 |
---|---|---|
committer | adityacp | 2017-11-23 14:26:48 +0530 |
commit | 86b9fa3d802971077ac30e7e1b833ec39d822d3b (patch) | |
tree | c204cb3b20519ba2794e15287103c24d982ebace | |
parent | ae2e61692b417f243d8c97c1e766e12a5a980980 (diff) | |
download | online_test-86b9fa3d802971077ac30e7e1b833ec39d822d3b.tar.gz online_test-86b9fa3d802971077ac30e7e1b833ec39d822d3b.tar.bz2 online_test-86b9fa3d802971077ac30e7e1b833ec39d822d3b.zip |
Fix selenium tests
-rw-r--r-- | yaksh/live_server_tests/load_test.py | 4 | ||||
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/yaksh/live_server_tests/load_test.py b/yaksh/live_server_tests/load_test.py index 5ab1cc2..c3eb6e6 100644 --- a/yaksh/live_server_tests/load_test.py +++ b/yaksh/live_server_tests/load_test.py @@ -73,5 +73,7 @@ class YakshSeleniumTests(StaticLiveServerTestCase): def test_load(self): url = '%s%s' % (self.live_server_url, '/exam/login/') quiz_name = "Yaksh Demo quiz" - selenium_test = SeleniumTest(url=url, quiz_name=quiz_name) + module_name = "demo module" + selenium_test = SeleniumTest(url=url, quiz_name=quiz_name, + module_name=module_name) selenium_test.run_load_test(url=url, username='demo_student', password='demo_student') diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 31efcac..160ad02 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -26,9 +26,10 @@ class SeleniumTestError(Exception): pass class SeleniumTest(): - def __init__(self, url, quiz_name): + def __init__(self, url, quiz_name, module_name): self.driver = webdriver.Firefox() self.quiz_name = quiz_name + self.module_name = module_name self.url = url def run_load_test(self, url, username, password): @@ -119,6 +120,8 @@ class SeleniumTest(): self.submit_answer(question_label, answer, loop_count) def open_quiz(self): + # open module link + self.driver.find_element_by_link_text(self.module_name).click() # open quiz link quiz_link_elem = self.driver.find_element_by_link_text(self.quiz_name).click() @@ -171,7 +174,9 @@ if __name__ == '__main__': opts = parser.parse_args() quiz_name = "Demo quiz" - selenium_test = SeleniumTest(url=opts.url, quiz_name=quiz_name) + module_name = "demo module" + selenium_test = SeleniumTest(url=opts.url, quiz_name=quiz_name, + module_name=module_name) pool = multiprocessing.Pool(opts.number) pool.map(wrap_run_load_test, user_gen(opts.url, range(opts.start, opts.start + opts.number))) pool.close() |