Skip to content

Commit

Permalink
#603 add pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Mar 24, 2023
1 parent e933862 commit 8979691
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_color_input.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

from nicegui import ui
Expand All @@ -18,6 +19,16 @@ def test_picking_color(screen: Screen):
ui.color_input(label='Color', on_change=lambda e: ui.label(f'content: {e.value}'))

screen.open('/')
picker = screen.click('colorize')
screen.click_at_position(picker, x=40, y=120)
screen.should_contain('content: #de8383')
screen.click('colorize')
screen.click_at_position(screen.find('HEX'), x=0, y=60)
content = screen.selenium.find_element(By.CLASS_NAME, 'q-color-picker__header-content')
assert content.value_of_css_property('background-color') == 'rgba(245, 186, 186, 1)'
screen.should_contain('content: #f5baba')

screen.type(Keys.ESCAPE)
screen.wait(0.5)
screen.should_not_contain('HEX')

screen.click('colorize')
content = screen.selenium.find_element(By.CLASS_NAME, 'q-color-picker__header-content')
assert content.value_of_css_property('background-color') == 'rgba(245, 186, 186, 1)'

0 comments on commit 8979691

Please sign in to comment.