Skip to content

Commit

Permalink
[Serverless][FTR] Fix flaky viewer_role_login test for MKI (#178522)
Browse files Browse the repository at this point in the history
Resolves: #178403

Drop wrapper div and place data test subj within the eui component, per
[docs](https://eui.elastic.co/#/navigation/context-menu).

Also:
- add calls to wait until loading has finished
- add 10_000 timeouts to test subects calls

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
wayneseymour and kibanamachine authored Mar 22, 2024
1 parent 6321f69 commit 6dcfbd7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,18 @@ export const SecurityNavControl: FunctionComponent<SecurityNavControlProps> = ({
panelPaddingSize="none"
buffer={0}
>
<div data-test-subj="userMenu">
<EuiContextMenu
className="chrNavControl__userMenu"
initialPanelId={0}
panels={[
{
id: 0,
title: displayName,
content: <ContextMenuContent items={items} />,
},
]}
/>
</div>
<EuiContextMenu
className="chrNavControl__userMenu"
initialPanelId={0}
panels={[
{
id: 0,
title: displayName,
content: <ContextMenuContent items={items} />,
},
]}
data-test-subj="userMenu"
/>
</EuiPopover>
);
};
15 changes: 11 additions & 4 deletions x-pack/test_serverless/functional/page_objects/svl_common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProvide
const testSubjects = getService('testSubjects');
const find = getService('find');
const config = getService('config');
const pageObjects = getPageObjects(['security', 'common']);
const pageObjects = getPageObjects(['security', 'common', 'header']);
const retry = getService('retry');
const deployment = getService('deployment');
const log = getService('log');
Expand Down Expand Up @@ -229,15 +229,22 @@ export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProvide
},

async clickUserAvatar() {
await testSubjects.click('userMenuAvatar');
await pageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.click('userMenuAvatar', 10_000);
},

async assertUserAvatarExists() {
await testSubjects.existOrFail('userMenuAvatar');
await pageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.existOrFail('userMenuAvatar', {
timeout: 10_000,
});
},

async assertUserMenuExists() {
await testSubjects.existOrFail('userMenu');
await pageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.existOrFail('userMenu', {
timeout: 10_000,
});
},
};
}

0 comments on commit 6dcfbd7

Please sign in to comment.