Skip to content

Commit

Permalink
fix cypress tests after changing the default values (#82) (#83)
Browse files Browse the repository at this point in the history
(cherry picked from commit a656fc2)

Signed-off-by: Chenyang Ji <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7a8a4c4 commit f8036f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cypress/e2e/1_top_queries.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ describe('Query Insights Dashboard', () => {
* Validate sorting by the "Timestamp" column works correctly
*/
it('should sort the table by the Timestamp column', () => {
// waiting for the query insights queue to drain
cy.wait(10000);
cy.navigateToOverview();
// Click the Timestamp column header to sort
cy.get('.euiTableHeaderCell').contains('Timestamp').click();
// eslint-disable-next-line jest/valid-expect-in-promise
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/3_configurations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Query Insights Configurations Page', () => {
it('should allow updating the value of N (count)', () => {
toggleMetricEnabled();
// Locate the input for N
cy.get('input[type="number"]').should('have.attr', 'value', '3'); // Default 3
cy.get('input[type="number"]').should('have.attr', 'value', '10'); // Default 10
// Change the value to 50
cy.get('input[type="number"]').first().clear().type('50').should('have.value', '50');
// Validate invalid input
Expand All @@ -114,6 +114,7 @@ describe('Query Insights Configurations Page', () => {
toggleMetricEnabled();
// Validate default values
cy.get('select#timeUnit').should('have.value', 'MINUTES'); // Default unit is "Minute(s)"
cy.get('select#minutes').should('have.value', '5');
// Test valid time unit selection
cy.get('select#timeUnit').select('HOURS').should('have.value', 'HOURS');
cy.get('select#timeUnit').select('MINUTES').should('have.value', 'MINUTES');
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/4_group_details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
*/

import sampleDocument from '../fixtures/sample_document.json';
import { METRICS } from '../support/constants';

const indexName = 'sample_index';

const clearAll = () => {
cy.deleteIndexByName(indexName);
cy.disableTopQueries(METRICS.LATENCY);
cy.disableTopQueries(METRICS.CPU);
cy.disableTopQueries(METRICS.MEMORY);
cy.disableGrouping();
};

describe('Query Group Details Page', () => {
beforeEach(() => {
clearAll();
cy.createIndexByName(indexName, sampleDocument);
cy.enableTopQueries(METRICS.LATENCY);
cy.enableGrouping();
cy.searchOnIndex(indexName);
cy.searchOnIndex(indexName);
Expand Down

0 comments on commit f8036f6

Please sign in to comment.