|
|
|
@ -1,4 +1,3 @@ |
|
|
|
|
import userEvent from '@testing-library/user-event'; |
|
|
|
|
import { FormProvider, useForm } from 'react-hook-form'; |
|
|
|
|
import { render, screen, within } from 'test/test-utils'; |
|
|
|
|
import { byRole, byTestId } from 'testing-library-selector'; |
|
|
|
@ -53,18 +52,16 @@ describe('AnnotationsField', function () { |
|
|
|
|
const annotationElements = ui.annotationKeys.getAll(); |
|
|
|
|
|
|
|
|
|
expect(annotationElements).toHaveLength(3); |
|
|
|
|
expect(annotationElements[0]).toHaveTextContent('Summary'); |
|
|
|
|
expect(annotationElements[1]).toHaveTextContent('Description'); |
|
|
|
|
expect(annotationElements[2]).toHaveTextContent('Runbook URL'); |
|
|
|
|
expect(screen.getByLabelText(/Summary/)).toBeInTheDocument(); |
|
|
|
|
expect(screen.getByLabelText(/Description/)).toBeInTheDocument(); |
|
|
|
|
expect(screen.getByLabelText(/Runbook URL/)).toBeInTheDocument(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('Dashboard and panel picker', function () { |
|
|
|
|
it('should display dashboard and panel selector when select button clicked', async function () { |
|
|
|
|
mockDashboardApi(server).search([]); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper />); |
|
|
|
|
const { user } = render(<FormWrapper />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
|
|
|
|
@ -88,9 +85,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper />); |
|
|
|
|
const { user } = render(<FormWrapper />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
expect(ui.dashboardPicker.confirmButton.get()).toBeDisabled(); |
|
|
|
@ -118,9 +113,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper formValues={{ annotations: [] }} />); |
|
|
|
|
const { user } = render(<FormWrapper formValues={{ annotations: [] }} />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
await user.click(await screen.findByTitle('My dashboard')); |
|
|
|
@ -154,9 +147,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper />); |
|
|
|
|
const { user } = render(<FormWrapper />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
expect(ui.dashboardPicker.confirmButton.get()).toBeDisabled(); |
|
|
|
@ -189,9 +180,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper />); |
|
|
|
|
const { user } = render(<FormWrapper />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
expect(ui.dashboardPicker.confirmButton.get()).toBeDisabled(); |
|
|
|
@ -233,9 +222,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render( |
|
|
|
|
const { user } = render( |
|
|
|
|
<FormWrapper |
|
|
|
|
formValues={{ |
|
|
|
|
annotations: [ |
|
|
|
@ -290,9 +277,7 @@ describe('AnnotationsField', function () { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const user = userEvent.setup(); |
|
|
|
|
|
|
|
|
|
render(<FormWrapper formValues={{ annotations: [] }} />); |
|
|
|
|
const { user } = render(<FormWrapper formValues={{ annotations: [] }} />); |
|
|
|
|
|
|
|
|
|
await user.click(ui.setDashboardButton.get()); |
|
|
|
|
await user.click(await screen.findByTitle('My dashboard')); |
|
|
|
|