Skip to content

Commit

Permalink
first version of test_statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinaProsche committed Jan 22, 2024
1 parent 3dc0bb7 commit 05c504f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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()

Expand Down
25 changes: 25 additions & 0 deletions tests/test_statistic.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 05c504f

Please sign in to comment.