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 cypress tests for discover 2.0 #1598

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abbyhu2000
Copy link
Member

Description

Add two test files to test on discover 2.0 functionalities.

  • queries
  • dataset navigator

Issues Resolved

[List any issues this PR will resolve]

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.

Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
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.

Overall i love the tests. A few coments and concerns. Let me know what you think of them

Comment on lines +59 to +63
cy.get(`[class~="datasetSelector__button"]`).click();
cy.get(`[class~="datasetSelector__advancedButton"]`).click();
cy.get(`[title="Indexes"]`).click();
cy.get(`[title="Default Cluster"]`).click();
cy.get(`[title="logstash-2015.09.20"]`).click();
Copy link
Member

Choose a reason for hiding this comment

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

We should use a test ID here. This will be flakey otherwise

Comment on lines +77 to +80
cy.getElementByTestId('queryEditorLanguageSelector').should(
'contain',
'SQL'
);
Copy link
Member

Choose a reason for hiding this comment

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

This will be flakey unless we can set this before hand right?

Comment on lines +82 to +85
// The following steps are needed because when selecting SQL, discover loaded with data but the
// multi-line query editor are not loaded properly(it renders a single line query bar) unless we select SQL again
// This bug only exist in cypress test; can not reproduce manually
cy.get(`[data-test-subj="queryEditorLanguageSelector"]`).click();
Copy link
Member

Choose a reason for hiding this comment

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

Will a wait help?

'contain',
'Step 2: Configure data'
);
// should have two options: SQL and PPL; PPL should be selected
Copy link
Member

Choose a reason for hiding this comment

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

How do we ensure this? Wont this be flakey?

Copy link
Member Author

Choose a reason for hiding this comment

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

yea it prob be flaky. Will change to click PPL as a option

);
});

it('with SQL as default language', function () {
Copy link
Member

Choose a reason for hiding this comment

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

Lets be more specific about what this test is doing

`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);

cy.get(`[class~="datasetSelector__button"]`).click();
Copy link
Member

Choose a reason for hiding this comment

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

If there are index patterns, the default index pattern should be selected by default. We should not have to select it

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea when i tried it manually, the default index pattern will be picked up by default; but somehow in the test, it wont. @ashwin-pc

cy.waitForSearch();
cy.verifyHitCount(119);

//query should persist across refresh
Copy link
Member

Choose a reason for hiding this comment

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

Nice

@@ -34,6 +34,7 @@
"osd:ciGroup7": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/doc_navigation.spec.js,apps/data_explorer/doc_table.spec.js,apps/data_explorer/errors.spec.js,apps/data_explorer/field_data.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup8": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/field_visualize.spec.js,apps/data_explorer/filter_editor.spec.js,apps/data_explorer/index_pattern_with_encoded_id.spec.js,apps/data_explorer/index_pattern_without_field.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup9": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/inspector.spec.js,apps/data_explorer/large_string.spec.js,apps/data_explorer/saved_queries.spec.js,apps/data_explorer/shared_links.spec.js,apps/data_explorer/sidebar.spec.js,apps/data_explorer/source_filter.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup10": "echo apps/query_enhancement/*.js",
Copy link
Member

Choose a reason for hiding this comment

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

Wont this require all the YAML settings and Advanced settings for this view to be set correctly?

Copy link
Member Author

Choose a reason for hiding this comment

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

what do you mean by this?

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.

2 participants