Skip to content

Commit

Permalink
add pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Jul 27, 2023
1 parent 9c85c13 commit 3ba27e4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,18 @@ def test_move(screen: Screen):
screen.click('Move X to top')
screen.wait(0.5)
assert screen.find('X').location['y'] < screen.find('A').location['y'] < screen.find('B').location['y']


def test_xss(screen: Screen):
ui.label('</script><script>alert(1)</script>')
ui.label('<b>Bold 1</b>')
ui.button('Button 1', on_click=lambda: ui.label('</script><script>alert(2)</script>'))
ui.button('Button 2', on_click=lambda: ui.label('<b>Bold 2</b>'))

screen.open('/')
screen.click('Button 1')
screen.click('Button 2')
screen.should_contain('</script><script>alert(1)</script>')
screen.should_contain('</script><script>alert(2)</script>')
screen.should_contain('<b>Bold 1</b>')
screen.should_contain('<b>Bold 2</b>')

0 comments on commit 3ba27e4

Please sign in to comment.