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

Add Discover Table Tests #1182

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Add Discover Table Tests #1182

merged 1 commit into from
Apr 30, 2024

Conversation

LDrago27
Copy link
Contributor

@LDrago27 LDrago27 commented Mar 27, 2024

Description

This adds functional tests for the issues described in opensearch-project/OpenSearch-Dashboards#6280.

Issues Resolved

opensearch-project/OpenSearch-Dashboards#5713

Issues Still Pending (Sub Issues within the Test Suite are mentioned within brackets)

  1. Function Test Suite 2: Copy data without extra data: No easy way to test copying data to clipboard in cypress
  2. Function Test Suite 5: Left Navigation Display (Should display Unknown type field properly in left navigation): Niche scenario
  3. Function Test Suite 6: Saved Search Embeddable in Dashboard (When load a saved search in dashboard, sort should be loaded properly Issue: [BUG][Discover] Sort from search embeddable is not loaded in Dashboard OpenSearch-Dashboards#5933) : Issue still open hence couldn't be tested
  4. Function Test Suite 10: Saved query (From index manage page (saved object), click a saved query object created from Discover/Dashboard/Vis can load Discover with proper query and filter Issue: [BUG] Discover crashed when loading a saved search from saved object list in dashboards management OpenSearch-Dashboards#5942) : Issue Still open hence can't be tested

The test suites are divided across two files discover_table and discover_advanced_settings. All the functional tests related to the Advanced Settings are grouped in discover_advanced_setting while the rest are part of discover_table settings.

Tests when run without security

discover_advanced_settings_no_security.spec.js.mp4
discover_table_no_security.spec.js.mp4

Tests when run with security

discover_advanced_settings_with_security.spec.js.mp4
discover_table_with_security.spec.js.mp4

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

cy.waitForLoader();
});

after(() => {});
Copy link
Collaborator

Choose a reason for hiding this comment

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

can be removed?

Copy link
Contributor Author

@LDrago27 LDrago27 Mar 28, 2024

Choose a reason for hiding this comment

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

@Hailong-am Removed it in the latest version of the PR.

// Setting up the page
describe('discover_table', () => {
beforeEach(() => {
if (Cypress.env('SECURITY_ENABLED')) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this if (Cypress.env('SECURITY_ENABLED')) { since this path cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer is different from cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_share_copy_link_test.js which will be tested in component and Integ in release pipeline. Most security related ones are in cypress/integration/plugins/security. For data_explorer, we don't need to test security.

Seems our current tests are not consistency. I see one test has check this cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js but all the rest don't. Maybe we should clean this one as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated both the tests to remove the check specific to security.

cy.waitForSearch();
});

describe('no line wrapping in legacy table', () => {
Copy link
Member

Choose a reason for hiding this comment

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

no line wrapping in legacy table --> auto line wrapping in legacy table

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the description.

});

describe('no line wrapping in legacy table', () => {
it('checks that there is no line wrapping by default in the legacy table', function () {
Copy link
Member

Choose a reason for hiding this comment

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

same here. Legacy table can auto do line wrapping with additional setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the description.

// last element is _scrore if there is wrapping this field won't be present
// So we check for the presence of the _score element in the legacy table

cy.get('.euiDescriptionList__title').should('contain.text', '_score');
Copy link
Member

Choose a reason for hiding this comment

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

nice test

});
});

describe('maxHeight With No truncation', () => {
Copy link
Member

Choose a reason for hiding this comment

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

might be cleaner if put maxHeight With No truncation and maxHeight With truncation together.

describe('maxHeight truncation behavior', () => {

  it('checks if the table respects maxHeight setting with truncation', function () {
    cy.setAdvancedSetting({
      'truncate:maxHeight': 130,
    });
    cy.get('.truncate-by-height')
      .first()
      .should('have.css', 'max-height', '130px');
  });

  it('checks if the table respects maxHeight setting without truncation', function () {
    cy.setAdvancedSetting({
      'truncate:maxHeight': 0,
    });
    cy.get('.truncate-by-height')
      .first()
      .should('not.have.css', 'max-height', '130px');
  });
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consolidated both the tests into one.

cy.get('[data-test-subj="dataGridRowCell"]')
.first()
.invoke('height')
.should('be.gt', res); // Check if the new height is greater than previus height
Copy link
Member

Choose a reason for hiding this comment

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

smart test. love it.

Copy link
Member

Choose a reason for hiding this comment

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

Does this test include all table related issues? Cuz I see you only mentioned on in the description about multi document but it seems to me that this test file has covered at least two issues. It is better to include all of them in the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the tests related to the table will be housed within this file. This PR only covers the tests corresponding to opensearch-project/OpenSearch-Dashboards#6280. There will be follow up PR addressing other table related issues.

Copy link
Member

@SuZhou-Joe SuZhou-Joe left a comment

Choose a reason for hiding this comment

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

Seems the new added test cases failed to pass, please take a look here.

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
@LDrago27
Copy link
Contributor Author

@SuZhou-Joe I have updated the tests to fix the failures. The newly added tests are now passing for both with and without security enabled.

@SuZhou-Joe
Copy link
Member

@LDrago27 Thanks for addressing all the failed cases.

@SuZhou-Joe SuZhou-Joe merged commit a964ed8 into opensearch-project:main Apr 30, 2024
37 of 41 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 30, 2024
Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
(cherry picked from commit a964ed8)
SuZhou-Joe pushed a commit that referenced this pull request Apr 30, 2024
Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
(cherry picked from commit a964ed8)

Co-authored-by: Suchit Sahoo <38322563+LDrago27@users.noreply.github.com>
LDrago27 added a commit to LDrago27/opensearch-dashboards-functional-test that referenced this pull request May 3, 2024
Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
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.

4 participants