elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.71k stars 8.13k forks source link

[MKI] Failing test: x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts - should show okta and azure managed data sections and expand panel #179248

Open MadameSheema opened 5 months ago

MadameSheema commented 5 months ago

The test x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts - should show okta and azure managed data sections and expand panel is failing in MKI environments.

Screenshot 2024-03-22 at 12 57 45
Error:     AssertionError: Timed out retrying after 300000ms: Expected to find element: `[data-test-subj="managedUser-data"] [data-test-subj="managed-user-accordion-userAssetEntraLeftSection"]`, but never found it.
    at expandManagedDataEntraPanel (webpack:///./tasks/users/flyout_user_panel.ts:14:5)
    at Context.eval (webpack:///./e2e/entity_analytics/entity_flyout.cy.ts:155:38)
elasticmachine commented 5 months ago

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

elasticmachine commented 5 months ago

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

machadoum commented 5 months ago

@MadameSheema, Could you share some documentation about MKI tests? How do we run it locally?

MadameSheema commented 5 months ago

Hey @machadoum you'll find all the info at the Cypress readme but let me summarize it here:

Setup required

Setup a valid Elastic Cloud API key for QA environment:

  1. Navigate to QA environment.
  2. Click on the User menu button located on the top right of the header.
  3. Click on Organization.
  4. Click on the API keys tab.
  5. Click on Create API key button.
  6. Add a name, set an expiration date, assign an organization owner role.
  7. Click on Create API key
  8. Save the value of the key

Store the saved key on ~/.elastic/cloud.json using the following format:

{
  "api_key": {
    "qa": "<API_KEY>"
  }
}

Store the email and password of the account you used to login in the QA Environment at the root directory of your Kibana project on .ftr/role_users.json, using the following format:

{
  "admin": {
    "email": "<email>",
    "password": "<password>"
  }
}

Testing with different roles

If you want to execute a test using Cypress on visual mode with MKI, you need to make sure you have the user created in your organization, and add it to the .ftr/role_users.json:

{
  "admin": {
    "email": "<email>",
    "password": "<password>"
  },
  "<roleName>": {
    "email": "<email>",
    "password": "<password>"
  }
}

As role names please use:

The above should be the same used on the automation.

PLIs

When running serverless Cypress tests on QA environment, the following PLIs are set by default:

      { product_line: 'security', product_tier: 'complete' },
      { product_line: 'endpoint', product_tier: 'complete' },
      { product_line: 'cloud', product_tier: 'complete' },

With the above configuration we'll be able to cover most of the scenarios, but there are some cases were we might want to use a different configuration. In that case, we just need to pass to the header of the test, which is the configuration we want for it.

describe(
  'Entity Analytics Dashboard in Serverless',
  {
    tags: '@serverless',
    env: {
      ftrConfig: {
        productTypes: [
          { product_line: 'security', product_tier: 'essentials' },
          { product_line: 'endpoint', product_tier: 'essentials' },
        ],
      },
    },
  },

For test developing or test debugging purposes on QA, you have avaialable the following options:

yarn cypress:open:qa:serverless --tier <essentials|complete>

The above command will open the Cypress UI with all tests in the e2e directory tagged as SERVERLESS. This also creates an MKI project in console.qa enviornment with the passed tier essentials or complete. If no flag is passed, the project will be cretaed as complete.

yarn cypress:open:qa:serverless --no-endpoint-addon

The above command will open the Cypress UI with all tests in the e2e directory tagged as SERVERLESS. This also creates an MKI project in console.qa enviornment without the endpoint add-on.

yarn cypress:open:qa:serverless --no-cloud-addon

The above command will open the Cypress UI with all tests in the e2e directory tagged as SERVERLESS. This also creates an MKI project in console.qa enviornment without the cloud add-on.

Note that all the above flags can be combined.

To run on the default configuration in serverless QA:

export QA_CONSOLE_URL="https://console.qa.cld.elstc.co"

Navigate to x-pack/test/security_solution_cypress

Execute:

yarn cypress:open:qa:serverless

Feel free to ping me if you need any further information :)

machadoum commented 5 months ago

@MadameSheema I don't know how to run my local Kibana code on MKI, so my debugging options are limited. From what I could investigate, it seems like the test fails because the feature flag is disabled on the MKI environment. Do you know why it is disabled only for MKI?

MadameSheema commented 5 months ago

Hey @machadoum really sorry about coming back that late to your message!!

Feature flags does not work on MKI environments, that is a known limitation, you cannot disable and enable FF through configuration on serverless as we do with ESS. Kibana is planning to ad a mechanism soon.

Thanks!

jaredburgettelastic commented 4 months ago

@MadameSheema any idea if there's a GitHub issue that we can track for "Kibana is planning to ad a mechanism soon"?

MadameSheema commented 4 months ago

@MadameSheema any idea if there's a GitHub issue that we can track for "Kibana is planning to ad a mechanism soon"?

Not that I'm aware of