Skip to content

Commit

Permalink
[Fleet] Use test ID instead of closest button for flaky test (#195791)
Browse files Browse the repository at this point in the history
## Summary

Closes #191804

I haven't been able to reproduce any flakiness here, but this seems to
be the only real difference between this test and those around it that
don't have the same flakiness issue. So, I've updated the test to use a
test ID like the non-flaky ones in the same suite.

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
kpollich and elasticmachine authored Oct 11, 2024
1 parent 731c4e4 commit 273f02e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('PackagePolicyActionsMenu', () => {
const packagePolicy = createMockPackagePolicy({ hasUpgrade: false });
const { utils } = renderMenu({ agentPolicies, packagePolicy });
await act(async () => {
const upgradeButton = utils.getByText('Upgrade integration policy').closest('button');
const upgradeButton = utils.getByTestId('PackagePolicyActionsUpgradeItem');
expect(upgradeButton).toBeDisabled();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
>
<FormattedMessage
id="xpack.fleet.policyDetails.packagePoliciesTable.upgradeActionTitle"
data-test-subj="UpgradeIntegrationPolicy"
defaultMessage="Upgrade integration policy"
/>
</EuiContextMenuItem>,
Expand Down

0 comments on commit 273f02e

Please sign in to comment.