-
Notifications
You must be signed in to change notification settings - Fork 99
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
Modularize and cleanup panel #603
Changes from all commits
b5d6def
5c678b4
dbd046e
354fe56
26543df
85f9e99
dbe358e
58f4730
53dcf74
5d26ed9
0bf4ab3
9a2303c
ef962d2
6e1f9ff
dba0f56
b1a264f
fe540cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,14 @@ import { | |
trace_one, | ||
trace_two, | ||
trace_three, | ||
spanQueryPartOne, | ||
spanQueryPartTwo, | ||
spanQueryPartThree, | ||
visName, | ||
spanQueryOnePartOne, | ||
spanQueryOnePartTwo, | ||
spanQueryOnePartThree, | ||
spanQueryTwoPartOne, | ||
spanQueryTwoPartTwo, | ||
spanQueryTwoPartThree, | ||
visOneName, | ||
visTwoName, | ||
composition, | ||
newName, | ||
} from '../utils/app_constants'; | ||
|
@@ -95,10 +99,24 @@ describe('Creating application', () => { | |
cy.get('.euiBadge').contains('2').should('exist'); | ||
cy.get('.euiButton').contains('Create').should('not.be.disabled'); | ||
cy.get('.euiButton').contains('Create').click(); | ||
cy.wait(delay); | ||
cy.wait(delay*3); | ||
cy.get('.euiTitle').contains(nameOne).should('exist'); | ||
cy.get('.euiTab').contains('Panel').click(); | ||
cy.get('.euiText').contains('Start by adding metrics').should('exist'); | ||
cy.get('.euiText').contains('Start by adding your first visualization').should('exist'); | ||
}); | ||
|
||
it('Hides application panels in Operational Panels', () => { | ||
cy.visit( | ||
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/` | ||
); | ||
cy.wait(delay*4); | ||
if (cy.get('.euiButton').contains('Create panel').length < 2) { | ||
cy.get('input.euiFieldSearch').type(`${nameOne}'s Panel`); | ||
cy.wait(delay); | ||
cy.get('.euiTableCellContent__text').contains('No items found').should('exist'); | ||
cy.get('.euiFormControlLayoutClearButton').click(); | ||
cy.wait(delay); | ||
} | ||
}); | ||
|
||
it('Redirects to home page on cancel', () => { | ||
|
@@ -276,6 +294,7 @@ describe('Viewing application', () => { | |
|
||
it('Opens span detail flyout when Span ID is clicked', () => { | ||
cy.get('.euiTab').contains('Traces & Spans').click(); | ||
supressResizeObserverIssue(); | ||
cy.wait(delay); | ||
cy.get('.euiLink').contains('5ff3516909562c60').click(); | ||
cy.get('.euiFlyout').contains('Span detail').should('be.visible'); | ||
|
@@ -296,36 +315,38 @@ describe('Viewing application', () => { | |
cy.get('.euiBadge__text').contains('Base Query').should('exist'); | ||
}); | ||
|
||
it('Saves visualization to panel', () => { | ||
cy.get('.euiTab').contains('Log Events').click(); | ||
it('Saves visualization #1 to panel', () => { | ||
cy.get('.euiTab').contains('Panel').click(); | ||
cy.get('.euiButton').eq(3).contains('Add').click(); | ||
cy.wait(delay); | ||
cy.get('.plot-container').should('exist'); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').click(); | ||
cy.get('.aa-List').find('.aa-Item').should('have.length', 11); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type('x'); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').clear().wait(delay * 2).type(spanQueryPartOne); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryPartTwo); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryPartThree); | ||
changeTimeTo24('hours'); | ||
cy.get('.euiButton').contains('Refresh').click(); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').clear().wait(delay * 2).type(spanQueryOnePartOne); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryOnePartTwo); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryOnePartThree); | ||
changeTimeTo24('months'); | ||
cy.get('.euiTab').contains('Visualizations').click(); | ||
supressResizeObserverIssue(); | ||
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click(); | ||
cy.get('[data-test-subj="eventExplorer__querySaveName"]').click().type(visName); | ||
cy.get('[data-test-subj="eventExplorer__querySaveName"]').click().type(visOneName); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click(); | ||
cy.wait(delay); | ||
cy.get('.euiTab').contains('Panel').click(); | ||
cy.wait(delay); | ||
cy.get('.js-plotly-plot').should('exist'); | ||
}); | ||
|
||
it('Adds availability level to visualization', () => { | ||
it('Adds availability level to visualization #1', () => { | ||
cy.get('.euiTab').contains('Panel').click(); | ||
cy.wait(delay); | ||
cy.get('[aria-label="actionMenuButton"]').click(); | ||
cy.get('.euiContextMenuItem').contains('Edit').click(); | ||
supressResizeObserverIssue(); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 hours'); | ||
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will this test work when it's 2024? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The year 2024?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do the sample logs not get updated every time the cypress tests run?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it's using dashboards sample data then should be ok, if using the trace data then no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of the tests with time range changes are using dashboards sample data with logs so I think it should be okay. |
||
cy.get('.euiBadge').contains('Bar').click(); | ||
cy.focused().type('{downArrow}'); | ||
cy.focused().type('{enter}'); | ||
|
@@ -346,14 +367,152 @@ describe('Viewing application', () => { | |
cy.wait(delay); | ||
cy.get('.js-plotly-plot').should('exist'); | ||
cy.get('.textpoint').contains('Available').should('exist'); | ||
cy.get('.euiBreadcrumb').contains('Application analytics').click(); | ||
cy.wait(delay); | ||
cy.get('.euiBadge').contains('Available').should('exist'); | ||
cy.get('[style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('exist'); | ||
}); | ||
|
||
it('Saves visualization #2 to panel with availability level', () => { | ||
moveToApplication(nameOne); | ||
changeTimeTo24('months'); | ||
cy.get('.euiTab').contains('Log Events').click(); | ||
cy.wait(delay); | ||
cy.get('.plot-container').should('exist'); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').clear(); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type('x'); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').clear().wait(delay * 2).type(spanQueryTwoPartOne); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryTwoPartTwo); | ||
cy.get('[data-test-subj="searchAutocompleteTextArea"]').wait(delay * 2).type(spanQueryTwoPartThree); | ||
cy.get('.euiButton').contains('Refresh').click(); | ||
cy.wait(delay); | ||
cy.get('.euiTab').contains('Visualizations').click(); | ||
supressResizeObserverIssue(); | ||
cy.get('.euiBadge').contains('Bar').click(); | ||
cy.focused().type('{downArrow}'); | ||
cy.focused().type('{enter}'); | ||
cy.wait(delay); | ||
cy.get('.euiButton').contains('+ Add availability level').click(); | ||
cy.get('[data-test-subj="colorPickerAnchor"]').click(); | ||
cy.get('[aria-label="Select #9170B8 as the color"]').click(); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="nameFieldText"]').click().type('Super'); | ||
cy.get('[data-test-subj="expressionSelect"]').select('<'); | ||
cy.get('[data-test-subj="valueFieldNumber"]').clear().type('5.5'); | ||
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click(); | ||
cy.wait(delay); | ||
cy.get('.euiButton').contains('+ Add availability level').click(); | ||
cy.get('[data-test-subj="colorPickerAnchor"]').first().click(); | ||
cy.get('[aria-label="Select #CA8EAE as the color"]').click(); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="nameFieldText"]').first().click().type('Cool'); | ||
cy.get('[data-test-subj="expressionSelect"]').first().select('>'); | ||
cy.get('[data-test-subj="valueFieldNumber"]').first().clear().type('0'); | ||
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click(); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click(); | ||
cy.get('[data-test-subj="eventExplorer__querySaveName"]').click().type(visTwoName); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click(); | ||
cy.wait(delay); | ||
cy.get('.euiTab').contains('Panel').click(); | ||
cy.wait(delay); | ||
cy.get('.js-plotly-plot').should('have.length', 2); | ||
moveToHomePage(); | ||
cy.get('.euiBadge').contains('Super').should('exist'); | ||
cy.get('[style="background-color: rgb(145, 112, 184); color: rgb(0, 0, 0);"]').should('exist'); | ||
}); | ||
|
||
it('Configuration tab shows details', () => { | ||
cy.get('.euiLink').contains(nameOne).click(); | ||
cy.wait(delay); | ||
cy.get('.euiTab').contains('Configuration').click(); | ||
cy.wait(delay); | ||
cy.get('.euiCodeBlock__code').contains(baseQuery).should('exist'); | ||
cy.get('[aria-label="List of services and entities"]').find('li').should('have.length', 1); | ||
cy.get('[aria-label="List of trace groups"]').find('li').should('have.length', 2); | ||
cy.get('option').should('have.length', 2); | ||
}); | ||
|
||
|
||
it('Changes availability visualization', () => { | ||
cy.get('.euiTab').contains('Configuration').click(); | ||
cy.wait(delay); | ||
cy.get('select').select(visOneName); | ||
cy.wait(delay); | ||
moveToHomePage(); | ||
cy.get('.euiBadge').contains('Available').should('exist'); | ||
cy.get('[style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('exist'); | ||
moveToApplication(nameOne); | ||
cy.get('.euiTab').contains('Configuration').click(); | ||
cy.wait(delay); | ||
cy.get('select').find('option:selected').should('have.text', visOneName); | ||
}) | ||
|
||
it('Hides application visualizations in Event Analytics', () => { | ||
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/event_analytics`); | ||
cy.wait(delay*3); | ||
if (cy.get('.euiFieldSearch').length > 1) { | ||
cy.get('input.euiFieldSearch').type(visOneName); | ||
cy.wait(delay); | ||
cy.get('.euiTableCellContent__text').contains('No items found').should('exist'); | ||
cy.get('input.euiFieldSearch').clear().type(visTwoName); | ||
cy.wait(delay); | ||
cy.get('.euiTableCellContent__text').contains('No items found').should('exist'); | ||
cy.get('.euiFormControlLayoutClearButton').click(); | ||
cy.wait(delay); | ||
cy.get('[data-test-subj="tablePaginationPopoverButton"]').click(); | ||
cy.get('.euiContextMenuItem__text').contains('50 rows').click(); | ||
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]').click(); | ||
cy.wait(delay); | ||
cy.get('.euiButton__text').contains('Actions').click(); | ||
cy.wait(delay); | ||
cy.get('.euiContextMenuItem__text').contains('Delete').click(); | ||
cy.wait(delay); | ||
|
||
cy.get('button.euiButton--danger').should('be.disabled'); | ||
|
||
cy.get('input.euiFieldText[placeholder="delete"]').type('delete'); | ||
cy.get('button.euiButton--danger').should('not.be.disabled'); | ||
cy.get('.euiButton__text').contains('Delete').click(); | ||
cy.wait(delay); | ||
} | ||
}); | ||
|
||
it('Hides application visualizations in Operational Panels', () => { | ||
cy.visit( | ||
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/` | ||
); | ||
cy.wait(delay*3); | ||
cy.get('.euiButton__text').contains('Actions').click(); | ||
cy.wait(delay); | ||
cy.get('.euiContextMenuItem__text').contains('Add samples').click(); | ||
cy.wait(delay); | ||
cy.get('.euiButton__text').contains('Yes').click(); | ||
cy.wait(delay*2); | ||
cy.get('.euiLink').contains('[Logs] Web traffic Panel').first().click(); | ||
cy.wait(delay); | ||
cy.get('.euiButton__text').contains('Add visualization').click(); | ||
cy.get('.euiContextMenuItem__text').contains('Select existing visualization').click(); | ||
cy.get('option').contains(visOneName).should('not.exist'); | ||
cy.get('option').contains(visTwoName).should('not.exist'); | ||
cy.visit( | ||
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/` | ||
); | ||
cy.wait(delay*3); | ||
cy.get('input.euiFieldSearch').type('[Logs] Web traffic Panel'); | ||
cy.wait(delay); | ||
cy.get('.euiTableRow').first().within(($row) => { | ||
cy.get('.euiCheckbox').click(); | ||
}); | ||
cy.get('.euiButton__text').contains('Actions').click(); | ||
cy.wait(delay); | ||
cy.get('.euiContextMenuItem__text').contains('Delete').click(); | ||
cy.wait(delay); | ||
cy.get('input.euiFieldText[placeholder="delete"]').type('delete'); | ||
cy.get('button.euiButton--danger').should('not.be.disabled'); | ||
cy.get('.euiButton__text').contains('Delete').click(); | ||
cy.wait(delay); | ||
}); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np but might be better to loop over array, also why does this need to be split into 3 parts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was finding that cypress would mistype it if it was just one long string, if I split it up and start at the parts where it was missing it works. 🦺
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, this is ok but you can also just pass the whole string and use a separate function to split by fixed length and feed to cypress.type()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea the only problem is cypress would repeatedly miss certain characters so I had to split the string at those places not at a fixed length