diff --git a/grafana-plugin/integration-tests/integrations/uniqueIntegrationNames.test.ts b/grafana-plugin/integration-tests/integrations/uniqueIntegrationNames.test.ts new file mode 100644 index 00000000..06fc9284 --- /dev/null +++ b/grafana-plugin/integration-tests/integrations/uniqueIntegrationNames.test.ts @@ -0,0 +1,16 @@ +import { test, expect } from '@playwright/test'; +import { configureOnCallPlugin } from '../utils/configurePlugin'; +import { openCreateIntegrationModal } from '../utils/integrations'; + +test.beforeEach(async ({ page }) => { + await configureOnCallPlugin(page); +}); + +test('integrations have unique names', async ({ page }) => { + await openCreateIntegrationModal(page); + + const integrationNames = await page.getByTestId('integration-display-name').allInnerTexts(); + const uniqueLowercasedIntegrationNames = new Set(integrationNames.map((elem) => elem.toLowerCase())); + + expect(uniqueLowercasedIntegrationNames.size).toEqual(integrationNames.length); +}); diff --git a/grafana-plugin/integration-tests/utils/integrations.ts b/grafana-plugin/integration-tests/utils/integrations.ts index 664fcd79..8e54eaa1 100644 --- a/grafana-plugin/integration-tests/utils/integrations.ts +++ b/grafana-plugin/integration-tests/utils/integrations.ts @@ -2,19 +2,28 @@ import { Page } from '@playwright/test'; import { clickButton, fillInInput, selectDropdownValue } from './forms'; import { goToOnCallPage } from './navigation'; -export const createIntegrationAndSendDemoAlert = async ( - page: Page, - integrationName: string, - escalationChainName: string -): Promise => { +const CREATE_INTEGRATION_MODAL_TEST_ID_SELECTOR = 'div[data-testid="create-integration-modal"]'; + +export const openCreateIntegrationModal = async (page: Page): Promise => { // go to the integrations page await goToOnCallPage(page, 'integrations'); // open the create integration modal (await page.waitForSelector('text=New integration to receive alerts')).click(); + // wait for it to pop up + await page.waitForSelector(CREATE_INTEGRATION_MODAL_TEST_ID_SELECTOR); +}; + +export const createIntegrationAndSendDemoAlert = async ( + page: Page, + integrationName: string, + escalationChainName: string +): Promise => { + await openCreateIntegrationModal(page); + // create a webhook integration - (await page.waitForSelector('div[data-testid="create-integration-modal"] >> text=Webhook')).click(); + (await page.waitForSelector(`${CREATE_INTEGRATION_MODAL_TEST_ID_SELECTOR} >> text=Webhook`)).click(); // wait for the integrations settings modal to open up... and then close it await clickButton({ page, buttonText: 'Open Escalations Settings' }); diff --git a/grafana-plugin/src/components/Text/Text.tsx b/grafana-plugin/src/components/Text/Text.tsx index a6c87f0f..ba7664f0 100644 --- a/grafana-plugin/src/components/Text/Text.tsx +++ b/grafana-plugin/src/components/Text/Text.tsx @@ -52,6 +52,7 @@ const Text: TextInterface = (props) => { hidden = false, editModalTitle = 'New value', style, + ...rest } = props; const [isEditMode, setIsEditMode] = useState(false); @@ -88,6 +89,7 @@ const Text: TextInterface = (props) => { keyboard, })} style={style} + {...rest} > {hidden ? PLACEHOLDER : children} {editable && ( diff --git a/grafana-plugin/src/containers/CreateAlertReceiveChannelContainer/CreateAlertReceiveChannelContainer.tsx b/grafana-plugin/src/containers/CreateAlertReceiveChannelContainer/CreateAlertReceiveChannelContainer.tsx index e0d3b179..900b51c0 100644 --- a/grafana-plugin/src/containers/CreateAlertReceiveChannelContainer/CreateAlertReceiveChannelContainer.tsx +++ b/grafana-plugin/src/containers/CreateAlertReceiveChannelContainer/CreateAlertReceiveChannelContainer.tsx @@ -79,7 +79,9 @@ const CreateAlertReceiveChannelContainer = observer((props: CreateAlertReceiveCh
- {alertReceiveChannelChoice.display_name} + + {alertReceiveChannelChoice.display_name} + {alertReceiveChannelChoice.short_description}