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

[SecuritySolution] Fix inspect_button cypress #158543

Merged
merged 28 commits into from
Jun 15, 2023
Merged

Conversation

angorayc
Copy link
Contributor

@angorayc angorayc commented May 26, 2023

Summary

#153765

Inspect button cypress was found flaky sometimes. I was able to reproduce the scenario when the tests failed by setting network throttling to slow 3G with Chrome.

Here's what I add to reduce the flakyness:

  1. Taking welcome icon page into consideration when loading the page. Check the welcome icon has shown and disappeared before checking the loading indicator in the header. This should buy us more time to avoid timeout in comparison to checking the loading indicator straight away.
Screenshot 2023-05-26 at 10 51 08
  1. Replace creating data view via api with loading esArchiver auditbeat data. I assume preload the data could reduce the uncertainty of fetching api under slow internet speed, and therefore reduce the possible failure during setting up the tests.

  2. Update postDataView task: [SecuritySolution] Fix inspect_button cypress #158543 (comment)

@angorayc angorayc self-assigned this May 26, 2023
@angorayc angorayc added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore labels May 26, 2023
@angorayc angorayc marked this pull request as ready for review June 6, 2023 08:26
@angorayc angorayc requested a review from a team as a code owner June 6, 2023 08:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 33 to 36
// Create and select data view
postDataView(DATA_VIEW);
visit(HOSTS_URL);
selectDataView(DATA_VIEW);
Copy link
Member

Choose a reason for hiding this comment

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

Was this part flaky? I wrote it to assert that the inspect modal shows the selected data view. After this PR, it will use the security index pattern. It is testing something different but I guess it isn't a problem.

Copy link
Member

Choose a reason for hiding this comment

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

If it is testing something different it is a problem because we are changing the coverage. cc @machadoum @angorayc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I tested locally with slow internet, postDataView had some problems few times, so I removed it and replaced it with es archiver. But I think I should leave selectDataView there, putting it back now.

Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

LGTM!

@angorayc
Copy link
Contributor Author

angorayc commented Jun 14, 2023

@MadameSheema
I have a question for you about a task in cypress.
I am having an issue running the test successfully after putting this line back https://github.com/elastic/kibana/pull/158543/files#diff-ded7ed9f82f26e44471b334017dc747958ad7708f069914b3877329219a35ce1R38

es-version-required

I never had postDataView working when running the test locally, it always return 400. I'd like to update the task

export const postDataView = (dataSource: string) => {
  rootRequest({
    method: 'POST',
    url: `/api/data_views/data_view`,
    body: {
      data_view: {
        name: dataSource,
        fieldAttrs: '{}',
        title: dataSource,
        timeFieldName: '@timestamp',
      },
    },
    headers: {
      'kbn-xsrf': 'cypress-creds-via-config',
      [ELASTIC_HTTP_VERSION_HEADER]: [INITIAL_REST_VERSION],
    },
    failOnStatusCode: false,
  });
};
  1. It needs an extra 'elastic-api-version': '2023-10-31' header.
  2. Create index pattern is deprecated so I replace it with create data view api. https://www.elastic.co/guide/en/kibana/8.8/index-patterns-api-create.html

I'm not sure why this is not an issue when running CI.

Copy link
Member

@MadameSheema MadameSheema left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #16 / Alerting builtin alertTypes es_query rule runs correctly and populates recovery context for searchSource search type

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 410 414 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 493 497 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @angorayc

@angorayc angorayc merged commit 11cdbc9 into elastic:main Jun 15, 2023
@kibanamachine kibanamachine added v8.9.0 backport:skip This commit does not require backporting labels Jun 15, 2023
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 Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants