-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change escalation chains searching to allow for partial searching (#1578
) # Which issue(s) this PR fixes Previously if you had an Escalation Chain named "Something Critical" and tried searching for "Critical", it would return no results. This was because the backend was using a "starts-with" search on the `name` attribute. This PR changes that to use "partial searching" + adds a few e2e test cases. ## Checklist - [x] Tests updated - [ ] Documentation added (N/A) - [x] `CHANGELOG.md` updated
- Loading branch information
1 parent
046d1dc
commit 7ea5b07
Showing
8 changed files
with
45 additions
and
7 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
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
36 changes: 36 additions & 0 deletions
36
grafana-plugin/integration-tests/escalationChains/searching.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { configureOnCallPlugin } from '../utils/configurePlugin'; | ||
import { generateRandomValue } from '../utils/forms'; | ||
import { createEscalationChain } from '../utils/escalationChain'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await configureOnCallPlugin(page); | ||
}); | ||
|
||
const assertEscalationChainSearchWorks = async ( | ||
page: Page, | ||
searchTerm: string, | ||
escalationChainFullName: string | ||
): Promise<void> => { | ||
await page.getByTestId('escalation-chain-search-input').fill(searchTerm); | ||
|
||
// wait for the API call(s) to finish | ||
await page.waitForLoadState('networkidle'); | ||
|
||
await expect(page.getByTestId('escalation-chains-list')).toHaveText(escalationChainFullName); | ||
}; | ||
|
||
test('searching allows case-insensitive partial matches', async ({ page }) => { | ||
const escalationChainName = `${generateRandomValue()} ${generateRandomValue()}`; | ||
const [firstHalf, secondHalf] = escalationChainName.split(' '); | ||
|
||
await createEscalationChain(page, escalationChainName); | ||
|
||
await assertEscalationChainSearchWorks(page, firstHalf, escalationChainName); | ||
await assertEscalationChainSearchWorks(page, firstHalf.toUpperCase(), escalationChainName); | ||
await assertEscalationChainSearchWorks(page, firstHalf.toLowerCase(), escalationChainName); | ||
|
||
await assertEscalationChainSearchWorks(page, secondHalf, escalationChainName); | ||
await assertEscalationChainSearchWorks(page, secondHalf.toUpperCase(), escalationChainName); | ||
await assertEscalationChainSearchWorks(page, secondHalf.toLowerCase(), escalationChainName); | ||
}); |
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