feat: add tests
This commit is contained in:
parent
51f3395f4c
commit
8acc0dff83
2 changed files with 107 additions and 0 deletions
31
tests/homepage.py
Normal file
31
tests/homepage.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import unittest
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
class TestScenarioA(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.driver = webdriver.Firefox()
|
||||
self.base_url = "http://localhost:3000"
|
||||
self.title_xpath = "//li[last()][contains(concat(' ',normalize-space(@class),' '),' media ')]/div/h5"
|
||||
|
||||
def is_element_exist(self, selector, element):
|
||||
try:
|
||||
self.driver.find_element(by=selector, value=element)
|
||||
except NoSuchElementException as e:
|
||||
return False
|
||||
return True
|
||||
|
||||
def test_B_1(self):
|
||||
driver = self.driver
|
||||
driver.get(self.base_url)
|
||||
self.assertFalse(self.is_element_exist(By.XPATH, self.title_xpath))
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue