Skip to content

Commit

Permalink
Merge branch 'opensearch-project:main' into cypress-run-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AWSHurneyt authored Sep 19, 2024
2 parents 5856444 + 6dbdc2e commit f5910a0
Show file tree
Hide file tree
Showing 90 changed files with 1,086 additions and 1,902 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ jobs:
command: yarn run cypress run

# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: OpenSearch-Dashboards/plugins/alerting-dashboards-plugin/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
asset_path: ${{ steps.build_zip.outputs.zip_path }}
asset_content_type: application/zip
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: alerting-plugin
path: ${{ steps.build_zip.outputs.zip_path }}
8 changes: 4 additions & 4 deletions cypress/integration/bucket_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ describe('Bucket-Level Monitors', () => {
// Add a trigger
addTriggerToVisualEditorMonitor(SAMPLE_TRIGGER, 0, SAMPLE_ACTION, true);

// Click update button to save monitor changes
cy.get('button').contains('Update').last().click({ force: true });
// Click save to save monitor changes
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down Expand Up @@ -375,8 +375,8 @@ describe('Bucket-Level Monitors', () => {
timeout: 25000,
});

// Click the update button
cy.get('button').contains('Update').last().click({ force: true });
// Click the save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 20000 });
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/cluster_metrics_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ describe('ClusterMetricsMonitor', () => {
'ctx.results[0].number_of_pending_tasks >= 0'
);

// Click update button to save monitor changes
cy.get('button').contains('Update').last().click({ force: true });
// Click save button to save monitor changes
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down
7 changes: 4 additions & 3 deletions cypress/integration/composite_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('CompositeLevelMonitor', () => {
.type('{backspace}')
.type('Composite trigger');

cy.intercept('api/alerting/workflows').as('createMonitorRequest');
cy.intercept('api/alerting/workflows*').as('createMonitorRequest');
cy.intercept(`api/alerting/monitors?*`).as('getMonitorsRequest');
cy.get('button').contains('Create').click({ force: true });

Expand Down Expand Up @@ -116,7 +116,7 @@ describe('CompositeLevelMonitor', () => {
cy.visit(
`${Cypress.env('opensearch_dashboards')}/app/${PLUGIN_NAME}#/monitors/${
createdMonitor._id
}?action=update-monitor&type=workflow`
}?action=update-monitor&type=workflow&dataSourceId=`
);
} else {
cy.log('Failed to get created monitor ', SAMPLE_VISUAL_EDITOR_MONITOR);
Expand All @@ -130,6 +130,7 @@ describe('CompositeLevelMonitor', () => {

it('by visual editor', () => {
// Verify edit page
cy.contains('Edit').click({ force: true });
cy.contains('Edit monitor', { timeout: 20000 });
cy.get('input[name="name"]').type('_edited');

Expand All @@ -150,7 +151,7 @@ describe('CompositeLevelMonitor', () => {
.type('{enter}');

cy.intercept('api/alerting/workflows/*').as('updateMonitorRequest');
cy.get('button').contains('Update').click({ force: true });
cy.get('button').contains('Save').click({ force: true });

// Wait for monitor to be created
cy.wait('@updateMonitorRequest').then(() => {
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/document_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ describe('DocumentLevelMonitor', () => {

// TODO: Test with Notifications plugin

// Click the update button
cy.get('button').contains('Update').last().click({ force: true });
// Click the save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 2 rows');
Expand Down Expand Up @@ -446,8 +446,8 @@ describe('DocumentLevelMonitor', () => {

// TODO: Test with Notifications plugin

// Click the create button
cy.get('button').contains('Update').last().click({ force: true });
// Click the save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down Expand Up @@ -489,8 +489,8 @@ describe('DocumentLevelMonitor', () => {
cy.get('[data-test-subj="indicesComboBox"]').should('not.have.text', TESTING_INDEX_A);
cy.get('[data-test-subj="indicesComboBox"]').contains(TESTING_INDEX_B, { timeout: 20000 });

// Click the update button
cy.get('button').contains('Update').last().click({ force: true });
// Click the save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 20000 });
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/query_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ describe('Query-Level Monitors', () => {
.clear()
.type(UPDATED_MONITOR, { force: true });

// Click Update button
cy.get('button').contains('Update').last().click({ force: true });
// Click save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm the update process is done and the page loaded
cy.contains('Edit monitor');
Expand Down Expand Up @@ -222,8 +222,8 @@ describe('Query-Level Monitors', () => {
timeout: 25000,
});

// Click the update button
cy.get('button').contains('Update').last().click();
// Click the save button
cy.get('button').contains('Save').last().click();

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 25000 });
Expand Down Expand Up @@ -339,8 +339,8 @@ describe('Query-Level Monitors', () => {
addVisualQueryLevelTrigger(trigger.name, i, true, `IS ${trigger.enum}`, `${i}`);
}

// Click Update button
cy.get('button').contains('Update').last().click({ force: true });
// Click save button
cy.get('button').contains('Save').last().click({ force: true });

// Confirm we can see the correct number of rows in the trigger list by checking <caption> element
cy.contains(`This table contains ${triggers.length} rows`, { timeout: 25000 });
Expand Down
5 changes: 4 additions & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
"requiredPlugins": [
"uiActions",
"dashboard",
"navigation",
"embeddable",
"opensearchDashboardsReact",
"savedObjects",
"expressions",
"data",
"visAugmenter",
"opensearchDashboardsUtils"
"opensearchDashboardsUtils",
"contentManagement"
],
"optionalPlugins": ["assistantDashboards"],
"server": true,
"ui": true,
"supportedOSDataSourceVersions": ">=2.13.0",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@elastic/elastic-eslint-config-kibana": "link:../../packages/opensearch-eslint-config-opensearch-dashboards",
"@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards",
"cypress": "9.5.4",
"husky": "^3.0.0",
"husky": "^8.0.0",
"lint-staged": "^10.2.0",
"@types/react": "^16.14.23"
},
Expand All @@ -62,7 +62,8 @@
"semver": "^5.7.2",
"**/d3-color": "^3.1.0",
"@cypress/request": "^3.0.0",
"braces": "^3.0.3"
"braces": "^3.0.3",
"micromatch": "^4.0.8"
},
"engines": {
"yarn": "^1.21.1"
Expand Down
4 changes: 3 additions & 1 deletion public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export function renderApp(coreStart, params, defaultRoute) {
defaultRoute: defaultRoute,
}}
>
<Route render={(props) => <Main title="Alerting" {...mdsProps} {...navProps} {...props} />} />
<Route
render={(props) => <Main title="Alerting" {...mdsProps} {...navProps} {...props} />}
/>
</CoreContext.Provider>
</ServicesContext.Provider>
</Router>,
Expand Down
4 changes: 2 additions & 2 deletions public/components/Breadcrumbs/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export async function getBreadcrumb(route, routeState, httpClient) {
console.error(err);
}
const breadcrumbs = [{ text: monitorName, href: `/monitors/${base}` }];
if (action === MONITOR_ACTIONS.UPDATE_MONITOR)
breadcrumbs.push({ text: 'Update monitor', href: '/' });
if (action === MONITOR_ACTIONS.EDIT_MONITOR)
breadcrumbs.push({ text: 'Edit monitor', href: '/' });
if (action === TRIGGER_ACTIONS.CREATE_TRIGGER)
breadcrumbs.push({ text: 'Create trigger', href: '/' });
if (action === TRIGGER_ACTIONS.UPDATE_TRIGGER)
Expand Down
2 changes: 1 addition & 1 deletion public/components/Breadcrumbs/Breadcrumbs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('getBreadcrumb', () => {
httpClientMock.get.mockResolvedValue({ ok: true, resp: { name: 'random_name' } });
expect(
await getBreadcrumb(
`${monitorId}?action=${MONITOR_ACTIONS.UPDATE_MONITOR}`,
`${monitorId}?action=${MONITOR_ACTIONS.EDIT_MONITOR}`,
{},
httpClientMock
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Array [
},
Object {
"href": "/",
"text": "Update monitor",
"text": "Edit monitor",
},
]
`;
Expand Down
7 changes: 5 additions & 2 deletions public/components/ContentPanel/ContentPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ const ContentPanel = ({
horizontalRuleClassName = '',
actions,
children,
panelOptions = {},
}) => (
<EuiPanel style={{ paddingLeft: '0px', paddingRight: '0px', ...panelStyles }}>
<EuiPanel style={{ padding: '16px', ...panelStyles }}>
<EuiFlexGroup style={{ padding: '0px 10px' }} justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem>
<EuiText size={titleSize}>
Expand All @@ -38,7 +39,9 @@ const ContentPanel = ({
<EuiText style={{ padding: '0px 10px' }} size={descriptionSize} color="subdued">
{description}
</EuiText>
<EuiHorizontalRule margin="xs" className={horizontalRuleClassName} />
{!panelOptions.hideTitleBorder && (
<EuiHorizontalRule margin="xs" className={horizontalRuleClassName} />
)}

<div style={{ padding: '0px 10px', ...bodyStyles }}>{children}</div>
</EuiPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`ContentPanel renders 1`] = `
<div
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
style="padding-left:0px;padding-right:0px"
style="padding:16px"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
Expand Down
Loading

0 comments on commit f5910a0

Please sign in to comment.