Skip to content

Commit

Permalink
remove tab tests
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <[email protected]>
  • Loading branch information
mengweieric committed Dec 21, 2023
1 parent f31d969 commit 0c91112
Showing 1 changed file with 18 additions and 87 deletions.
105 changes: 18 additions & 87 deletions .cypress/integration/event_analytics_test/event_analytics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

/// <reference types="cypress" />
import {
delay,
TEST_QUERIES,
TESTING_PANEL,
SAVE_QUERY1,
Expand All @@ -23,9 +22,9 @@ import {
VIS_TYPE_PIE,
VIS_TYPE_VBAR,
FIELD_HOST,
FIELD_AGENT
FIELD_AGENT,
} from '../../utils/event_analytics/constants';
import { suppressResizeObserverIssue, COMMAND_TIMEOUT_LONG } from '../../utils/constants';
import { COMMAND_TIMEOUT_LONG } from '../../utils/constants';

import {
querySearch,
Expand All @@ -48,7 +47,9 @@ describe('Adding sample data and visualization', () => {
describe('Has working breadcrumbs', () => {
it('Redirect to correct page on breadcrumb click', () => {
landOnEventExplorer();
cy.get('.euiBreadcrumb[href="observability-logs#/"]').click(), { timeout: COMMAND_TIMEOUT_LONG };
cy.get('.euiBreadcrumb[href="observability-logs#/"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();
cy.get('.euiTitle').contains('Logs').should('exist');
});
});
Expand All @@ -65,9 +66,9 @@ describe('Search a query on event home', () => {
.its('store')
.invoke('getState')
.then((state) => {
expect(Object.values(state.queries)[0]['rawQuery'].trim()).equal(TEST_QUERIES[0].query);
expect(Object.values(state.queries)[0]['selectedDateRange'][0]).equal('now/y');
expect(Object.values(state.queries)[0]['selectedDateRange'][1]).equal('now');
expect(Object.values(state.queries)[0].rawQuery.trim()).equal(TEST_QUERIES[0].query);
expect(Object.values(state.queries)[0].selectedDateRange[0]).equal('now/y');
expect(Object.values(state.queries)[0].selectedDateRange[1]).equal('now');
});

cy.url().should('contain', '#/explorer');
Expand Down Expand Up @@ -108,82 +109,6 @@ describe('Open flyout for a data row to see details', () => {
});
});

// skip for now due to tab removals
describe.skip('Add/delete/switch explorer top level tabs', () => {
beforeEach(() => {
landOnEventExplorer();
});

it('Add a new tab', () => {
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.then((lists) => {
const initialLength = Cypress.$(lists).length;
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.should('have.length', initialLength + 1);
});
});

it('Click to switch to anther tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.first()
.click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.first()
.should('have.class', 'euiTab-isSelected');
});

it('Close a tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.then((lists) => {
const initialLength = Cypress.$(lists).length;
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"] button.euiTab')
.first()
.find('[data-test-subj="eventExplorer__tabClose"]')
.click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.should('have.length', initialLength - 1);
});
});

it('Close current selected tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.then((lists) => {
const initialLength = Cypress.$(lists).length;
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"] button.euiTab').eq(1).click();
cy.get('button.euiTab-isSelected [data-test-subj="eventExplorer__tabClose"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.should('have.length', initialLength - 1);
});
});

it('Close another unselected tab', () => {
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__addNewTab"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.then((lists) => {
const initialLength = Cypress.$(lists).length;
cy.get('button.euiTab').first().find('[data-test-subj="eventExplorer__tabClose"]').click();
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
.find('button.euiTab')
.should('have.length', initialLength - 1);
});
});
});

describe('Click actions test', () => {
beforeEach(() => {
landOnEventHome();
Expand Down Expand Up @@ -257,7 +182,9 @@ describe('Saves a query on explorer page', () => {
cy.get('.tab-title').contains('Events').click();
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
cy.get('[data-test-subj="eventExplorer__querySaveName"]').type(SAVE_QUERY1);
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]', { timeout: COMMAND_TIMEOUT_LONG }).click();
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();

cy.get('.euiToastHeader__title', { timeout: COMMAND_TIMEOUT_LONG })
.contains('successfully')
Expand All @@ -275,7 +202,9 @@ describe('Saves a query on explorer page', () => {
cy.get('.tab-title').contains('Events').click();
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
cy.get('[data-test-subj="eventExplorer__querySaveName"]').type(SAVE_QUERY4);
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]', { timeout: COMMAND_TIMEOUT_LONG }).click();
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();
cy.get('.euiToastHeader__title', { timeout: COMMAND_TIMEOUT_LONG })
.contains('successfully')
.should('exist');
Expand Down Expand Up @@ -521,11 +450,13 @@ describe('Visualizing data', () => {
.type(FIELD_AGENT);
cy.get(`input[value="${FIELD_AGENT}"]`).click();
cy.get('[data-test-subj="panelCloseBtn"]').click();
cy.get('[data-test-subj="visualizeEditorRenderButton"]', { timeout: COMMAND_TIMEOUT_LONG }).click();
cy.get('[data-test-subj="visualizeEditorRenderButton"]', {
timeout: COMMAND_TIMEOUT_LONG,
}).click();

cy.get('.infolayer .legendtext').as('legandTxt');
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_1);
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_2);
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_3);
});
});
});

0 comments on commit 0c91112

Please sign in to comment.