[MM-63597] Fix From: autocompletion (#30673)

Этот коммит содержится в:
Julien Tant
2025-04-10 23:30:08 -07:00
коммит произвёл GitHub
родитель f53625d59f
Коммит 357aa58163
3 изменённых файлов: 38 добавлений и 2 удалений

Просмотреть файл

@@ -57,3 +57,33 @@ test('Search box suggestion must be case insensitive', async ({pw}) => {
// * The search box should contain the selected suggestion
await expect(channelsPage.globalHeader.searchBox.getByText(searchOutput, {exact: true})).toBeVisible();
});
test('remove extra whitespace when selecting a user', async ({pw}) => {
// # Set up test with two users
const {user, adminUser: admin} = await pw.initSetup();
// # Log in as the test user
const {channelsPage} = await pw.testBrowser.login(user);
// # Visit a default channel page
await channelsPage.goto();
await channelsPage.toBeVisible();
// # Open the search UI
await channelsPage.globalHeader.openSearch();
// # Type "from:" followed by multiple spaces
const {searchInput} = channelsPage.searchPopover;
await searchInput.pressSequentially(`from: ${admin.username}`);
// * The suggestion should be visible
await expect(channelsPage.searchPopover.selectedSuggestion).toBeVisible();
await expect(channelsPage.searchPopover.selectedSuggestion).toHaveText(`@` + admin.username);
// # Press enter to validate the selection
await searchInput.press('Enter');
// * Verify the search box shows "from:username" without extra spaces
const expectedText = `from:${admin.username} `;
await expect(searchInput).toHaveValue(expectedText);
});