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', {
|
||||
defaultMessage: 'Text assertion',
|
||||
}),
|
||||
required: true,
|
||||
required: false,
|
||||
helpText: i18n.translate('xpack.synthetics.monitorConfig.textAssertion.helpText', {
|
||||
defaultMessage: 'Consider the page loaded when the specified text is rendered.',
|
||||
}),
|
||||
validation: () => ({
|
||||
required: true,
|
||||
required: false,
|
||||
}),
|
||||
props: (): EuiFieldTextProps => ({
|
||||
readOnly,
|
||||
|
|
|
@ -24,14 +24,15 @@ export const ALLOWED_FIELDS = [ConfigKey.ENABLED, ConfigKey.ALERT_CONFIG];
|
|||
|
||||
export const format = (fields: Record<string, unknown>, readOnly: boolean = false) => {
|
||||
const formattedFields = formatter(fields) as MonitorFields;
|
||||
const textAssertion = formattedFields[ConfigKey.TEXT_ASSERTION]
|
||||
? `
|
||||
await page.getByText('${formattedFields[ConfigKey.TEXT_ASSERTION]}').first().waitFor();`
|
||||
: ``;
|
||||
const formattedMap = {
|
||||
[FormMonitorType.SINGLE]: {
|
||||
...formattedFields,
|
||||
[ConfigKey.SOURCE_INLINE]: `step('Go to ${formattedFields[ConfigKey.URLS]}', async () => {
|
||||
await page.goto('${formattedFields[ConfigKey.URLS]}');
|
||||
expect(await page.isVisible('text=${
|
||||
formattedFields[ConfigKey.TEXT_ASSERTION]
|
||||
}')).toBeTruthy();
|
||||
await page.goto('${formattedFields[ConfigKey.URLS]}');${textAssertion}
|
||||
});`,
|
||||
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.SINGLE,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue