|
|
|
@ -106,14 +106,13 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'web-server' }); |
|
|
|
|
expect(resourcePickerButton).toBeInTheDocument(); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
await waitFor(() => { |
|
|
|
|
await waitFor(async () => { |
|
|
|
|
expect(screen.queryByText('Loading...')).not.toBeInTheDocument(); |
|
|
|
|
const selection = await screen.findAllByLabelText('web-server'); |
|
|
|
|
expect(selection).toHaveLength(2); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const selection = await screen.findAllByLabelText('web-server'); |
|
|
|
|
expect(selection).toHaveLength(2); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should change resource when a resource is selected in the ResourcePicker', async () => { |
|
|
|
@ -138,17 +137,17 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
expect(resourcePickerButton).toBeInTheDocument(); |
|
|
|
|
expect(screen.queryByRole('button', { name: 'Expand Primary Subscription' })).not.toBeInTheDocument(); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const subscriptionButton = await screen.findByRole('button', { name: 'Expand Primary Subscription' }); |
|
|
|
|
expect(subscriptionButton).toBeInTheDocument(); |
|
|
|
|
expect(screen.queryByRole('button', { name: 'Expand A Great Resource Group' })).not.toBeInTheDocument(); |
|
|
|
|
subscriptionButton.click(); |
|
|
|
|
await userEvent.click(subscriptionButton); |
|
|
|
|
|
|
|
|
|
const resourceGroupButton = await screen.findByRole('button', { name: 'Expand A Great Resource Group' }); |
|
|
|
|
expect(resourceGroupButton).toBeInTheDocument(); |
|
|
|
|
expect(screen.queryByLabelText('web-server')).not.toBeInTheDocument(); |
|
|
|
|
resourceGroupButton.click(); |
|
|
|
|
await userEvent.click(resourceGroupButton); |
|
|
|
|
|
|
|
|
|
const checkbox = await screen.findByLabelText('web-server'); |
|
|
|
|
expect(checkbox).toBeInTheDocument(); |
|
|
|
@ -194,13 +193,13 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const subscriptionButton = await screen.findByRole('button', { name: 'Expand Primary Subscription' }); |
|
|
|
|
subscriptionButton.click(); |
|
|
|
|
await userEvent.click(subscriptionButton); |
|
|
|
|
|
|
|
|
|
const resourceGroupButton = await screen.findByRole('button', { name: 'Expand A Great Resource Group' }); |
|
|
|
|
resourceGroupButton.click(); |
|
|
|
|
await userEvent.click(resourceGroupButton); |
|
|
|
|
|
|
|
|
|
const checkbox = await screen.findByLabelText('web-server'); |
|
|
|
|
await userEvent.click(checkbox); |
|
|
|
@ -253,13 +252,13 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const subscriptionButton = await screen.findByRole('button', { name: 'Expand Primary Subscription' }); |
|
|
|
|
subscriptionButton.click(); |
|
|
|
|
await userEvent.click(subscriptionButton); |
|
|
|
|
|
|
|
|
|
const resourceGroupButton = await screen.findByRole('button', { name: 'Expand A Great Resource Group' }); |
|
|
|
|
resourceGroupButton.click(); |
|
|
|
|
await userEvent.click(resourceGroupButton); |
|
|
|
|
|
|
|
|
|
const checkbox = await screen.findByLabelText('web-server'); |
|
|
|
|
await userEvent.click(checkbox); |
|
|
|
@ -288,13 +287,13 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const subscriptionButton = await screen.findByRole('button', { name: 'Expand Primary Subscription' }); |
|
|
|
|
subscriptionButton.click(); |
|
|
|
|
await userEvent.click(subscriptionButton); |
|
|
|
|
|
|
|
|
|
const resourceGroupButton = await screen.findByRole('button', { name: 'Expand A Great Resource Group' }); |
|
|
|
|
resourceGroupButton.click(); |
|
|
|
|
await userEvent.click(resourceGroupButton); |
|
|
|
|
|
|
|
|
|
const checkbox = await screen.findByLabelText('web-server'); |
|
|
|
|
await userEvent.click(checkbox); |
|
|
|
@ -397,20 +396,20 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const subscriptionButton = await screen.findByRole('button', { name: 'Expand Primary Subscription' }); |
|
|
|
|
subscriptionButton.click(); |
|
|
|
|
await userEvent.click(subscriptionButton); |
|
|
|
|
|
|
|
|
|
const resourceGroupButton = await screen.findByRole('button', { name: 'Expand A Great Resource Group' }); |
|
|
|
|
resourceGroupButton.click(); |
|
|
|
|
await userEvent.click(resourceGroupButton); |
|
|
|
|
|
|
|
|
|
const checkbox = await screen.findByLabelText('web-server'); |
|
|
|
|
await userEvent.click(checkbox); |
|
|
|
|
expect(checkbox).toBeChecked(); |
|
|
|
|
|
|
|
|
|
const advancedSection = screen.getByText('Advanced'); |
|
|
|
|
advancedSection.click(); |
|
|
|
|
await userEvent.click(advancedSection); |
|
|
|
|
|
|
|
|
|
const advancedInput = await screen.findByLabelText('Subscription'); |
|
|
|
|
await userEvent.type(advancedInput, 'def-123'); |
|
|
|
@ -443,10 +442,10 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resourcePickerButton = await screen.findByRole('button', { name: 'Select a resource' }); |
|
|
|
|
resourcePickerButton.click(); |
|
|
|
|
await userEvent.click(resourcePickerButton); |
|
|
|
|
|
|
|
|
|
const advancedSection = screen.getByText('Advanced'); |
|
|
|
|
advancedSection.click(); |
|
|
|
|
await userEvent.click(advancedSection); |
|
|
|
|
|
|
|
|
|
const advancedInput = await screen.findByLabelText('Subscription'); |
|
|
|
|
await userEvent.type(advancedInput, 'def-123'); |
|
|
|
@ -458,7 +457,7 @@ describe('MetricsQueryEditor', () => { |
|
|
|
|
await userEvent.type(rnInput, 'rn'); |
|
|
|
|
|
|
|
|
|
const applyButton = screen.getByRole('button', { name: 'Apply' }); |
|
|
|
|
applyButton.click(); |
|
|
|
|
await userEvent.click(applyButton); |
|
|
|
|
|
|
|
|
|
expect(onChange).toBeCalledTimes(1); |
|
|
|
|
expect(onChange).toBeCalledWith( |
|
|
|
|