diff options
Diffstat (limited to 'yaksh/live_server_tests')
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 859d032..31efcac 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 @@ -40,6 +37,7 @@ class SeleniumTest(): self.driver.get(self.url) self.login(username, password) self.open_quiz() + self.quit_quiz() self.close_quiz() self.logout() self.driver.close() @@ -65,7 +63,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)) @@ -131,9 +128,20 @@ class SeleniumTest(): ) start_exam_elem.click() - self.test_c_question(question_label=2) - self.test_python_question(question_label=3) - self.test_bash_question(question_label=1) + self.test_c_question(question_label=7) + self.test_python_question(question_label=5) + self.test_bash_question(question_label=4) + + def quit_quiz(self): + quit_link_elem = WebDriverWait(self.driver, 5).until( + EC.presence_of_element_located((By.NAME, "quit")) + ) + quit_link_elem.click() + + quit_link_elem = WebDriverWait(self.driver, 5).until( + EC.presence_of_element_located((By.NAME, "yes")) + ) + quit_link_elem.click() def close_quiz(self): quit_link_elem = WebDriverWait(self.driver, 5).until( |