Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scout] add ci pipeline #202707

Merged
merged 24 commits into from
Dec 11, 2024
Merged

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Dec 3, 2024

Summary

Adding basic pipeline to run scout UI tests for stateful and 3 serverless projects. Few tests were skipped for Security project because esArchives used in tests ingest index that are restricted for default project roles.

It is an opt-in pipeline to verify kbn/scout changes does not break the existing tests. It is only for start and we plan to re-work into a mature pipeline later.

New opt-in pipeline was added
Screenshot 2024-12-10 at 11 31 35

@dmlemeshko dmlemeshko changed the title Scout/add ci pipeline [scout] add ci pipeline Dec 3, 2024
Comment on lines +15 to +35
export const validateTagsFixture = base.extend<{ validateTags: void }>({
validateTags: [
async ({}, use, testInfo) => {
if (testInfo.tags.length === 0) {
throw new Error(`At least one tag is required: ${supportedTags.join(', ')}`);
}

const invalidTags = testInfo.tags.filter((tag: string) => !supportedTags.includes(tag));
if (invalidTags.length > 0) {
throw new Error(
`Unsupported tag(s) found in test suite "${testInfo.title}": ${invalidTags.join(
', '
)}. ` + `Supported tags are: ${supportedTags.join(', ')}.`
);
}

await use();
},
{ auto: true },
],
});
Copy link
Member Author

@dmlemeshko dmlemeshko Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal: notify test author about requirement of tags definition and validating its correctness. I also introduces aliases through tags variable to minimize spelling error.

Note: it only work when you run tests in IDE; when you run tests via npx playwright test --grep <tag> playwright is doing filtering in advance and no tags or incorrect tags will cause test to be filtered out.

That said, for CI we will need to come up with some script to validate tags being defined. But I still believe there is a benefit of raising error during test development process

Copy link
Member Author

@dmlemeshko dmlemeshko Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: adding non-supported tag @xyz like

