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

refactor some query-enhancement utility functions, add some missing typings #9074

Merged

Conversation

angle943
Copy link
Contributor

@angle943 angle943 commented Dec 18, 2024

Description

Refactors/additions for Cypress Query Enhancements

  • update the custom command waitForLoader to take optional arg isEnhancement: boolean
  • remove the cy.wait() within waitForLoader to speed up the command
  • remove the now redundant waitForLoaderNewHeader command and refactor its' usage to be waitForLoader(true)
  • add typescript typings to some of our custom commands
  • refactor createWorkspaceIndexPatterns
    • conditionally call cy.get('[type="data-source"]').contains(dataSource).click(); if dataSource prop is provided. This is because if your ws only has one data source, then this step is not visible in the UI, and this utility will fail
    • add optional arg indexPatternHasTimefield: boolean. This is needed because if the index pattern you select does not have a timefield, then the option of choosing a timestamp field does not appear, causing the test to fail
    • add the isEnhancement: boolean prop
  • add deleteWorkspaceIndexPatterns utility
  • refactor navigateToWorkSpaceSpecificPage to be less flaky
    • one thing to call out. I noticed a lot of flaky tests due to the nature of our left menu bar. The left menu bar's open state persists through navigation and refreshes. Therefore, in order to maintain consistent state before & after a function is run, if a function opens the bar, we should also add a step that closes it. This way we do not have to keep track of it's open state.

Issues Resolved

-n/a

Testing the changes

  • ran cypress tests

Changelog

  • test: query-enhancements testing utility updates and additions

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Entry Too Long

Entry is 139 characters long, which is 39 characters longer than the maximum allowed length of 100 characters. Please revise your entry to be within the maximum length.

* SPDX-License-Identifier: Apache-2.0
*/

declare namespace Cypress {
Copy link
Member

Choose a reason for hiding this comment

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

I like this. We should add ts support to all the utilities, which can allow proper autocomplete and type check. I think we used to have in ftr repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i saw them more frequently in the ftr repo. I didn't add every single one here, i was mainly adding the ones that I was using just for my development benefit (IDE auto-complete) and decided to commit it to this PR. it would be great if later we can have full TS support for all of our utilities

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.86%. Comparing base (f9c463d) to head (9f8bfde).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9074   +/-   ##
=======================================
  Coverage   60.86%   60.86%           
=======================================
  Files        3808     3808           
  Lines       91209    91209           
  Branches    14410    14410           
=======================================
  Hits        55516    55516           
  Misses      32153    32153           
  Partials     3540     3540           
Flag Coverage Δ
Linux_1 29.02% <ø> (ø)
Linux_2 56.38% <ø> (ø)
Linux_3 37.93% <ø> (ø)
Linux_4 29.01% <ø> (ø)
Windows_1 29.03% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.93% <ø> (ø)
Windows_4 29.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ananzh ananzh added the discover_2.0-test Issues that are specific to the Discover 2.0 testing initiative label Dec 18, 2024
Copy link
Collaborator

@LDrago27 LDrago27 left a comment

Choose a reason for hiding this comment

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

LGTM

@ananzh ananzh merged commit 06bcf20 into opensearch-project:main Dec 19, 2024
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discover_2.0-test Issues that are specific to the Discover 2.0 testing initiative repeat-contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants