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

[Cypress Updates] Panels updates #2285

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions .cypress/integration/panels_test/panels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
delay: 50,
});
cy.get('.euiButton__text').contains('Run').trigger('mouseover').click();
cy.get('button[id="main-content-vis"]')

Check warning on line 51 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.contains('Visualizations')
.trigger('mouseover', { force: true })
.click({ force: true });
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]')

Check warning on line 55 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.trigger('mouseover')
.click({ force: true });
cy.get('[data-test-subj="eventExplorer__querySaveName"]')
Expand All @@ -72,7 +72,7 @@
// });
cy.get('[id^=autocomplete-textarea]').focus().invoke('val', PPL_VISUALIZATIONS[1]).trigger('input').trigger('change');
cy.get('.euiButton__text').contains('Run').trigger('mouseover').click();
cy.get('button[id="main-content-vis"]')

Check warning on line 75 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.contains('Visualizations')
.trigger('mouseover')
.click({ force: true });
Expand All @@ -96,7 +96,7 @@
it('Displays error toast for invalid panel name', () => {
clickCreatePanelButton();
confirmModal();
expectToastWith('Invalid Dashboard name');
expectToastWith('Invalid Dashboard Name');
});

it('Creates a panel and redirects to the panel', () => {
Expand All @@ -114,24 +114,31 @@
});

it('Duplicates a legacy panel', () => {
cy.get('[data-test-subj="breadcrumb last"]').click({ force: true }); //reload page

Check warning on line 117 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiTableRow').should('have.length', 1);
selectThePanel();
openActionsDropdown();
cy.get('button[data-test-subj="duplicateContextMenuItem"]').click();
cy.get('button[data-test-subj="runModalButton"]').click();
cy.get('[data-test-subj="breadcrumb"]').click({ force: true }); //Duplicate opens the panel, need to return

Check warning on line 123 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiTableRow').should('have.length', 2);
const duplicateName = TEST_PANEL + ' (copy)';
cy.contains(duplicateName).should('exist');
const duplicate = cy.get('.euiLink').contains(duplicateName);
expectUuid(duplicate);
cy.get('.euiLink')
.contains(duplicateName)
.should('exist')
.then(($anchorElem) => {
expectUuid(cy.wrap($anchorElem));
});
});

it('Renames the panel', () => {
cy.reload();
const cell = cy.get('.euiTableCellContent');
expectLegacyId(cell);
cy.get('.euiTableCellContent')
.should('exist')
.then(($anchorElem) => {
expectLegacyId(cy.wrap($anchorElem));
});
cy.get('.euiCheckbox__input[title="Select this row"]').first().click();
openActionsDropdown();
cy.get('button[data-test-subj="renameContextMenuItem"]').click();
Expand Down Expand Up @@ -179,7 +186,7 @@
beforeEach(() => {
createSavedObjectPanel();
moveToPanelHome();
cy.get('[data-test-subj="breadcrumb last"]').click({ force: true }); //reload page

Check warning on line 189 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiTableRow').should('have.length', 1);
});

Expand All @@ -189,11 +196,15 @@
cy.get('button[data-test-subj="duplicateContextMenuItem"]').click();
cy.get('button[data-test-subj="runModalButton"]').click();
const duplicateName = TEST_PANEL + ' (copy)';
cy.get('[data-test-subj="breadcrumb"]').click({ force: true }); //reload page

Check warning on line 199 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiTableRow').should('have.length', 2);
cy.contains(duplicateName).should('exist');
const duplicate = cy.get('.euiLink').contains(duplicateName);
expectUuid(duplicate);
cy.get('.euiLink')
.contains(duplicateName)
.should('exist')
.then(($anchorElem) => {
expectUuid(cy.wrap($anchorElem));
});
});

it('Renames a saved-objects panel', () => {
Expand All @@ -209,11 +220,11 @@
cy.get('a[data-test-subj="breadcrumb last"]').click(); //refresh so panel appears
cy.get('input[data-test-subj="checkboxSelectAll"]').click();
openActionsDropdown();
cy.get('button[data-test-subj="deleteContextMenuItem"]').click({ force: true });

Check warning on line 223 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('button[data-test-subj="popoverModal__deleteButton"]').should('be.disabled');
cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete');
cy.get('button[data-test-subj="popoverModal__deleteButton"]').should('not.be.disabled');
cy.get('button[data-test-subj="popoverModal__deleteButton"]').click({ force: true });

Check warning on line 227 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('h2[data-test-subj="customPanels__noPanelsHome"]').should('exist');
});

Expand All @@ -227,11 +238,10 @@
it('Redirects to observability dashboard from OSD dashboards with edit', () => {
moveToOsdDashboards();
cy.location('pathname').should('eq', '/app/dashboards');
cy.get('[data-test-subj="dashboardListingTitleLink-Test-Panel"]')
.closest('tr')
.get('span.euiToolTipAnchor > button.euiButtonIcon')
cy.get('[data-test-subj="dashboardEditBtn"]')
.eq(0)
.click();
cy.get('[data-test-subj="dashboardEditDashboard"]').click();
cy.location('pathname').should('eq', '/app/observability-dashboards');
cy.location('hash').should('include', '/edit');
});
Expand Down Expand Up @@ -292,7 +302,7 @@

it('Rename the open panel', () => {
cy.then(function () {
cy.get('[data-test-subj="breadcrumb"]').click({ force: true });

Check warning on line 305 in .cypress/integration/panels_test/panels.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('input[data-test-subj="operationalPanelSearchBar"]')
.focus()
.type(this.thePanel.attributes.title);
Expand Down Expand Up @@ -775,7 +785,7 @@
.then((response) => response.body);
};

const addVisualizationsToPanel = (panel, additionalVisualizationIds: string[]) => {
const addVisualizationsToPanel = (panel, additionalVisualizationIds) => {
const additionalVisualizations = additionalVisualizationIds.map((id, idx) => {
return {
savedVisualizationId: `observability-visualization:${id}`,
Expand Down Expand Up @@ -849,7 +859,7 @@
};

const createLegacyPanel = (newName = TEST_PANEL) => {
const result = cy.request({
cy.request({
method: 'POST',
failOnStatusCode: false,
url: 'api/observability/operational_panels/panels',
Expand Down
Loading