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

[Security Solution] Reusing Cypress tests POC1 #162023

Closed
wants to merge 11 commits into from

Conversation

MadameSheema
Copy link
Member

@MadameSheema MadameSheema commented Jul 17, 2023

Summary

With the aim of speed-up the test automation on serverless and reusing the work we have done so far with Cypress, we are doing different POC to check which one fits better our needs(#161537).

NOTE: This PR is just a POC, the code is not going to be merged, the idea behind is to open a discussion to see which solution should be implemented and then create a proper PR for it.

Idea

To have different folders. One for serverless specific, one for ESS specific, and one for tests that can be executed in both environments.

Implementation for the POC

  • x-pack/plugins/security_solution/cypress/e2e is used for ESS tests
  • x-pack/test_serverless/functional/test_suites/security/cypress/e2e is used for specific serverless tests
  • x-pack/test/security_solution_cypress/e2e is used for tests that can be executed on both environments

The idea is that when we execute the ESS or serverless tests, to include as well the ones on the x-pack/test/security_solution_cypress/e2e security folder. In order to do so, we have modified the specPattern on each one of the executions. To demonstrate that the idea works, we have used the user_details.cy.ts.

As part of this POC we have also:

  • Removed the waitForPageToBeLoaded method for investigation purposes. The serverless environment does not have that locator and cypress by default waits for an element to be present on the UI before performing an action, so just checking if is really necessary for the current tests.
  • Added a modification to the parallel.ts script used currently for the ESS tests to spin-up the environment to take into consideration the specPattern when using Cypress on visual mode.
  • Loaded the default audibteat archive when starting the FTR serverless environment and added some missing environment variables to make the user_details.cy.ts test work when is executed from serverless.
  • Added missing commands on the serverless folder to make the user_details.cy.ts test work when is executed from serverless.

PROS

  • Easy way of having a clear picture of the belonging of each test due to the folder structure.

CONS

  • It might be slow to move all the tests.
  • It might be complex or not quite clear how to manage the shared screens and tasks

Takeaways

If we want to have a clear picture of the belonging of each test, that might be our solution. If we finally go for this we should also decide:

  • If the proposed folder for the environment agnostic tests is the correct one.
  • If the proposed naming is the correct one.
  • What do we do with the screens and tasks? Should we move them into that folder as well? Should all the tasks and screens live in that folder?

@MadameSheema MadameSheema changed the title wip [Security Solution] Reusing Cypress tests POC1 Jul 17, 2023
@kibana-ci
Copy link
Collaborator

kibana-ci commented Jul 18, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #19 / management Files management should render an empty prompt

Metrics [docs]

✅ unchanged

History

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

@banderror banderror requested review from banderror and yctercero July 18, 2023 18:16
Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

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

@MadameSheema I'm in favor of the 2nd POC that uses tagging.

This POC proposes to split tests into this kind of three folders:

  • x-pack/plugins/security_solution/cypress/e2e for ESS tests
  • x-pack/test_serverless/functional/test_suites/security/cypress/e2e for Serverless tests
  • x-pack/test/security_solution_cypress/e2e for tests that can run both against ESS and Serverless

I think this would:

  • make it hard to reason about what tests are kept where, just because 2/3 of path names are not explicit about that
  • force us to jump between folders all the time; jumping between distant folders is poor DX and takes more time usually
  • as you mentioned in the description, this would bring the problem of implementing and reusing helper code for tests ("screens", "tasks", "commands", fixtures, page objects, and whatnot)

If we add other potential "dimensions" for tests in the future, such as licensing, we would probably need to add even more folder hierarchies. This doesn't seem scalable.

@MadameSheema
Copy link
Member Author

Closing in favor of: #162698

@MadameSheema MadameSheema deleted the poc/reusing-tests branch November 10, 2023 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants