[8.7] fix flaky test x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts (#150630) (#150755)

# Backport

This will backport the following commits from `main` to `8.7`:
- [fix flaky test
x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts
(#150630)](https://github.com/elastic/kibana/pull/150630)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2023-02-09T17:38:34Z","message":"fix
flaky test
x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts
(#150630)\n\nFixers
https://github.com/elastic/kibana/issues/150490\r\n\r\nflaky test
runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1899\r\n\r\nFailures
caused by settings panel not closing. PR resolves issue by\r\ndismissing
toasts so save button is clickable and retrying if settings\r\npanel
does not close.\r\n\r\n<img width=\"500\" alt=\"Screen Shot 2023-02-08
at 12 30 19
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/217639189-c1da31e8-b9d8-4d60-b95f-2e04b1d5c228.png\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"cb17912b6c96ffeb1f2934ede98caf0782127a4b","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","auto-backport","v8.7.0","v8.8.0"],"number":150630,"url":"https://github.com/elastic/kibana/pull/150630","mergeCommit":{"message":"fix
flaky test
x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts
(#150630)\n\nFixers
https://github.com/elastic/kibana/issues/150490\r\n\r\nflaky test
runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1899\r\n\r\nFailures
caused by settings panel not closing. PR resolves issue by\r\ndismissing
toasts so save button is clickable and retrying if settings\r\npanel
does not close.\r\n\r\n<img width=\"500\" alt=\"Screen Shot 2023-02-08
at 12 30 19
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/217639189-c1da31e8-b9d8-4d60-b95f-2e04b1d5c228.png\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"cb17912b6c96ffeb1f2934ede98caf0782127a4b"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150630","number":150630,"mergeCommit":{"message":"fix
flaky test
x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts
(#150630)\n\nFixers
https://github.com/elastic/kibana/issues/150490\r\n\r\nflaky test
runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1899\r\n\r\nFailures
caused by settings panel not closing. PR resolves issue by\r\ndismissing
toasts so save button is clickable and retrying if settings\r\npanel
does not close.\r\n\r\n<img width=\"500\" alt=\"Screen Shot 2023-02-08
at 12 30 19
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/373691/217639189-c1da31e8-b9d8-4d60-b95f-2e04b1d5c228.png\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"cb17912b6c96ffeb1f2934ede98caf0782127a4b"}}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
This commit is contained in:
Kibana Machine 2023-02-09 13:31:57 -05:00 committed by GitHub
parent 2713d135c6
commit 02a5c394ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,8 @@ import { CommonlyUsed } from '../../page_objects/time_picker';
export function DashboardCustomizePanelProvider({ getService }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
const toasts = getService('toasts');
const testSubjects = getService('testSubjects');
return new (class DashboardCustomizePanel {
@ -95,12 +97,19 @@ export function DashboardCustomizePanelProvider({ getService }: FtrProviderConte
public async clickSaveButton() {
log.debug('clickSaveButton');
await testSubjects.click('saveCustomizePanelButton');
await retry.try(async () => {
await toasts.dismissAllToasts();
await testSubjects.click('saveCustomizePanelButton');
await testSubjects.waitForDeleted('saveCustomizePanelButton');
});
}
public async clickCancelButton() {
log.debug('clickCancelButton');
await testSubjects.click('cancelCustomizePanelButton');
await retry.try(async () => {
await testSubjects.click('cancelCustomizePanelButton');
await testSubjects.waitForDeleted('cancelCustomizePanelButton');
});
}
public async clickToggleShowCustomTimeRange() {