mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
Makes the "Text Assertion" field optional in Monitor Add/Edit form.
This commit is contained in:
parent
41cd8cb96a
commit
1b7830775e
2 changed files with 7 additions and 6 deletions
|
@ -1090,12 +1090,12 @@ export const FIELD = (readOnly?: boolean): FieldMap => ({
|
||||||
label: i18n.translate('xpack.synthetics.monitorConfig.textAssertion.label', {
|
label: i18n.translate('xpack.synthetics.monitorConfig.textAssertion.label', {
|
||||||
defaultMessage: 'Text assertion',
|
defaultMessage: 'Text assertion',
|
||||||
}),
|
}),
|
||||||
required: true,
|
required: false,
|
||||||
helpText: i18n.translate('xpack.synthetics.monitorConfig.textAssertion.helpText', {
|
helpText: i18n.translate('xpack.synthetics.monitorConfig.textAssertion.helpText', {
|
||||||
defaultMessage: 'Consider the page loaded when the specified text is rendered.',
|
defaultMessage: 'Consider the page loaded when the specified text is rendered.',
|
||||||
}),
|
}),
|
||||||
validation: () => ({
|
validation: () => ({
|
||||||
required: true,
|
required: false,
|
||||||
}),
|
}),
|
||||||
props: (): EuiFieldTextProps => ({
|
props: (): EuiFieldTextProps => ({
|
||||||
readOnly,
|
readOnly,
|
||||||
|
|
|
@ -24,14 +24,15 @@ export const ALLOWED_FIELDS = [ConfigKey.ENABLED, ConfigKey.ALERT_CONFIG];
|
||||||
|
|
||||||
export const format = (fields: Record<string, unknown>, readOnly: boolean = false) => {
|
export const format = (fields: Record<string, unknown>, readOnly: boolean = false) => {
|
||||||
const formattedFields = formatter(fields) as MonitorFields;
|
const formattedFields = formatter(fields) as MonitorFields;
|
||||||
|
const textAssertion = formattedFields[ConfigKey.TEXT_ASSERTION]
|
||||||
|
? `
|
||||||
|
await page.getByText('${formattedFields[ConfigKey.TEXT_ASSERTION]}').first().waitFor();`
|
||||||
|
: ``;
|
||||||
const formattedMap = {
|
const formattedMap = {
|
||||||
[FormMonitorType.SINGLE]: {
|
[FormMonitorType.SINGLE]: {
|
||||||
...formattedFields,
|
...formattedFields,
|
||||||
[ConfigKey.SOURCE_INLINE]: `step('Go to ${formattedFields[ConfigKey.URLS]}', async () => {
|
[ConfigKey.SOURCE_INLINE]: `step('Go to ${formattedFields[ConfigKey.URLS]}', async () => {
|
||||||
await page.goto('${formattedFields[ConfigKey.URLS]}');
|
await page.goto('${formattedFields[ConfigKey.URLS]}');${textAssertion}
|
||||||
expect(await page.isVisible('text=${
|
|
||||||
formattedFields[ConfigKey.TEXT_ASSERTION]
|
|
||||||
}')).toBeTruthy();
|
|
||||||
});`,
|
});`,
|
||||||
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.SINGLE,
|
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.SINGLE,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue