Skip to content

Commit

Permalink
test: Eliminate :contains selector in in do_deployment_action()
Browse files Browse the repository at this point in the history
Give the kebab menu items a `data-action` attribute and select on this
instead.
  • Loading branch information
martinpitt committed Jul 18, 2024
1 parent 56abfa8 commit 436a497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/ostree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ const DeploymentActions = ({ deploymentIndex, deploymentIsPinned, isCurrent, isS
const actions = [];
if (!isStaged) {
actions.push(
<DropdownItem key="pin-deployment"
<DropdownItem
data-action={ deploymentIsPinned ? "Unpin" : "Pin" }
key="pin-deployment"
onClick={() => togglePin()}
>
{deploymentIsPinned ? _("Unpin") : _("Pin")}
Expand All @@ -552,6 +554,7 @@ const DeploymentActions = ({ deploymentIndex, deploymentIsPinned, isCurrent, isS
}
actions.push(
<DropdownItem key="delete-deployment"
data-action="Delete"
className="pf-v5-u-danger-color-200"
onClick={() => deleteDeployment()}
>
Expand Down
2 changes: 1 addition & 1 deletion test/check-ostree
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def do_deployment_action(b, index, action):
deployment_row = f"#available-deployments > tbody:nth-of-type({index})"
if action in ["Pin", "Unpin", "Delete"]:
b.click(f"{deployment_row} #deployment-actions")
b.click(f"{deployment_row} button.pf-v5-c-menu__item:contains({action})")
b.click(f"{deployment_row} [data-action={action}] button")
else:
wait_deployment_prop(b, index, "Actions", action)
b.click(f"{deployment_row} tr:nth-child(1) td:nth-child(6) button")
Expand Down

0 comments on commit 436a497

Please sign in to comment.