Skip to content

Commit

Permalink
Merge branch '2.10' of github.com:opensearch-project/opensearch-dashb…
Browse files Browse the repository at this point in the history
…oards-functional-test into fix-reporting

Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Sep 19, 2023
2 parents 3400ef9 + faa6dbb commit 29e9b0b
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 67 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"MANAGED_SERVICE_ENDPOINT": false,
"VISBUILDER_ENABLED": true,
"DATASOURCE_MANAGEMENT_ENABLED": false,
"ML_COMMONS_DASHBOARDS_ENABLED": true
"ML_COMMONS_DASHBOARDS_ENABLED": true,
"WAIT_FOR_LOADER_BUFFER_MS": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ if (Cypress.env('VISBUILDER_ENABLED')) {
// Save and return
cy.getElementByTestId('visBuilderSaveAndReturnButton').click();

cy.getElementByTestId('visualizationLoader').should(
cy.getElementByTestId('visBuilderLoader').should(
'contain.text',
newLabel
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,30 @@ describe('CompositeLevelMonitor', () => {
cy.get('[data-test-subj="visualEditorRadioCard"]').click({ force: true });

// Wait for input to load and then type in the monitor name
cy.get('input[name="name"]').type(SAMPLE_VISUAL_EDITOR_MONITOR);
cy.get('input[name="name"]').type(SAMPLE_VISUAL_EDITOR_MONITOR, {
force: true,
});

// Select associated monitors
cy.get('[data-test-subj="monitors_list_0"]').type('monitorOne', {
cy.get('[id="associatedMonitorsList_0"]').type('monitorOne', {
delay: 50,
force: true,
});
cy.get('[title="monitorOne"]').click({ force: true });

cy.get('[data-test-subj="monitors_list_1"]').type('monitorTwo', {
cy.get('[id="associatedMonitorsList_1"]').type('monitorTwo', {
delay: 50,
force: true,
});
cy.get('[title="monitorTwo"]').click({ force: true });

cy.get('button').contains('Add trigger').click({ force: true });

// Type trigger name
cy.get('[data-test-subj="composite-trigger-name"]')
.type('{selectall}')
.type('{backspace}')
.type('Composite trigger');
.type('{selectall}', { force: true })
.type('{backspace}', { force: true })
.type('Composite trigger', { force: true });

cy.intercept('api/alerting/workflows').as('createMonitorRequest');
cy.intercept(`api/alerting/monitors?*`).as('getMonitorsRequest');
Expand Down Expand Up @@ -159,8 +163,9 @@ describe('CompositeLevelMonitor', () => {

cy.get('button').contains('Add another monitor').click({ force: true });

cy.get('[data-test-subj="monitors_list_2"]').type('monitorThree', {
cy.get('[id="associatedMonitorsList_2"]').type('monitorThree', {
delay: 50,
force: true,
});
cy.get('[title="monitorThree"]').click({ force: true });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ describe('Indices', () => {
});

describe('can search with reindex & recovery status', () => {
const reindexedIndex =
'reindex_opensearch_dashboards_sample_data_ecommerce';
const reindexedIndex = 'reindex_sample_data_ecommerce';
const splittedIndex = 'split_opensearch_dashboards_sample_data_logs';
before(() => {
cy.deleteAllIndices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ describe('Testing dashboard table', () => {
});

it('Redirects to traces table with filter', () => {
cy.get('.euiLink').contains('13').click();
cy.get('[data-test-subj="dashboard-table-traces-button"]')
.contains('13')
.click();
cy.wait(delayTime);

cy.contains(' (13)').should('exist');
Expand Down Expand Up @@ -107,7 +109,9 @@ describe('Testing plots', () => {

it('Renders service map', () => {
// plotly scale texts are in attribute "data-unformatted"
cy.get('text.ytitle[data-unformatted="Latency (ms)"]').should('exist');
cy.get('text.ytitle[data-unformatted="Average duration (ms)"]').should(
'exist'
);
cy.get('text[data-unformatted="200"]').should('exist');
cy.get('.vis-network').should('exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@
import {
PANEL_DELAY as delay,
TEST_PANEL,
PPL_VISUALIZATIONS,
PPL_VISUALIZATIONS_NAMES,
supressResizeObserverIssue,
BASE_PATH,
} from '../../../utils/constants';

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

const moveToPanelHome = () => {
cy.visit(`${BASE_PATH}/app/observability-dashboards#`);
cy.wait(delay * 3);
Expand All @@ -35,40 +27,6 @@ const moveToTestPanel = () => {
cy.wait(delay);
};

describe('Creating visualizations', () => {
beforeEach(() => {
moveToEventsHome();
});

it('Create first visualization in event analytics', () => {
cy.get('[id^=autocomplete-textarea]').focus().type(PPL_VISUALIZATIONS[0], {
delay: 50,
});
cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click();
cy.wait(delay);
supressResizeObserverIssue();
cy.get('button[id="main-content-vis"]')
.contains('Visualizations')
.trigger('mouseover')
.click();
cy.wait(delay * 2);
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]')
.trigger('mouseover')
.click();
cy.wait(1000);
cy.get('[data-test-subj="eventExplorer__querySaveName"]')
.focus()
.type(PPL_VISUALIZATIONS_NAMES[0], {
delay: 50,
});
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]')
.trigger('mouseover')
.click();
cy.wait(delay);
cy.get('.euiToastHeader__title').contains('successfully').should('exist');
});
});

describe('Testing panels table', () => {
beforeEach(() => {
moveToPanelHome();
Expand Down Expand Up @@ -112,6 +70,7 @@ describe('Testing panels table', () => {
});

it('Deletes panels', () => {
cy.get('.panel-header-count').contains('(2)');
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]')
.trigger('mouseover')
.click();
Expand Down Expand Up @@ -166,6 +125,7 @@ describe('Testing a panel', () => {
});
cy.get('.euiLink').contains('This year').trigger('mouseover').click();
cy.wait(delay * 2);
moveToTestPanel();
cy.get(
'.euiSuperDatePicker__prettyFormat[data-test-subj="superDatePickerShowDatesButton"]'
)
Expand Down
2 changes: 1 addition & 1 deletion cypress/utils/dashboards/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Cypress.Commands.add('waitForLoader', () => {
displayName: 'wait',
message: 'page load',
});

cy.wait(Cypress.env('WAIT_FOR_LOADER_BUFFER_MS'));
cy.getElementByTestId('homeIcon', opts); // Update to `homeLoader` once useExpandedHeader is enabled
});

Expand Down
5 changes: 1 addition & 4 deletions cypress/utils/plugins/observability-dashboards/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
timeout: TIMEOUT_DELAY,
}).click();
cy.get('.euiQuickSelect__applyButton').click();
cy.get('.euiSuperDatePicker__prettyFormatLink').click();
cy.get(
'button.euiDatePopoverButton--start[data-test-subj="superDatePickerstartDatePopoverButton"]'
).click();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').click();
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]', {
timeout: TIMEOUT_DELAY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ Cypress.Commands.add(
Cypress.log({
message: `Wait for url: ${fullUrl} to be loaded.`,
});
cy.url({ timeout: timeout })
.should('include', fullUrl)
.then(() => {
contains && cy.contains(contains).should('be.visible');
});
cy.url({ timeout: timeout }).then(() => {
contains && cy.contains(contains).should('be.visible');
});
}
);

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"cypress:open": "cypress open",
"cypress:run-without-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=false",
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200",
"cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true",
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=3000",
"cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=3000",
"cypress:run-plugin-tests-without-security": "yarn cypress:run-without-security --spec 'cypress/integration/plugins/*/*.js'",
"cypress:run-plugin-tests-with-security": "yarn cypress:run-with-security --spec 'cypress/integration/plugins/*/*.js'",
"cypress:release-chrome": "yarn cypress:run-with-security --browser chrome --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js,cypress/integration/plugins/*/*'",
Expand Down

0 comments on commit 29e9b0b

Please sign in to comment.