-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fixes #26970: fix bot name search on the Bots page #27365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2979813
a3d6165
925d005
8ee2155
9c0d085
f78b4f3
339804f
324c3d6
2ed61b3
2f6bbfc
ac54692
ce64825
e8802bc
774f59b
392e98f
d2e68dc
0c150f5
9bed9d3
8716fb2
0956671
edf3496
1ec1666
d61e5df
9482345
9b4f6c0
eac9242
d43b9db
6d254bc
0d75ae2
08c3f0f
13fbb21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,6 +198,52 @@ export const clickOutside = async (page: Page) => { | |
| }); | ||
| }; | ||
|
|
||
| export const updateSearchInputAndWait = async ( | ||
| page: Page, | ||
| searchInput: Locator, | ||
| value: string | ||
| ) => { | ||
| await searchInput.clear(); | ||
| await searchInput.fill(value); | ||
| await expect(searchInput).toHaveValue(value); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. integrate the search api get api here as well |
||
| await waitForAllLoadersToDisappear(page); | ||
| }; | ||
|
|
||
| type SearchInputOptions = { | ||
| waitForSearchApi?: boolean; | ||
| searchApiPattern?: string; | ||
| }; | ||
|
|
||
| export const searchFromSearchInput = async ( | ||
| page: Page, | ||
| searchInput: Locator, | ||
| searchTerm: string, | ||
| options: SearchInputOptions = {} | ||
| ) => { | ||
| const { | ||
| waitForSearchApi = false, | ||
| searchApiPattern = '/api/v1/search/query', | ||
| } = options; | ||
|
|
||
| const searchResponsePromise = waitForSearchApi | ||
| ? page.waitForResponse( | ||
| (response) => | ||
| response.url().includes(searchApiPattern) && | ||
| response.request().method() === 'GET' && | ||
| response.url().includes(encodeURIComponent(searchTerm)) | ||
| ) | ||
|
Comment on lines
+228
to
+234
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Edge Case: searchFromSearchInput waits on API even for empty search termThe old code guarded Was this helpful? React with 👍 / 👎 | Reply |
||
| : undefined; | ||
|
|
||
| await updateSearchInputAndWait(page, searchInput, searchTerm); | ||
|
|
||
| if (!searchResponsePromise) { | ||
| return; | ||
| } | ||
|
|
||
| const searchResponse = await searchResponsePromise; | ||
| expect(searchResponse.status()).toBe(200); | ||
| }; | ||
|
|
||
| export const visitOwnProfilePage = async (page: Page) => { | ||
| await page.locator('[data-testid="dropdown-profile"] svg').click(); | ||
| await page.locator('[role="menu"].profile-dropdown').waitFor({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.