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

[Tests] Migrate VisBuilder functional tests into Dashboards repo #6102

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manasvinibs
Copy link
Member

@manasvinibs manasvinibs commented Mar 10, 2024

Description

  • Migrating VisBuilder functional tests along with utils and fixtures from FT repo to Dashboards repo as a reference tests for other apps to write more tests in the repo.
  • Adding commands and constants from FT repo.
  • Moving test library dependency to dev dependency

Issues Resolved

Testing the changes

Run Cypress Tests for ciGroup11 should run all the tests for visBuilders app in the CI.
https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/8220159200/job/22478945672?pr=6102

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

codecov bot commented Mar 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.33%. Comparing base (f103b7e) to head (e1e834e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6102      +/-   ##
==========================================
+ Coverage   67.31%   67.33%   +0.02%     
==========================================
  Files        3348     3348              
  Lines       64966    64966              
  Branches    10465    10465              
==========================================
+ Hits        43729    43743      +14     
+ Misses      18690    18677      -13     
+ Partials     2547     2546       -1     
Flag Coverage Δ
Linux_1 31.72% <ø> (ø)
Linux_2 55.55% <ø> (ø)
Linux_3 44.67% <ø> (+<0.01%) ⬆️
Linux_4 35.02% <ø> (ø)
Windows_1 31.76% <ø> (+0.02%) ⬆️
Windows_2 55.52% <ø> (ø)
Windows_3 44.68% <ø> (ø)
Windows_4 35.02% <ø> (ø)

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.

@manasvinibs manasvinibs marked this pull request as ready for review March 10, 2024 06:35
@ashwin-pc ashwin-pc self-assigned this Mar 11, 2024
Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

LGTM. The security overrides need to be validated but that isnt applicable to the local cypress tests so should not block this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Comment on lines +28 to +34
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
Cypress.on('uncaught:exception', (err) => {
/* returning false here prevents Cypress from failing the test */
if (resizeObserverLoopErrRe.test(err.message)) {
return false;
}
});
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Member Author

@manasvinibs manasvinibs Mar 18, 2024

Choose a reason for hiding this comment

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

This was migrated as it is from FT Repo. I think without this we are seeing errors on few of Vis builder tests. We might want to dive deep into the tests which are exposing this behavior but for now keeping the parity with FT repo tests I'm just keeping this logic in place.

ResizeObserver loop limit exceeded
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the uncaught:exception event.
https://on.cypress.io/uncaught-exception-from-application
at (http://localhost:5601/app/vis-builder/#/?_q=(filters:!(),query:(language:kuery,query:''))&_a=(metadata:(editor:(errors:(),state:clean),originatingApp:dashboards),style:(addLegend:!t,addTooltip:!t,legendPosition:right,type:histogram),ui:(),visualization:(activeVisualization:(aggConfigParams:!(),name:histogram),indexPattern:a031e530-5a88-11ed-a595-f5e6ea9b3826,searchField:''))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'2021-12-31T08:00:00.000Z',to:'2022-10-02T07:00:00.000Z')):0:0)

Copy link
Member

Choose a reason for hiding this comment

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

Think we should catch these errors instead of skipping it like this 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed! I think this is more of a Cypress version specific issue than application and might have been introduced in FT repo as a workaround till they upgrade. I see this thread about the same: cypress-io/cypress#8418
May be as part of Cypress version upgrade effort, we can get rid of similar stuff.

* This overwrites the default visit command to authenticate before visiting
* webpages if SECURITY_ENABLED cypress env var is true
*/
Cypress.Commands.overwrite('visit', (orig, url, options) => {
Copy link
Member

Choose a reason for hiding this comment

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

Have we validated these overrides?

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'm still validating/fixing issues for running security enabled tests and its overrides. But as you said should not be a blocker for this PR or to run local CI.

@manasvinibs manasvinibs force-pushed the Issue-5892-1 branch 2 times, most recently from 8f10eb6 to 4df7360 Compare March 19, 2024 18:10
};

export const CURRENT_TENANT = {
defaultTenant: 'private',
Copy link
Member

Choose a reason for hiding this comment

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

make this global please

Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com>
@@ -0,0 +1,4123 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

do you think we can compress these large files and update the helper function to modify it? also, not sure if the ndjson vs json.txt was intentionally i think we should standardize our saved objects

Copy link
Member

Choose a reason for hiding this comment

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

can we standardize the structure of this? might need to be compressed too

@kavilla kavilla removed the v2.14.0 label Apr 23, 2024
@BionIT
Copy link
Collaborator

BionIT commented Jun 5, 2024

Hi @manasvinibs , are we targeting this PR for 2.15 or 2.16?

@ananzh
Copy link
Member

ananzh commented Oct 30, 2024

Convert to draft due to no progress.

@ananzh ananzh marked this pull request as draft October 30, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants