diff --git a/cypress/fixtures/sample_cron_expression_query_level_monitor.json b/cypress/fixtures/sample_cron_expression_query_level_monitor.json
new file mode 100644
index 000000000..ed87475fb
--- /dev/null
+++ b/cypress/fixtures/sample_cron_expression_query_level_monitor.json
@@ -0,0 +1,25 @@
+{
+ "name": "sample_cron_expression_query_level_monitor",
+ "enabled": true,
+ "schedule": {
+ "cron": {
+ "expression": "30 11 * * 1-5",
+ "timezone": "US/Pacific"
+ }
+ },
+ "inputs": [
+ {
+ "search": {
+ "indices": ["*"],
+ "query": {
+ "query": {
+ "match_all": {}
+ }
+ }
+ }
+ }
+ ],
+ "ui_metadata": {
+ "schedule": {}
+ }
+}
diff --git a/cypress/fixtures/sample_days_interval_query_level_monitor.json b/cypress/fixtures/sample_days_interval_query_level_monitor.json
new file mode 100644
index 000000000..088cbf052
--- /dev/null
+++ b/cypress/fixtures/sample_days_interval_query_level_monitor.json
@@ -0,0 +1,25 @@
+{
+ "name": "sample_days_interval_query_level_monitor",
+ "enabled": true,
+ "schedule": {
+ "period": {
+ "interval": "7",
+ "unit": "DAYS"
+ }
+ },
+ "inputs": [
+ {
+ "search": {
+ "indices": ["*"],
+ "query": {
+ "query": {
+ "match_all": {}
+ }
+ }
+ }
+ }
+ ],
+ "ui_metadata": {
+ "schedule": {}
+ }
+}
diff --git a/cypress/integration/query_level_monitor_spec.js b/cypress/integration/query_level_monitor_spec.js
index 057b14820..b6cf5e5ea 100644
--- a/cypress/integration/query_level_monitor_spec.js
+++ b/cypress/integration/query_level_monitor_spec.js
@@ -7,10 +7,14 @@ import _ from 'lodash';
import { INDEX, PLUGIN_NAME } from '../support/constants';
import sampleQueryLevelMonitor from '../fixtures/sample_query_level_monitor';
import sampleQueryLevelMonitorWithAlwaysTrueTrigger from '../fixtures/sample_query_level_monitor_with_always_true_trigger';
+import sampleDaysIntervalQueryLevelMonitor from '../fixtures/sample_days_interval_query_level_monitor.json';
+import sampleCronExpressionQueryLevelMonitor from '../fixtures/sample_cron_expression_query_level_monitor.json';
const SAMPLE_MONITOR = 'sample_query_level_monitor';
const UPDATED_MONITOR = 'updated_query_level_monitor';
const SAMPLE_MONITOR_WITH_ANOTHER_NAME = 'sample_query_level_monitor_with_always_true_trigger';
+const SAMPLE_DAYS_INTERVAL_MONITOR = 'sample_days_interval_query_level_monitor';
+const SAMPLE_CRON_EXPRESSION_MONITOR = 'sample_cron_expression_query_level_monitor';
const SAMPLE_TRIGGER = 'sample_trigger';
const SAMPLE_ACTION = 'sample_action';
const SAMPLE_DESTINATION = 'sample_destination';
@@ -309,6 +313,63 @@ describe('Query-Level Monitors', () => {
});
});
});
+
+ describe('schedule component displays as intended', () => {
+ before(() => {
+ cy.deleteAllMonitors();
+ });
+
+ it('for an interval schedule', () => {
+ // Create the test monitor
+ cy.createMonitor(sampleDaysIntervalQueryLevelMonitor);
+
+ // Confirm we can see the created monitors in the list
+ cy.get(`input[type="search"]`).focus().type(SAMPLE_DAYS_INTERVAL_MONITOR);
+ cy.contains(SAMPLE_DAYS_INTERVAL_MONITOR, { timeout: 20000 });
+
+ // Select the existing monitor
+ cy.get('a').contains(SAMPLE_DAYS_INTERVAL_MONITOR).click({ force: true });
+
+ // Click Edit button
+ cy.contains('Edit').click({ force: true });
+
+ // Wait for input to load and then check the Schedule component
+ cy.get('[data-test-subj="frequency_field"]', { timeout: 20000 }).contains('By interval');
+
+ cy.get('[data-test-subj="interval_interval_field"]', { timeout: 20000 }).should(
+ 'have.value',
+ 7
+ );
+
+ cy.get('[data-test-subj="interval_unit_field"]', { timeout: 20000 }).contains('Days');
+ });
+
+ it('for a cron expression schedule', () => {
+ // Create the test monitor
+ cy.createMonitor(sampleCronExpressionQueryLevelMonitor);
+
+ // Confirm we can see the created monitors in the list
+ cy.get(`input[type="search"]`).focus().type(SAMPLE_CRON_EXPRESSION_MONITOR);
+ cy.contains(SAMPLE_CRON_EXPRESSION_MONITOR, { timeout: 20000 });
+
+ // Select the existing monitor
+ cy.get('a').contains(SAMPLE_CRON_EXPRESSION_MONITOR).click({ force: true });
+
+ // Click Edit button
+ cy.contains('Edit').click({ force: true });
+
+ // Wait for input to load and then check the Schedule component
+ cy.get('[data-test-subj="frequency_field"]', { timeout: 20000 }).contains(
+ 'Custom cron expression'
+ );
+
+ cy.get('[data-test-subj="customCron_cronExpression_field"]', { timeout: 20000 }).contains(
+ '30 11 * * 1-5'
+ );
+
+ cy.get('[data-test-subj="timezoneComboBox"]', { timeout: 20000 }).contains('US/Pacific');
+ });
+ });
after(() => {
// Delete all existing monitors and destinations
diff --git a/public/pages/CreateMonitor/components/Schedule/Frequencies/CustomCron.js b/public/pages/CreateMonitor/components/Schedule/Frequencies/CustomCron.js
index 164ab7e67..bdcd6c66a 100644
--- a/public/pages/CreateMonitor/components/Schedule/Frequencies/CustomCron.js
+++ b/public/pages/CreateMonitor/components/Schedule/Frequencies/CustomCron.js
@@ -32,6 +32,7 @@ const CustomCron = () => (
error: hasError,
style: { marginTop: '0px' },
}}
+ inputProps={{ 'data-test-subj': 'customCron_cronExpression_field' }}
/>
diff --git a/public/pages/CreateMonitor/components/Schedule/Frequencies/Frequency.js b/public/pages/CreateMonitor/components/Schedule/Frequencies/Frequency.js
index c4d967339..5b02bc71b 100644
--- a/public/pages/CreateMonitor/components/Schedule/Frequencies/Frequency.js
+++ b/public/pages/CreateMonitor/components/Schedule/Frequencies/Frequency.js
@@ -27,6 +27,7 @@ const Frequency = () => (
inputProps={{
options: frequencies,
isInvalid,
+ 'data-test-subj': 'frequency_field',
}}
/>
);
diff --git a/public/pages/CreateMonitor/components/Schedule/Frequencies/Interval.js b/public/pages/CreateMonitor/components/Schedule/Frequencies/Interval.js
index d513aed0d..afb9287a4 100644
--- a/public/pages/CreateMonitor/components/Schedule/Frequencies/Interval.js
+++ b/public/pages/CreateMonitor/components/Schedule/Frequencies/Interval.js
@@ -32,7 +32,11 @@ const Interval = () => (
isInvalid,
error: hasError,
}}
- inputProps={{ icon: 'clock', min: 1 }}
+ inputProps={{
+ icon: 'clock',
+ min: 1,
+ 'data-test-subj': 'interval_interval_field',
+ }}
/>
@@ -45,7 +49,10 @@ const Interval = () => (
isInvalid,
error: hasError,
}}
- inputProps={{ options: unitOptions }}
+ inputProps={{
+ options: unitOptions,
+ 'data-test-subj': 'interval_unit_field',
+ }}
/>
diff --git a/public/pages/CreateMonitor/components/Schedule/Frequencies/__snapshots__/Frequencies.test.js.snap b/public/pages/CreateMonitor/components/Schedule/Frequencies/__snapshots__/Frequencies.test.js.snap
index 4e44c245b..bf3e8d059 100644
--- a/public/pages/CreateMonitor/components/Schedule/Frequencies/__snapshots__/Frequencies.test.js.snap
+++ b/public/pages/CreateMonitor/components/Schedule/Frequencies/__snapshots__/Frequencies.test.js.snap
@@ -30,6 +30,7 @@ exports[`Frequencies renders CustomCron 1`] = `
>