Просмотр исходного кода

fix(playwright): fix 'button' locator and stabilize tag typeahead

- Change `.locator('a')` to `.locator('button')` in 'Successfully order
  page search results by tag': RenderTagLabels was refactored from <a>
  to <button> (2025-12-21, biome fix e632f2486a) but the test was not
  updated, so the click never found its target.
- Replace `fill()` with `pressSequentially()` for the tag typeahead so
  each character fires a proper input event that triggers the
  AsyncTypeahead's debounced onSearch, and extend the item visibility
  timeout to 15s for CI stability.
- Add missing `await` on the three `expect` assertions at the end of
  the same test — without await the assertions were fire-and-forget and
  would never actually block the test.
Yuki Takei 3 дней назад
Родитель
Сommit
b683222e9b
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      apps/app/playwright/30-search/search.spec.ts

+ 9 - 6
apps/app/playwright/30-search/search.spec.ts

@@ -72,11 +72,14 @@ test.describe
       await page.locator('.grw-side-contents-sticky-container').isVisible();
       await page.locator('#edit-tags-btn-wrapper-for-tooltip').click();
       await expect(page.locator('#edit-tag-modal')).toBeVisible();
-      await page.locator('.rbt-input-main').fill(tag);
+      // Use pressSequentially to fire per-character input events that the
+      // AsyncTypeahead listens to; fill() can be too fast to trigger the
+      // debounced onSearch reliably on CI.
+      await page.locator('.rbt-input-main').pressSequentially(tag);
       const typeaheadItem = page.locator(
         '#tag-typeahead-asynctypeahead-item-0',
       );
-      await expect(typeaheadItem).toBeVisible();
+      await expect(typeaheadItem).toBeVisible({ timeout: 15000 });
       await typeaheadItem.click();
       await page.getByTestId('tag-edit-done-btn').click();
     });
@@ -99,11 +102,11 @@ test.describe
     test('Successfully order page search results by tag', async ({ page }) => {
       await page.goto('/');
 
-      await page.locator('.grw-tag-simple-bar').locator('a').click();
+      await page.locator('.grw-tag-simple-bar').locator('button').click();
 
-      expect(page.getByTestId('search-result-base')).toBeVisible();
-      expect(page.getByTestId('search-result-list')).toBeVisible();
-      expect(page.getByTestId('search-result-content')).toBeVisible();
+      await expect(page.getByTestId('search-result-base')).toBeVisible();
+      await expect(page.getByTestId('search-result-list')).toBeVisible();
+      await expect(page.getByTestId('search-result-content')).toBeVisible();
     });
   });