Skip to content

Commit

Permalink
test layout
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huong Nguyen committed Sep 23, 2024
1 parent d77aaa1 commit e3d23d9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_layout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

def test_layout_html_rendering():
driver = webdriver.Chrome()

try:
driver.get("https://docs.kedro.org/")

# Simulate Cmd+K / Ctrl+K keypress
action = ActionChains(driver)
action.key_down(Keys.COMMAND).send_keys('k').key_up(Keys.COMMAND).perform() # For Mac

# Retrieve all links under the wy-main-nav class with a tag
links = driver.find_elements(By.CSS_SELECTOR, ".wy-main-nav a")

# Get the current URL
current_url = driver.current_url

active_link = None

for link in links:
if 'active' in link.get_attribute('class').split():
active_link = link
break

assert active_link is not None, "No active link found under wy-main-nav class."

finally:
driver.quit()

0 comments on commit e3d23d9

Please sign in to comment.