diff --git a/theme-clock/tests/body/button/test_button.py b/theme-clock/tests/body/button/test_button.py new file mode 100644 index 0000000..372cb7d --- /dev/null +++ b/theme-clock/tests/body/button/test_button.py @@ -0,0 +1,39 @@ +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +# Find and click the button +button = driver.find_element(By.XPATH, '/html/body/button') +button.click() + +# Wait for the changes to take effect (adjust wait time as needed) +try: + # Find the new button after the changes + button = driver.find_element(By.XPATH, '/html/body/button') + + # Retrieve properties + text = button.text + background_color = button.value_of_css_property('background-color') + text_color = button.value_of_css_property('color') + + print(f'The text in the button is {text}') + print(f'The button background color is {background_color}') + print(f'The text color is {text_color}') + +except Exception as e: + print(f"An error occurred: {e}") + +# Close the browser window +driver.quit() diff --git a/theme-clock/tests/body/button/test_darkmode.py b/theme-clock/tests/body/button/test_darkmode.py new file mode 100644 index 0000000..3470d1e --- /dev/null +++ b/theme-clock/tests/body/button/test_darkmode.py @@ -0,0 +1,37 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/button') + +text = element.text + +background_color = element.value_of_css_property('background-color') + +text_color = element.value_of_css_property('color') + +if element: + print('The button is found') +else: + print('The button has not been found') + +print(f'The text in buton is {text}') + +print(f'The button background color is {background_color}') + +print(f'The text color is {text_color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/date/test_date.py b/theme-clock/tests/body/clock/date/test_date.py new file mode 100644 index 0000000..4716d09 --- /dev/null +++ b/theme-clock/tests/body/clock/date/test_date.py @@ -0,0 +1,44 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/div[1]/div[3]') + +date_element = driver.find_element(By.XPATH, '/html/body/div[1]/div[3]/span') + +text = element.text + +background_color = element.value_of_css_property('background-color') + +color = element.value_of_css_property('color') + +time.sleep(3) + +if element: + print('The complete date is found') +else: + print('The complete date is not found') + +if date_element: + print('The date has been found') +else: + print('The date hasn\'t been found') + +print(f'Date is {text}') +print(f'Background Color is {background_color}') +print(f'Text color is {color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/test_clock.py b/theme-clock/tests/body/clock/test_clock.py new file mode 100644 index 0000000..d72cd09 --- /dev/null +++ b/theme-clock/tests/body/clock/test_clock.py @@ -0,0 +1,27 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '//div[@class="clock-container"]') + +time.sleep(3) + +if element: + print('The clock is found.') +else: + print('The clock is not found.') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/time/test_time.py b/theme-clock/tests/body/clock/time/test_time.py new file mode 100644 index 0000000..30001e8 --- /dev/null +++ b/theme-clock/tests/body/clock/time/test_time.py @@ -0,0 +1,37 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/div[1]/div[2]') + +text = element.text + +background_color = element.value_of_css_property('background-color') + +color = element.value_of_css_property('color') + +time.sleep(3) + +if element: + print('The time is found') +else: + print('The time is not found') + +print(f'Time is {text}') +print(f'Color is {background_color}') +print(f'Text color is {color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/timepiece/test_hour.py b/theme-clock/tests/body/clock/timepiece/test_hour.py new file mode 100644 index 0000000..7c9d914 --- /dev/null +++ b/theme-clock/tests/body/clock/timepiece/test_hour.py @@ -0,0 +1,31 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[1]') + +color = element.value_of_css_property('background-color') + +time.sleep(3) + +if element: + print('The hour needle is found.') +else: + print('The hour needle is not found.') + +print(f'The color of hour needle is: {color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/timepiece/test_minute.py b/theme-clock/tests/body/clock/timepiece/test_minute.py new file mode 100644 index 0000000..97c4859 --- /dev/null +++ b/theme-clock/tests/body/clock/timepiece/test_minute.py @@ -0,0 +1,31 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[2]') + +color = element.value_of_css_property('background-color') + +time.sleep(3) + +if element: + print('The minute needle is found.') +else: + print('The minute needle is not found.') + +print(f'The color of minute needle is: {color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/timepiece/test_second.py b/theme-clock/tests/body/clock/timepiece/test_second.py new file mode 100644 index 0000000..861a204 --- /dev/null +++ b/theme-clock/tests/body/clock/timepiece/test_second.py @@ -0,0 +1,31 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[3]') + +color = element.value_of_css_property('background-color') + +time.sleep(3) + +if element: + print('The second needle is found.') +else: + print('The second needle is not found.') + +print(f'The color of second needle is: {color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/clock/timepiece/test_timepiece.py b/theme-clock/tests/body/clock/timepiece/test_timepiece.py new file mode 100644 index 0000000..78ba6f2 --- /dev/null +++ b/theme-clock/tests/body/clock/timepiece/test_timepiece.py @@ -0,0 +1,27 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.XPATH, '//div[@class="clock"]') + +time.sleep(3) + +if element: + print('The clock is found.') +else: + print('The clock is not found.') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/body/test_body.py b/theme-clock/tests/body/test_body.py new file mode 100644 index 0000000..5d72bc4 --- /dev/null +++ b/theme-clock/tests/body/test_body.py @@ -0,0 +1,31 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.TAG_NAME, 'body') + +background_color = element.value_of_css_property('background-color') + +time.sleep(3) + +if element: + print('The body is found.') +else: + print('The body is not found.') + +print(f'The background color is {background_color}') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/test_body.py b/theme-clock/tests/test_body.py new file mode 100644 index 0000000..7396bfb --- /dev/null +++ b/theme-clock/tests/test_body.py @@ -0,0 +1,27 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +element = driver.find_element(By.TAG_NAME, 'body') + +time.sleep(3) + +if element: + print('The body is found.') +else: + print('The body is not found.') + +# Close the browser window +driver.quit() \ No newline at end of file diff --git a/theme-clock/tests/test_browser.py b/theme-clock/tests/test_browser.py new file mode 100644 index 0000000..19ef206 --- /dev/null +++ b/theme-clock/tests/test_browser.py @@ -0,0 +1,20 @@ +from selenium import webdriver +import time +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options + +# Define Chrome WebDriver options +chrome_options = Options() +service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver') + +# Initialize Chrome WebDriver +driver = webdriver.Chrome(service=service, options=chrome_options) +# Open the Flask application +driver.get('http://127.0.0.1:5500/theme-clock/index.html') + +time.sleep(3) + +# Close the browser window +driver.quit() \ No newline at end of file