-
Notifications
You must be signed in to change notification settings - Fork 528
fix: add an option value to the snapshot #237
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks! Let us use conventional commits for the PR title.
I think we should do the approach we discussed previously in which we resolve option label to a value when we will out an option. WDYT? I think doing evals during snapshot generation would be too expensive and bug-prone
Do you mean check if it is an option within |
if (aXNode && aXNode.role === 'combobox' && aXNode.children) { | ||
for (const child of aXNode.children) { | ||
if (child.role === 'option' && child.name === value && child.value) { | ||
const childHandle = await child.elementHandle(); |
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.
we need to dispose the child handle after we use it
} | ||
break; | ||
} | ||
} |
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.
we should throw an error if no option was found
// To do that, loop through the children while checking which child's text matches the requested value (requested value is actually the text content). | ||
// When the correct option is found, use the element handle to get the real value. | ||
const aXNode = context.getAXNodeByUid(uid); | ||
if (aXNode && aXNode.role === 'combobox' && aXNode.children) { |
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.
maybe we could extract the logic for finding an option in a combobox into a helper function?
Fixes #185
The standard selector value is not included in the AXNode, so add it separately.