Skip to content

Commit

Permalink
Panel table fixes (#406) (#409)
Browse files Browse the repository at this point in the history
* Fix Panel View (legacy)
  - Duplicate
  - Rename
  - Delete

---------

Signed-off-by: Peter Fitzgibbons <[email protected]>
Co-authored-by: Peter Fitzgibbons <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <[email protected]>
Co-authored-by: Shenoy Pratik <[email protected]>
(cherry picked from commit bac5746)

Co-authored-by: Peter Fitzgibbons <[email protected]>
  • Loading branch information
1 parent 72def7d commit 080f7f7
Show file tree
Hide file tree
Showing 9 changed files with 3,562 additions and 3,459 deletions.
77 changes: 38 additions & 39 deletions .cypress/integration/3_panels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ describe('Testing panels table', () => {
moveToPanelHome();
});

it('Displays error toast for invalid panel name', () => {
it.skip('Displays error toast for invalid panel name', () => {
clickCreatePanelButton();
confirmModal();
expectToastWith('Invalid Operational Panel name');
expectToastWith('Invalid Dashboard name');
});

it('Creates a panel and redirects to the panel', () => {
Expand Down Expand Up @@ -147,6 +147,37 @@ describe('Testing panels table', () => {
cy.get('button[data-test-subj="popoverModal__deleteButton"]').click();
cy.get('h2[data-test-subj="customPanels__noPanelsHome"]').should('exist');
});

it('Searches panels', () => {
createLegacyPanel('Legacy Named');
createSavedObjectPanel('Saved Object');
cy.reload();
cy.get('input[data-test-subj="operationalPanelSearchBar"]')
.focus()
.type('this panel should not exist', {
delay: 50,
});

cy.get('.euiTableCellContent__text').contains('No items found').should('exist');

// Search for oriignal Legacy Panel
cy.get('[aria-label="Clear input"]').click();
cy.get('input[data-test-subj="operationalPanelSearchBar"]').focus().type(TEST_PANEL, {
delay: 50,
});

cy.get('a.euiLink').contains(TEST_PANEL).should('exist');
cy.get('.euiTableRow').should('have.length', 1);

// Search for teh Saved Object panel
cy.get('[aria-label="Clear input"]').click();
cy.get('input[data-test-subj="operationalPanelSearchBar"]').focus().type('Saved Object', {
delay: 50,
});

cy.get('a.euiLink').contains('Saved Object').should('exist');
cy.get('.euiTableRow').should('have.length', 1);
});
});

describe('with a SavedObjects Panel', () => {
Expand Down Expand Up @@ -221,38 +252,6 @@ describe('Testing panels table', () => {
cy.location('hash').should('include', '/create');
});
});

it('Searches existing panel', () => {
createLegacyPanel();
cy.get('input[data-test-subj="operationalPanelSearchBar"]')
.focus()
.type('this panel should not exist', {
delay: 50,
});

cy.get('.euiTableCellContent__text').contains('No items found').should('exist');

cy.get('[aria-label="Clear input"]').click();
cy.get('input[data-test-subj="operationalPanelSearchBar"]')
.focus()
.type(TEST_PANEL + ' (copy) (rename)', {
delay: 50,
});

cy.get('a.euiLink')
.contains(TEST_PANEL + ' (copy) (rename)')
.should('exist');
});

it('Create a panel for testing', () => {
moveToPanelHome();
// keep a panel for testing
clickCreatePanelButton();
cy.get('input.euiFieldText').focus().type(TEST_PANEL, {
delay: 50,
});
cy.get('button[data-test-subj="runModalButton"]').click();
});
});

describe('Testing a panel', () => {
Expand Down Expand Up @@ -567,7 +566,7 @@ const moveToOsdDashboards = () => {

const moveToEventsHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-logs#/`);
cy.wait(delay * 3);
cy.wait(6000);
};

const moveToPanelHome = () => {
Expand Down Expand Up @@ -651,7 +650,7 @@ const uuidRx =
const clickCreatePanelButton = () =>
cy.get('a[data-test-subj="customPanels__createNewPanels"]').click();

const createSavedObjectPanel = () => {
const createSavedObjectPanel = (newName = TEST_PANEL) => {
const result = cy
.request({
method: 'POST',
Expand All @@ -663,7 +662,7 @@ const createSavedObjectPanel = () => {
},
body: {
attributes: {
title: TEST_PANEL,
title: newName,
description: '',
dateCreated: 1681127334085,
dateModified: 1681127334085,
Expand All @@ -683,7 +682,7 @@ const createSavedObjectPanel = () => {
.then((response) => console.log(response));
};

const createLegacyPanel = () => {
const createLegacyPanel = (newName = TEST_PANEL) => {
const result = cy.request({
method: 'POST',
failOnStatusCode: false,
Expand All @@ -692,7 +691,7 @@ const createLegacyPanel = () => {
'content-type': 'application/json;charset=UTF-8',
'osd-xsrf': true,
},
body: { panelName: TEST_PANEL },
body: { panelName: newName },
});
};

Expand Down
Loading

0 comments on commit 080f7f7

Please sign in to comment.