diff --git a/tests/README.md b/tests/README.md index fdaf0fc0..e76c5f85 100644 --- a/tests/README.md +++ b/tests/README.md @@ -7,10 +7,10 @@ pip install selenium pip install webdriver-manager (to avoid problem with binary. And you should have Firefox installed not in 'snap') webdriver-manager==4.0.1 -## Test for autorization: -class AuthTestSelenium(BasicSeleniumTest) with 3 tests +## Test for open statistic: +class StatisticTestSelenium(BasicSeleniumTest) with 1 test -Tests check: if page "/login" opens, if it doesn't take wrong login/password and takes correct. +Test check: if page "/check_list" opens ## Run run_tests diff --git a/tests/main.py b/tests/main.py index 0bd9d178..e16af4a7 100644 --- a/tests/main.py +++ b/tests/main.py @@ -2,8 +2,7 @@ import sys import argparse from basic_selenium_test import BasicSeleniumTest -from test_authorization import AuthTestSelenium - +from test_statistic import StatisticTestSelenium def parse_arguments(): parser = argparse.ArgumentParser(description='Run Selenium tests with specified host, login, and password.') @@ -16,7 +15,7 @@ def main(): args = parse_arguments() suite = unittest.TestSuite() - suite.addTest(BasicSeleniumTest.parametrize(AuthTestSelenium, param=(args.host, args.login, args.password))) + suite.addTest(BasicSeleniumTest.parametrize(StatisticTestSelenium, param=(args.host, args.login, args.password))) returnCode = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() diff --git a/tests/test_statistic.py b/tests/test_statistic.py new file mode 100644 index 00000000..e2029d36 --- /dev/null +++ b/tests/test_statistic.py @@ -0,0 +1,25 @@ +import os +from basic_selenium_test import BasicSeleniumTest +from selenium.webdriver.common.by import By + +class StatisticTestSelenium(BasicSeleniumTest): + + def test_open_statistic(self): + host, login_param, password_param = self.param + URL = self.getUrl('/login') + self.getDriver().get(URL) + self.getDriver().implicitly_wait(30) + login = self.getDriver().find_element(By.ID, "login_text_field") + login.clear() + login.send_keys(login_param) + password = self.getDriver().find_element(By.ID, "password_text_field") + password.clear() + password.send_keys(password_param) + login_button = self.getDriver().find_element(By.ID, "login_button") + login_button.click() + URL = self.getUrl('/check_list') + self.getDriver().get(URL) + self.getDriver().implicitly_wait(30) + obj = self.getDriver().find_element(By.CLASS_NAME, "fixed-table-container") + self.assertNotEquals(obj, None) +