-
Notifications
You must be signed in to change notification settings - Fork 2
Exception in question #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
631e38a
5fb81aa
efd71ef
dddbb7a
a339e47
79273c1
44578fd
e65814a
f09bf60
886172c
fe3e986
39b4f4f
08851a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,13 @@ | ||
| [mypy] | ||
| show_error_codes = True | ||
| exclude = (?x)( | ||
| setup\.py | ||
| | tests/ | ||
| | docs/ | ||
| ) | ||
|
|
||
| [mypy-screenpy.*] | ||
| disallow_untyped_defs = True | ||
|
|
||
| [mypy-tests.*] | ||
| ignore_missing_imports = True |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,10 @@ class SaveConsoleLog: | |
|
|
||
| attach_kwargs: Optional[dict] | ||
|
|
||
| def describe(self) -> str: | ||
| """Describe the Action in present tense.""" | ||
| return f"Save browser console log as {self.filename}" | ||
|
Comment on lines
+47
to
+49
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks again for catching and fixing these! |
||
|
|
||
| @staticmethod | ||
| def as_(path: str) -> "SaveConsoleLog": | ||
| """Supply the name and/or filepath for the saved text file. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ class Element: | |
| the_actor.should(See.the(Element(WELCOME_BANNER), IsVisible())) | ||
| """ | ||
|
|
||
| caught_exception: Optional[TargetingError] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were talking about this on Discord, and i do really like how we can be extremely explicit here about what kind of exceptions we're expecting to handle in the actual Questions. |
||
|
|
||
| def describe(self) -> str: | ||
| """Describe the Question.""" | ||
| return f"The {self.target}." | ||
|
|
@@ -32,8 +34,10 @@ def answered_by(self, the_actor: Actor) -> Optional[WebElement]: | |
| """Direct the Actor to find the element.""" | ||
| try: | ||
| return self.target.found_by(the_actor) | ||
| except TargetingError: | ||
| except TargetingError as exc: | ||
| self.caught_exception = exc | ||
| return None | ||
|
|
||
| def __init__(self, target: Target) -> None: | ||
| self.target = target | ||
| self.caught_exception = None | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much more readable.