Skip to content

Commit

Permalink
Update ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
ggozad committed Apr 3, 2023
1 parent 77b3424 commit e69e923
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.239
rev: v0.0.260
hooks:
- id: ruff
args: ["--fix"]
Expand Down
39 changes: 20 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ smsmock = "behaving.sms.mock:main"
gcmmock = "behaving.notifications.gcm.mock:main"

[tool.poetry.group.dev.dependencies]
ruff = "^0.0.190"
ruff = "^0.0.260"
black = "^23.1.0"
pdbpp = "^0.10.3"

Expand Down
14 changes: 12 additions & 2 deletions src/behaving/web/steps/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from splinter.exceptions import ElementDoesNotExist

from behaving.personas.persona import persona_vars
from behaving.web.steps.basic import _retry

# Selenium 3 does not account for base64 no longer using encodestring.
# Monkey patch base64 to make it compatible seems the easiest.
Expand Down Expand Up @@ -198,9 +199,18 @@ def set_html_content_to_element_with_class(context, klass, contents):
@then('field "{name}" should have the value "{value}" within {timeout:d} seconds')
@persona_vars
def field_has_value_within_timeout(context, name, value, timeout=None):
el = find_by_name_or_id(context, name, timeout=timeout)
def check():
try:
el = find_by_name_or_id(context, name)
return el and el.value == value
except AssertionError:
return False

if _retry(check, timeout):
return
el = find_by_name_or_id(context, name)
assert (
el.value == value
False
), f'Values for element {name} do not match, expected "{value}" but got "{el.value}"'


Expand Down
6 changes: 3 additions & 3 deletions tests/features/forms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Feature: Forms
When I visit "http://web/forms.html"
Then "disabled" should be disabled
And "name" should be enabled
When I fill in "name" with "Foo Bar"
Then field "name" should have the value "Foo Bar"

# Checking field values with timeout
When I execute the script "setTimeout(() => { document.getElementsByName('name')[0].value = 'Foo Bar'}, 2000)"
Then field "name" should have the value "Foo Bar" within 3 seconds
When I fill in "passwd" with "hax0r"
Then field "passwd" should have the value "hax0r"
When I choose "male" from "sex"
Expand Down

0 comments on commit e69e923

Please sign in to comment.