## Summary
I had to change `waitForRender` since `page.waitForFunction` tries to
run a script on page and it is not working due to CSP settings on Cloud.
Instead of injecting a script, we use a classical API to find
elements/attributes in the DOM.
Since `PUT /internal/core/_settings` is merged in 8.11.0, journeys run
on Cloud with on-fly labels update is supported starting deployments
8.11.0+. I added error message for 404 code just in case someone runs it
on earlier version.
`many_fields_discover` journey was update since on Cloud the data view
used by scenario is not selected by default.
How it works:
Create a deployment with QAF and re-configure it for journey run:
```
export EC_DEPLOYMENT_NAME=my-run-8.11
qaf elastic-cloud deployments create --stack-version 8.11.0-SNAPSHOT --environment staging --region gcp-us-central1
qaf elastic-cloud deployments configure-for-performance-journeys
```
Run any journey, e.g. many_fields_discover
```
TEST_CLOUD=1 TEST_ES_URL=https://username:pswd@es_url:443 TEST_KIBANA_URL=https://username:pswd@kibana-ur_url node scripts/functional_test_runner --config x-pack/performance/journeys/many_fields_discover.ts
```
You should see a log about labels being updated:
```
Updating telemetry & APM labels: {"testJobId":"local-a3272047-6724-44d1-9a61-5c79781b06a1","testBuildId":"local-d8edbace-f441-4ba9-ac83-5909be3acf2a","journeyName":"many_fields_discover","ftrConfig":"x-pack/performance/journeys/many_fields_discover.ts"}
```
And then able to find APM logs for the journey in
[Ops](https://kibana-ops-e2e-perf.kb.us-central1.gcp.cloud.es.io:9243/app/apm/services?comparisonEnabled=true&environment=ENVIRONMENT_ALL&kuery=labels.testJobId%20%3A%20%22local-d79a878c-cc7a-423b-b884-c9b6b1a8d781%22&latencyAggregationType=avg&offset=1d&rangeFrom=now-24h%2Fh&rangeTo=now&serviceGroup=&transactionType=request)
cluster
## Summary
This PR is the Step 1 to enable performance journeys run for serverless
projects.
The focus is to re-design journeys to be compatible both for stateful &
serverless Kibana.
I created `KibanaPage` class to have some shared UI actions across
different journeys.
`ProjectPage` extends `KibanaPage` and allows us to override actions,
that are different (or have different locators) in Kibana Project UI
(generic project at the moment)
`kibanaPage` is available in Step context and based on TEST_SERVERLESS
env var appropriate class instance is used.
```typescript
.step('Go to Discover Page', async ({ page, kbnUrl, kibanaPage }) => {
await page.goto(kbnUrl.get(`/app/discover`));
await kibanaPage.waitForHeader();
await page.waitForSelector('[data-test-subj="discoverDocTable"][data-render-complete="true"]');
await page.waitForSelector(subj('globalLoadingIndicator-hidden'));
})
```
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR adds custom performance metrics collection in Discover app
client using EBT.
[Discussed](https://elastic.slack.com/archives/CNKNE0PHN/p1685631040718719)
in slack
The following events will be collected (thanks a lot to @davismcphee for
the great code overview and suggestions)
Discover main view:
- `discoverLoadSavedSearch` will report Saved Search loading time on
opening app by calculating
[loadSavedSearch](5b784c8967/src/plugins/discover/public/application/main/discover_main_route.tsx (L131-L170))
call duration
- `discoverFetchAll`: reports Discover table loading time ("time to
data") by calculating
[fetchAll](5b784c8967/src/plugins/discover/public/application/main/services/discover_data_state_container.ts (L208-L223))
call duration
- `discoverFetchAllRequestsOnly`: reports [fetching ES
documents](5b784c8967/src/plugins/discover/public/application/main/utils/fetch_all.ts (L85-L96))
duration only (event meta contains `fetchType: fetchDocuments |
fetchSQL` ), part of "time to data" duration. It calculates
`fetchDocuments` | `fetchSQL` call duration.
Discover single doc view:
- `discoverSingleDocFetch`: reports individual document fetching time by
calculating
[requestData](5b784c8967/src/plugins/discover/public/hooks/use_es_doc_search.ts (L39-L75))
call duration
Surrounding documents view:
- `discoverSurroundingDocsFetch` reports [surrounding docs fetching
time](5b784c8967/src/plugins/discover/public/application/context/context_app.tsx (L122-L149))
and will also contain fetchType in meta, e.g. `fetchType:
'predecessors'`
**Note**: currently we won't report it, since `many_fields_discover`
journey uses esArchives with data not supporting surrounding docs. We
can add new journey with custom dataset to address it and other
performance-related areas.
Metrics can be tracked on [single user perf
dashboard](dd0473ac-826f-5621-9a10-25319700326e?_g=())
as `many_fields_discover` targeted Lens viz:
<img width="1423" alt="image"
src="aaaaa6a0-a666-4ea2-b627-fa44b4673210">
4 runs were done before `discoverFetchAllRequestsOnly` was added, so you
only see 3 data points for this metric
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
* [performance/utils] extend error message for waitForVisualizations
* revert test change
* remove new line
Co-authored-by: Liza Katz <liza.katz@elastic.co>
* [ftr] add first-class support for playwrite journeys
* [CI] Auto-commit changed files from 'node scripts/generate codeowners'
* fix jest test
* remove ability to customize kibana server args, if we need it we can add it back
* remove dev dir that doesn't exist
* fix typo
* prevent duplicated array converstion logic by sharing flag reader
* remove destructuring of option
* fix scalability config and config_path import
* fix start_servers args and tests
* include simple readme
* fix jest tests and support build re-use when changes are just to jest tests
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>