Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

refactor(ui-tests): migrate remaining create-button matchers to helper (#4091)

LearningCircuit0c20ec6dff60
diff --git a/tests/ui_tests/test_mobile_interactions_ci.js b/tests/ui_tests/test_mobile_interactions_ci.js
index cde920c35d..c2dae4635d 100644
--- a/tests/ui_tests/test_mobile_interactions_ci.js
+++ b/tests/ui_tests/test_mobile_interactions_ci.js
@@ -59,12 +59,7 @@ const MobileModalTests = {
await navigateTo(page, `${baseUrl}/collections`);
// Open modal first
- await page.evaluate(() => {
- const buttons = Array.from(document.querySelectorAll('button, a.btn'));
- const trigger = buttons.find(b => b.textContent?.toLowerCase().includes('create'));
- if (trigger) trigger.click();
- });
-
+ await findActionButton(page, { keywords: ['create'], click: true });
await delay(500);
// Check if modal is open
@@ -145,13 +140,7 @@ const MobileModalTests = {
await navigateTo(page, `${baseUrl}/collections`);
// Open modal
- await page.evaluate(() => {
- const trigger = Array.from(document.querySelectorAll('button, a.btn')).find(b =>
- b.textContent?.toLowerCase().includes('create')
- );
- if (trigger) trigger.click();
- });
-
+ await findActionButton(page, { keywords: ['create'], click: true });
await delay(500);
const result = await page.evaluate(() => {
diff --git a/tests/ui_tests/test_news_subscriptions_ci.js b/tests/ui_tests/test_news_subscriptions_ci.js
index 961b9cef65..27060b76dc 100644
--- a/tests/ui_tests/test_news_subscriptions_ci.js
+++ b/tests/ui_tests/test_news_subscriptions_ci.js
@@ -291,16 +291,10 @@ const SubscriptionsPageTests = {
async subscriptionFormModal(page, baseUrl) {
await navigateTo(page, `${baseUrl}/news/subscriptions`);
- // Try to click create button to open modal
- // Use XPath for text-based button selection (Puppeteer doesn't support :has-text)
- let createBtn = await page.$('.btn-primary, .create-btn, [data-action="create"]');
- if (!createBtn) {
- // Try XPath for text-based selection
- const buttons = await page.$x('//button[contains(translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "create") or contains(translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "new") or contains(translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "add")]');
- createBtn = buttons.length > 0 ? buttons[0] : null;
- }
-
- if (!createBtn) {
+ // findActionButton uses word-boundary matching, replacing a brittle
+ // CSS+XPath fallback that used substring `contains("new")`.
+ const { found } = await findActionButton(page, { click: true });
+ if (!found) {
// Check if form is inline instead of modal
const inlineForm = await page.$('form.subscription-form, #subscription-form');
if (inlineForm) {
@@ -309,7 +303,6 @@ const SubscriptionsPageTests = {
return { passed: null, skipped: true, message: 'No create button to open subscription form' };
}
- await createBtn.click();
await delay(500);
const result = await page.evaluate(() => {
@@ -340,15 +333,10 @@ const SubscriptionsPageTests = {
async subscriptionFormFields(page, baseUrl) {
await navigateTo(page, `${baseUrl}/news/subscriptions`);
- // Try to open form
- // Use CSS selectors first, then try XPath for text-based selection
- let createBtn = await page.$('.btn-primary, .create-btn, [data-action="create"]');
- if (!createBtn) {
- const buttons = await page.$x('//button[contains(translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "create") or contains(translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "new")]');
- createBtn = buttons.length > 0 ? buttons[0] : null;
- }
- if (createBtn) {
- await createBtn.click();
+ // findActionButton uses word-boundary matching so "Back to News Feed" no
+ // longer triggers on `new`. Replaces the prior CSS+XPath fallback.
+ const { found } = await findActionButton(page, { click: true });
+ if (found) {
await delay(500);
}