Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

fix: cover Tokopedia mobile storefront

Barack Sokullud3ca75aada89
diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js
index 4a5d95db8..fc2cd24b2 100644
--- a/src/chrome/src/agent/adapters.js
+++ b/src/chrome/src/agent/adapters.js
@@ -17758,7 +17758,7 @@ const ADAPTERS = [
{
name: 'tokopedia',
category: 'general',
- matches: (url) => /^https?:\/\/(?:www\.)?tokopedia\.com\//.test(url),
+ matches: (url) => /^https?:\/\/(?:(?:www|m)\.)?tokopedia\.com\//.test(url),
notes: `
- Tokopedia (tokopedia.com) is Indonesia's largest marketplace. Many products have multiple sellers β€” use the product page's seller line; do NOT infer a single seller from search cards.
- Variant trap: "Wajib pilih varian" (must choose variant) blocks "Keranjang" until size/color/capacity is chosen β€” pick the exact variant first, then "Masukkan Keranjang" / "Beli Langsung". "Beli Langsung" skips cart, so do not use it for comparison.
diff --git a/src/firefox/src/agent/adapters.js b/src/firefox/src/agent/adapters.js
index 9483ab9c8..ce94fd2a5 100644
--- a/src/firefox/src/agent/adapters.js
+++ b/src/firefox/src/agent/adapters.js
@@ -17756,7 +17756,7 @@ const ADAPTERS = [
{
name: 'tokopedia',
category: 'general',
- matches: (url) => /^https?:\/\/(?:www\.)?tokopedia\.com\//.test(url),
+ matches: (url) => /^https?:\/\/(?:(?:www|m)\.)?tokopedia\.com\//.test(url),
notes: `
- Tokopedia (tokopedia.com) is Indonesia's largest marketplace. Many products have multiple sellers β€” use the product page's seller line; do NOT infer a single seller from search cards.
- Variant trap: "Wajib pilih varian" (must choose variant) blocks "Keranjang" until size/color/capacity is chosen β€” pick the exact variant first, then "Masukkan Keranjang" / "Beli Langsung". "Beli Langsung" skips cart, so do not use it for comparison.
diff --git a/test/run.js b/test/run.js
index dc5573c72..fba2d6d49 100644
--- a/test/run.js
+++ b/test/run.js
@@ -10265,6 +10265,15 @@ test('Noon adapter covers its primary and Supermall storefronts without trusting
}
});
+test('Tokopedia adapter covers desktop and mobile storefronts without trusting lookalikes', () => {
+ for (const getAdapter of [getActiveAdapter, getActiveAdapterFx]) {
+ assert.equal(getAdapter('https://www.tokopedia.com/example/product')?.name, 'tokopedia');
+ assert.equal(getAdapter('https://m.tokopedia.com/example/product')?.name, 'tokopedia');
+ assert.notEqual(getAdapter('https://m.tokopedia.com.evil.example/example/product')?.name, 'tokopedia');
+ assert.notEqual(getAdapter('https://example.com/?next=https://m.tokopedia.com/example/product')?.name, 'tokopedia');
+ }
+});
+
test('India payment and Tatkal guidance keeps finance, timing, and authentication safety signals', () => {
for (const getAdapter of [getActiveAdapter, getActiveAdapterFx]) {
const paytm = getAdapter('https://paytm.com/recharge');