-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# What this PR does Stabilize e2e tests by: - improve usage of locators - fix unreliable selectors - prevent parallelism within the same test file Additionally: - configure eslint for e2e tests and fix existing errors/warnings - bump Playwright version to latest stable ## Which issue(s) this PR fixes #3217 ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
- Loading branch information
Showing
25 changed files
with
382 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rules": { | ||
"rulesdir/no-relative-import-paths": "off", | ||
"no-console": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
grafana-plugin/e2e-tests/escalationChains/escalationPolicy.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 39 additions & 13 deletions
52
grafana-plugin/e2e-tests/integrations/integrationsTable.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,73 @@ | ||
import { test, expect } from '../fixtures'; | ||
import { test } from '../fixtures'; | ||
import { generateRandomValue } from '../utils/forms'; | ||
import { createIntegration } from '../utils/integrations'; | ||
import { createIntegration, searchIntegrationAndAssertItsPresence } from '../utils/integrations'; | ||
|
||
test('Integrations table shows data in Connections and Direct Paging tabs', async ({ adminRolePage: { page } }) => { | ||
// // Create 2 integrations that are not Direct Paging | ||
const ID = generateRandomValue(); | ||
const WEBHOOK_INTEGRATION_NAME = `Webhook-${ID}`; | ||
const ALERTMANAGER_INTEGRATION_NAME = `Alertmanager-${ID}`; | ||
const DIRECT_PAGING_INTEGRATION_NAME = `Direct paging`; | ||
const DIRECT_PAGING_INTEGRATION_NAME = `Direct paging integration name`; | ||
|
||
// Create 2 integrations that are not Direct Paging | ||
await createIntegration({ page, integrationSearchText: 'Webhook', integrationName: WEBHOOK_INTEGRATION_NAME }); | ||
await page.waitForTimeout(1000); | ||
await page.getByRole('tab', { name: 'Tab Integrations' }).click(); | ||
|
||
await createIntegration({ | ||
page, | ||
integrationSearchText: 'Alertmanager', | ||
shouldGoToIntegrationsPage: false, | ||
integrationName: ALERTMANAGER_INTEGRATION_NAME, | ||
}); | ||
await page.waitForTimeout(1000); | ||
await page.getByRole('tab', { name: 'Tab Integrations' }).click(); | ||
|
||
// Create 1 Direct Paging integration if it doesn't exist | ||
const integrationsTable = page.getByTestId('integrations-table'); | ||
await page.getByRole('tab', { name: 'Tab Direct Paging' }).click(); | ||
const isDirectPagingAlreadyCreated = await page.getByText('Direct paging').isVisible(); | ||
const integrationsTable = page.getByTestId('integrations-table'); | ||
await page.waitForTimeout(2000); | ||
const isDirectPagingAlreadyCreated = (await integrationsTable.getByText('Direct paging').count()) >= 1; | ||
if (!isDirectPagingAlreadyCreated) { | ||
await createIntegration({ | ||
page, | ||
integrationSearchText: 'Direct paging', | ||
shouldGoToIntegrationsPage: false, | ||
integrationName: DIRECT_PAGING_INTEGRATION_NAME, | ||
}); | ||
await page.waitForTimeout(1000); | ||
} | ||
await page.getByRole('tab', { name: 'Tab Integrations' }).click(); | ||
|
||
// By default Connections tab is opened and newly created integrations are visible except Direct Paging one | ||
await expect(integrationsTable.getByText(WEBHOOK_INTEGRATION_NAME)).toBeVisible(); | ||
await expect(integrationsTable.getByText(ALERTMANAGER_INTEGRATION_NAME)).toBeVisible(); | ||
await expect(integrationsTable).not.toContainText(DIRECT_PAGING_INTEGRATION_NAME); | ||
await searchIntegrationAndAssertItsPresence({ page, integrationsTable, integrationName: WEBHOOK_INTEGRATION_NAME }); | ||
await searchIntegrationAndAssertItsPresence({ | ||
page, | ||
integrationsTable, | ||
integrationName: ALERTMANAGER_INTEGRATION_NAME, | ||
}); | ||
await searchIntegrationAndAssertItsPresence({ | ||
page, | ||
integrationsTable, | ||
integrationName: DIRECT_PAGING_INTEGRATION_NAME, | ||
visibleExpected: false, | ||
}); | ||
|
||
// Then after switching to Direct Paging tab only Direct Paging integration is visible | ||
await page.getByRole('tab', { name: 'Tab Direct Paging' }).click(); | ||
await expect(integrationsTable.getByText(WEBHOOK_INTEGRATION_NAME)).not.toBeVisible(); | ||
await expect(integrationsTable.getByText(ALERTMANAGER_INTEGRATION_NAME)).not.toBeVisible(); | ||
await expect(integrationsTable).toContainText(DIRECT_PAGING_INTEGRATION_NAME); | ||
await searchIntegrationAndAssertItsPresence({ | ||
page, | ||
integrationsTable, | ||
integrationName: WEBHOOK_INTEGRATION_NAME, | ||
visibleExpected: false, | ||
}); | ||
await searchIntegrationAndAssertItsPresence({ | ||
page, | ||
integrationsTable, | ||
integrationName: ALERTMANAGER_INTEGRATION_NAME, | ||
visibleExpected: false, | ||
}); | ||
await searchIntegrationAndAssertItsPresence({ | ||
page, | ||
integrationsTable, | ||
integrationName: 'Direct paging', | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
grafana-plugin/e2e-tests/integrations/uniqueIntegrationNames.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.