Skip to content

Commit c7aaa76

Browse files
[Watcher] Fix flaky functional test (#56393) (#57292)
* Give a bit more time for machines on CI * Remove unnecessary sleep * Dummy error logs [do not commit to master] * Revert "Dummy error logs [do not commit to master]" Also only update data (and call serializer) on a success response, not on an error response. * Remove common.sleep and rewrite the comment explaining the use of retry.waitFor * Fix typo Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent 148c03d commit c7aaa76

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

src/plugins/es_ui_shared/public/request/np_ready_request.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export const useRequest = (
120120

121121
const response = await sendRequest(httpClient, requestBody);
122122
const { data: serializedResponseData, error: responseError } = response;
123-
const responseData = deserializer(serializedResponseData);
124123

125124
// If an outdated request has resolved, DON'T update state, but DO allow the processData handler
126125
// to execute side effects like update telemetry.
@@ -129,7 +128,12 @@ export const useRequest = (
129128
}
130129

131130
setError(responseError);
132-
setData(responseData);
131+
132+
if (!responseError) {
133+
const responseData = deserializer(serializedResponseData);
134+
setData(responseData);
135+
}
136+
133137
setIsLoading(false);
134138
setIsInitialRequest(false);
135139

x-pack/plugins/watcher/public/plugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
7676
}),
7777
icon: 'watchesApp',
7878
path: '/app/kibana#/management/elasticsearch/watcher/watches',
79-
showOnHomePage: true,
79+
showOnHomePage: false,
8080
};
8181

8282
home.featureCatalogue.register(watcherHome);
@@ -85,9 +85,6 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
8585
if (valid) {
8686
watcherESApp.enable();
8787
watcherHome.showOnHomePage = true;
88-
} else {
89-
watcherESApp.disable();
90-
watcherHome.showOnHomePage = false;
9188
}
9289
});
9390
}

x-pack/test/functional/apps/watcher/watcher_test.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,23 @@ export default function({ getService, getPageObjects }) {
3636
}
3737

3838
await browser.setWindowSize(1600, 1000);
39-
// TODO: Remove the retry.try wrapper once https://github.com/elastic/kibana/issues/55985 is resolved
40-
retry.try(async () => {
41-
await PageObjects.common.navigateToApp('watcher');
42-
await testSubjects.find('createWatchButton');
39+
40+
// License values are emitted ES -> Kibana Server -> Kibana Public. The current implementation
41+
// creates a situation where the Watcher plugin may not have received a minimum required license at setup time
42+
// so the public app may not have registered in the UI.
43+
//
44+
// For functional testing this is a problem. The temporary solution is we wait for watcher
45+
// to be visible.
46+
//
47+
// See this issue https://github.com/elastic/kibana/issues/55985.
48+
await retry.waitFor('watcher to display in management UI', async () => {
49+
try {
50+
await PageObjects.common.navigateToApp('watcher');
51+
await testSubjects.find('createWatchButton');
52+
} catch (e) {
53+
return false;
54+
}
55+
return true;
4356
});
4457
});
4558

0 commit comments

Comments
 (0)