-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Backport This will backport the following commits from `main` to `8.x`: - [[Synthetics] Clean up e2e test helpers !! (#203812)](#203812) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2024-12-12T09:52:19Z","message":"[Synthetics] Clean up e2e test helpers !! (#203812)\n\n## Summary\r\n\r\nClean up e2e test helpers","sha":"0203bba44f9dcac037f23a23e4945298ef6b5912","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","Team:obs-ux-management"],"number":203812,"url":"https://github.com/elastic/kibana/pull/203812","mergeCommit":{"message":"[Synthetics] Clean up e2e test helpers !! (#203812)\n\n## Summary\r\n\r\nClean up e2e test helpers","sha":"0203bba44f9dcac037f23a23e4945298ef6b5912"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203812","number":203812,"mergeCommit":{"message":"[Synthetics] Clean up e2e test helpers !! (#203812)\n\n## Summary\r\n\r\nClean up e2e test helpers","sha":"0203bba44f9dcac037f23a23e4945298ef6b5912"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
a6f369b
commit ac450e9
Showing
64 changed files
with
129 additions
and
1,541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
*/ | ||
|
||
export { makeUpSummary, makeDownSummary } from './src/make_summaries'; | ||
export * from './src/e2e'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions
58
x-pack/packages/observability/synthetics_test_data/src/e2e/helpers/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { expect, Page } from '@elastic/synthetics'; | ||
|
||
export async function waitForLoadingToFinish({ page }: { page: Page }) { | ||
while (true) { | ||
if (!(await page.isVisible(byTestId('kbnLoadingMessage'), { timeout: 5000 }))) break; | ||
await page.waitForTimeout(1000); | ||
} | ||
} | ||
|
||
export async function loginToKibana({ | ||
page, | ||
user, | ||
}: { | ||
page: Page; | ||
user?: { username: string; password: string }; | ||
}) { | ||
await page.fill('[data-test-subj=loginUsername]', user?.username ?? 'elastic', { | ||
timeout: 60 * 1000, | ||
}); | ||
|
||
await page.fill('[data-test-subj=loginPassword]', user?.password ?? 'changeme'); | ||
|
||
await page.click('[data-test-subj=loginSubmit]'); | ||
|
||
await waitForLoadingToFinish({ page }); | ||
} | ||
|
||
export const byTestId = (testId: string) => { | ||
return `[data-test-subj=${testId}]`; | ||
}; | ||
|
||
export const assertText = async ({ page, text }: { page: Page; text: string }) => { | ||
const element = await page.waitForSelector(`text=${text}`); | ||
expect(await element.isVisible()).toBeTruthy(); | ||
}; | ||
|
||
export const assertNotText = async ({ page, text }: { page: Page; text: string }) => { | ||
expect(await page.$(`text=${text}`)).toBeFalsy(); | ||
}; | ||
|
||
export const getQuerystring = (params: object) => { | ||
return Object.entries(params) | ||
.map(([key, value]) => encodeURIComponent(key) + '=' + encodeURIComponent(value)) | ||
.join('&'); | ||
}; | ||
|
||
export const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); | ||
|
||
export const TIMEOUT_60_SEC = { | ||
timeout: 60 * 1000, | ||
}; |
11 changes: 11 additions & 0 deletions
11
x-pack/packages/observability/synthetics_test_data/src/e2e/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { recordVideo } from './helpers/record_video'; | ||
export { SyntheticsRunner } from './helpers/synthetics_runner'; | ||
export { argv } from './helpers/parse_args_params'; | ||
export { readKibanaConfig } from './tasks/read_kibana_config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,8 @@ | |
"target/**/*" | ||
], | ||
"kbn_references": [ | ||
"@kbn/apm-plugin", | ||
"@kbn/es-archiver", | ||
"@kbn/repo-info", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
x-pack/plugins/observability_solution/exploratory_view/e2e/parse_args_params.ts
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
x-pack/plugins/observability_solution/exploratory_view/e2e/record_video.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.