-
Notifications
You must be signed in to change notification settings - Fork 29
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
fixed the modal test, resolved #126 Issue #128
base: master
Are you sure you want to change the base?
Conversation
Travis Issue fixed in PR #127 |
View.__init__(self, parent, logger=logger) | ||
|
||
def __locator__(self): |
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.
In View
or Widget
when we set ROOT
locator should auto-resolve.
I think it will be great if we fallow an approach like
ROOT = ParametrizedLocator("{@locator}")
def __init__(self, parent, id=None, logger=None):
self.id = id
if id:
self.locator = <some_loator_with id>
else:
self.locator = <default>
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.
I think implementing __locator__
here is okay, though the pattern @digitronik suggested above does it without implementing the dunder method.
Why its broken in the first place, and why this fix works, is because of the WidgetMetaclass behavior in __new__
.
Before the WidgetDescriptor instance is created when the unit test is defining the test view class, WidgetMetaclass is setting __locator__
based on the presence of ROOT
in the kwargs. After this, when the WidgetDescriptor resolves into a View instance in the presence of a browser, self.ROOT
is modified - but self.__locator__
has already been created automatically based off of the original definition.
def __locator__(self): | ||
"""If id was passed, parametrize it into a locator, otherwise use ROOT""" | ||
if self.id is not None: | ||
return ('//div[normalize-space(@id)="{}" and contains(@class, "modal")' |
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.
Please continue to use ParametrizedLocator here, its handling the injection of self.id
into the string. No need to use format
here, that part shouldn't change.
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.
See specific comments please, sorry for massive delay on review.
@omkarkhatavkar keep an eye here: https://github.com/RedHatQE/widgetastic.patternfly/pull/132/files I added a skip for this test so that I can see all passing, you can remove the skip in your branch if that gets merged before you make an update here. Otherwise I'll remove the skip marker. |
Fixed #126
Test Result
_