47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
from selenium import webdriver
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
import time
|
|
|
|
options = webdriver.ChromeOptions()
|
|
options.add_argument('--headless')
|
|
options.add_argument('--no-sandbox')
|
|
options.add_argument('--disable-dev-shm-usage')
|
|
driver = webdriver.Chrome(options=options)
|
|
driver.implicitly_wait(5)
|
|
wait = WebDriverWait(driver, 10)
|
|
|
|
try:
|
|
driver.get('http://localhost:3015')
|
|
time.sleep(3)
|
|
# Find the plus button (create workspace)
|
|
plus_button = driver.find_element(By.CSS_SELECTOR, 'button[aria-haspopup="dialog"][aria-controls*="radix-"]')
|
|
plus_button.click()
|
|
time.sleep(1)
|
|
# Find dialog input
|
|
dialog_input = driver.find_element(By.CSS_SELECTOR, 'input[placeholder="Workspace name"]')
|
|
dialog_input.send_keys('test_workspace_ui')
|
|
# Find confirm button
|
|
confirm_button = driver.find_element(By.XPATH, '//button[text()="Create"]')
|
|
confirm_button.click()
|
|
time.sleep(2)
|
|
# Now workspace selector should have new workspace
|
|
combobox = driver.find_element(By.CSS_SELECTOR, '[role="combobox"]')
|
|
print('Current workspace:', combobox.text)
|
|
# Click combobox to open dropdown
|
|
combobox.click()
|
|
time.sleep(1)
|
|
# Wait for dropdown items
|
|
items = driver.find_elements(By.CSS_SELECTOR, '[role="option"]')
|
|
print(f'Number of options: {len(items)}')
|
|
for i, item in enumerate(items):
|
|
print(f'Option {i}:', item.text)
|
|
# Take screenshot
|
|
driver.save_screenshot('after_create.png')
|
|
except Exception as e:
|
|
print('Error:', e)
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
driver.quit() |