test.describe(
  'Discover app - saved searches',
  { tag: ['@ess', '@svlSearch', '@svlOblt', '@xyz'] },
  () => {

will lead to runtime error

image

import { test, testData } from '../fixtures';

test.describe('Discover app - errors', { tag: ['@ess'] }, () => {
test.describe('Discover app - errors', { tag: tags.ESS_ONLY }, () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alias to simplify the process and avoid spelling/incorrect tagging issues

@dmlemeshko dmlemeshko self-assigned this Dec 3, 2024
};

test.beforeAll(async ({ esArchiver, kbnClient, uiSettings }) => {
await esArchiver.loadIfNeeded(testData.ES_ARCHIVES.ECOMMERCE);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will work for Security project only with admin role, that has access to all indexes. It probably means generating new saved objects, leaving for later

{ tag: ['@ess', '@svlSecurity', '@svlOblt', '@svlSearch'] },
{ tag: ['@ess', '@svlSearch', '@svlOblt'] },
// TODO: Update to use an ES archive with an index accessible to 'viewer'
// for running this test against the Security serverless project.
() => {
test.beforeAll(async ({ esArchiver, kbnClient, uiSettings }) => {
await esArchiver.loadIfNeeded(testData.ES_ARCHIVES.NO_TIME_FIELD);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar issue: viewer has access to limited indexes ( '.siem-signals*', '.lists-', '.items-') and test requires re-work.

@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v9.0.0 test:scout labels Dec 3, 2024
args: [
'test',
`--config=${playwrightConfigPath}`,
`--grep=${playwrightGrepTag}`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing one of @ess , svlSearch, ... tags to playwright runner

'--xpack.cloud.profile_url=/user/settings/',
'--xpack.cloud.projects_url=/projects/',
'--xpack.cloud.serverless.project_id=fakeprojectid',
'--xpack.cloud.users_and_roles_url=/account/members/',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied missing arguments from FTR svl config

/^x-pack\/plugins\/discover_enhanced\/ui_tests/,
/^packages\/kbn-scout/,
])) ||
GITHUB_PR_LABELS.includes('ci:scout-ui-tests')
Copy link
Member Author

@dmlemeshko dmlemeshko Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ci:scout-ui-tests, later we can add ci:scout-api-tests, wdyt?

@dmlemeshko dmlemeshko marked this pull request as ready for review December 9, 2024 16:59
@dmlemeshko dmlemeshko requested review from a team as code owners December 9, 2024 16:59
Copy link
Member

@dolaru dolaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perused over the changes and nothing looks out of place to me, but someone more experienced in this code base should approve.

Copy link
Member

@pheyos pheyos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I have a few things in mind that we should discuss and potentially follow up on. But in the interest of moving forward, we should merge this PR and handle the items in separate PRs.

@dmlemeshko dmlemeshko merged commit 87b2a12 into elastic:main Dec 11, 2024
9 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/scout 86 90 +4
Unknown metric groups

API count

id before after diff
@kbn/scout 117 121 +4

History

cc @dmlemeshko

CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
## Summary

Adding basic pipeline to run scout UI tests for stateful and 3
serverless projects. Few tests were skipped for Security project because
esArchives used in tests ingest index that are restricted for default
project roles.

It is an opt-in pipeline to verify kbn/scout changes does not break the
existing tests. It is only for start and we plan to re-work into a
mature pipeline later.

New opt-in
[pipeline](https://buildkite.com/elastic/kibana-pull-request/builds/258589#0193afc4-bbd6-4200-8c5f-a7e4a8073e1d)
was added
<img width="1659" alt="Screenshot 2024-12-10 at 11 31 35"
src="https://github.com/user-attachments/assets/1c19fa46-4e66-4796-ac6d-c2c96c74fa8e">
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Dec 18, 2024
## Summary

Adding basic pipeline to run scout UI tests for stateful and 3
serverless projects. Few tests were skipped for Security project because
esArchives used in tests ingest index that are restricted for default
project roles.

It is an opt-in pipeline to verify kbn/scout changes does not break the
existing tests. It is only for start and we plan to re-work into a
mature pipeline later.

New opt-in
[pipeline](https://buildkite.com/elastic/kibana-pull-request/builds/258589#0193afc4-bbd6-4200-8c5f-a7e4a8073e1d)
was added
<img width="1659" alt="Screenshot 2024-12-10 at 11 31 35"
src="https://github.com/user-attachments/assets/1c19fa46-4e66-4796-ac6d-c2c96c74fa8e">

(cherry picked from commit 87b2a12)

# Conflicts:
#	x-pack/plugins/discover_enhanced/ui_tests/tests/saved_searches.spec.ts
@dmlemeshko
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

dmlemeshko added a commit that referenced this pull request Dec 18, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[scout] add ci pipeline
(#202707)](#202707)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-11T11:15:50Z","message":"[scout]
add ci pipeline (#202707)\n\n## Summary\r\n\r\nAdding basic pipeline to
run scout UI tests for stateful and 3\r\nserverless projects. Few tests
were skipped for Security project because\r\nesArchives used in tests
ingest index that are restricted for default\r\nproject roles.\r\n\r\nIt
is an opt-in pipeline to verify kbn/scout changes does not break
the\r\nexisting tests. It is only for start and we plan to re-work into
a\r\nmature pipeline later.\r\n\r\nNew
opt-in\r\n[pipeline](https://buildkite.com/elastic/kibana-pull-request/builds/258589#0193afc4-bbd6-4200-8c5f-a7e4a8073e1d)\r\nwas
added\r\n<img width=\"1659\" alt=\"Screenshot 2024-12-10 at 11 31
35\"\r\nsrc=\"https://github.com/user-attachments/assets/1c19fa46-4e66-4796-ac6d-c2c96c74fa8e\">","sha":"87b2a12480c457ecb5ec9640c3e3ebc697edf0f7","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v9.0.0","test:scout"],"number":202707,"url":"https://github.com/elastic/kibana/pull/202707","mergeCommit":{"message":"[scout]
add ci pipeline (#202707)\n\n## Summary\r\n\r\nAdding basic pipeline to
run scout UI tests for stateful and 3\r\nserverless projects. Few tests
were skipped for Security project because\r\nesArchives used in tests
ingest index that are restricted for default\r\nproject roles.\r\n\r\nIt
is an opt-in pipeline to verify kbn/scout changes does not break
the\r\nexisting tests. It is only for start and we plan to re-work into
a\r\nmature pipeline later.\r\n\r\nNew
opt-in\r\n[pipeline](https://buildkite.com/elastic/kibana-pull-request/builds/258589#0193afc4-bbd6-4200-8c5f-a7e4a8073e1d)\r\nwas
added\r\n<img width=\"1659\" alt=\"Screenshot 2024-12-10 at 11 31
35\"\r\nsrc=\"https://github.com/user-attachments/assets/1c19fa46-4e66-4796-ac6d-c2c96c74fa8e\">","sha":"87b2a12480c457ecb5ec9640c3e3ebc697edf0f7"}},"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/202707","number":202707,"mergeCommit":{"message":"[scout]
add ci pipeline (#202707)\n\n## Summary\r\n\r\nAdding basic pipeline to
run scout UI tests for stateful and 3\r\nserverless projects. Few tests
were skipped for Security project because\r\nesArchives used in tests
ingest index that are restricted for default\r\nproject roles.\r\n\r\nIt
is an opt-in pipeline to verify kbn/scout changes does not break
the\r\nexisting tests. It is only for start and we plan to re-work into
a\r\nmature pipeline later.\r\n\r\nNew
opt-in\r\n[pipeline](https://buildkite.com/elastic/kibana-pull-request/builds/258589#0193afc4-bbd6-4200-8c5f-a7e4a8073e1d)\r\nwas
added\r\n<img width=\"1659\" alt=\"Screenshot 2024-12-10 at 11 31
35\"\r\nsrc=\"https://github.com/user-attachments/assets/1c19fa46-4e66-4796-ac6d-c2c96c74fa8e\">","sha":"87b2a12480c457ecb5ec9640c3e3ebc697edf0f7"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes test:scout v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants