Commit Graph

124 Commits

Author SHA1 Message Date
Karim shoair 9fee49c928 test: fixes to storage tests 2026-03-25 00:13:42 +02:00
Karim shoair df4b1ac7e3 Merge branch 'dev' into test/storage-core-coverage 2026-03-22 18:05:42 +02:00
Karim shoair bf9e2da329 Merge branch 'dev' into test/edge-cases-filter-ancestors-find-similar 2026-03-17 22:15:59 +02:00
Karim shoair 4c07b294ae Merge branch 'dev' into fix/preserve-http-method-on-retry 2026-03-17 22:04:57 +02:00
Karim shoair 136c389787 fix(Texthandler): Replace get_all with getall to match the Selector class 2026-03-17 21:53:17 +02:00
Karim shoair 5123590a15 Merge branch 'dev' into test/custom-types-coverage 2026-03-17 21:42:17 +02:00
Karim shoair cc6c0dbfb9 fix: adjust test to the _restore_from_checkpoint fix 2026-03-17 17:46:47 +02:00
Karim shoair 6699213bdc Merge branch 'dev' into test/storage-core-coverage 2026-03-17 17:31:31 +02:00
karesansui 5bf921b308 fix: preserve HTTP method across retries in spider session
SessionManager.fetch() pops `method` from `_session_kwargs`,
which mutates the original request dict. When the engine retries
a blocked request via request.copy(), the copy no longer has
`method`, so it defaults to GET.

Steps to reproduce:
1. Yield Request(url, method="POST", data=...)
2. Target returns a response that triggers is_blocked()
3. Engine retries via request.copy() → second fetch uses GET

Fix: copy the kwargs dict before popping, so the original
request stays intact.
2026-03-17 00:53:52 +09:00
awanawona cec5acd68a test: add edge case tests for filter, iterancestors, and find_similar
- test_selectors_filter.py: covers chained filter(), empty result,
  all-pass predicate, and calling filter() on empty Selectors
- test_ancestor_navigation.py: covers iterancestors() order, depth,
  text-node safety, root-element edge case, and find_ancestor() with
  no match
- test_find_similar_advanced.py: covers similarity_threshold levels,
  match_text=True behavior, ignore_attributes combinations, and
  text-node safety
2026-03-16 18:01:11 +08:00
Karim shoair 1e7704864e Merge branch 'dev' into test/custom-types-coverage 2026-03-15 16:38:48 +02:00
Karim shoair 656dbc7d12 Merge branch 'dev' into test/normalize-credentials-coverage 2026-03-15 16:24:59 +02:00
haosenwang1018 7178279586 test: add coverage for TextHandler regex, clean, and TextHandlers.re()
Several critical code paths in custom_types.py lacked test coverage:

- TextHandler.re(check_match=True): returns bool, not TextHandlers
- TextHandler.re(replace_entities=False): entity preservation path
- TextHandler.re() with capture groups: flatten behavior
- TextHandler.re_first() default value when no match
- TextHandler.clean(remove_entities=True): entity replacement path
- TextHandler.json() valid and invalid input
- TextHandlers.re(): list-level regex with result flattening
- TextHandlers.extract()/get_all(): identity return

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:27:55 +08:00
haosenwang1018 297423410d test: add save/retrieve round-trip and hash/URL coverage for storage core
The adaptive scraping feature relies on SQLiteStorageSystem to persist
and relocate elements, but the existing tests only verified object
creation — not the actual save/retrieve workflow. This adds:

- _get_base_url: None, empty, valid URL, and case-normalization paths
- _get_hash: determinism, uniqueness, strip/lowercase, length suffix
- save/retrieve round-trip: basic, overwrite (upsert), nonexistent key
- URL-based isolation between different websites
- element_to_dict: with/without text, attributes, whitespace filtering
- _get_element_path: nested and root element paths
- Thread safety: 20 concurrent saves with result verification

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:27:10 +08:00
Andrew Barnes 54fcb7c364 test(ai): add _normalize_credentials edge case coverage 2026-03-15 00:14:54 -04:00
Karim shoair d48ac78c79 test: update tests accordingly 2026-03-09 00:28:32 +02:00
Karim shoair b547e04207 ops: update playwright pinned version 2026-03-09 00:05:46 +02:00
Karim shoair b0c8448f81 Merge branch 'dev' into fix/google-referrer-spoof 2026-03-08 19:01:20 +02:00
Andrew Barnes 68b9e128bc fix: return bare Google URL in referer instead of search query
Real browsers send `https://www.google.com/` as the Referer header
when clicking search results, not the full search URL with query
parameters. The previous format was a fingerprinting signal that
the referer was spoofed.

Closes #172
2026-03-08 11:32:04 -04:00
Matt Hillebrand 7cbe566acd Move test for get_all_text to test_parser_advanced.py 2026-03-08 08:20:30 -07:00
Matt Hillebrand 00ad6b4c5f Add two ignored elements to unit test 2026-03-07 17:11:39 -08:00
Matt Hillebrand 5457a697fa fix: Selector.get_all_text() doesn't get all text #167
- Updated text extraction using recursion
- Added new unit test
2026-03-07 17:11:39 -08:00
Karim shoair 50a69c3583 ops: update workflows triggers
and pinning playwright version here too
2026-02-28 16:45:26 +02:00
Karim shoair e34651d887 fix(stealth): improve stealth mode by removing unnecessary scripts
It doesn't add anything to the table as before (it might turn out I was wrong and add them again lol)
2026-02-27 03:50:14 +02:00
Karim shoair e35ba3455c test: add tests for spiders engine
Automated tests written by AI
2026-02-15 04:35:28 +02:00
Karim shoair 0ab54852c4 fix: use more accurate naming for proxy rotation strategy
It can be considered the simplest form of round robin since we don't have weights or anything (as was originally planned), but let's change it to avoid confusion or useless debates. Here goes nothing
2026-02-14 23:19:54 +02:00
Karim shoair 2997d562d5 test: remove irrelevent test 2026-02-14 03:34:41 +02:00
Karim shoair d0a5a01299 test: update spider check 2026-02-14 02:51:39 +02:00
Karim shoair 16852cb1ac style: Use shorter and more accurate naming for constants 2026-02-07 16:37:47 +02:00
Karim shoair 5f557a7f9f test: add tests for the new feature 2026-02-07 01:28:58 +02:00
Karim shoair 9acc8194c5 test: update the tests accordingly 2026-02-06 02:45:13 +02:00
Karim shoair 6e0277f23b test: add new tests for the proxy rotation logic 2026-02-02 00:16:40 +02:00
Karim shoair d90189e675 test: update tests accordingly 2026-01-20 20:22:47 +02:00
Karim shoair d0f52c3855 test: remove the tests for the removed html_utils module 2026-01-20 16:37:17 +02:00
Karim shoair 0ec78e2335 test: update tests accordingly 2026-01-19 16:40:18 +02:00
Karim shoair 94bc759c6a test: updates tests to include new logic 2026-01-19 16:13:29 +02:00
Karim shoair d247b5b691 test: add tests for the spiders system
It's generated by Opus on Claude Code. It's very good as per my review and instructions, but I will have another look later.
2026-01-19 03:46:00 +02:00
Karim shoair 9eb5f68fcb test: update tests accordingly 2026-01-08 00:52:35 +02:00
Karim shoair 2f87507afe test: update database test to suite windows 2026-01-03 22:02:03 +02:00
Karim shoair f99baf65f7 test: remove the check for incognito 2026-01-03 01:50:46 +02:00
Karim shoair 33c5633c58 test: correcting tests with the new arguments 2025-12-30 22:06:37 +02:00
Karim shoair b1cd5c5a82 test: fix old assert test 2025-12-28 00:16:37 +02:00
Karim shoair a4ad6b5fce test: remove old test 2025-12-28 00:03:09 +02:00
Karim shoair 2af21e240d test: remove problematic sync tests
The async version are the same tests
2025-12-27 14:02:02 +02:00
Karim shoair fdfd5bf96b test: update all tests accordingly 2025-12-26 03:22:56 +02:00
Karim shoair 9443ab80ae test: update tests accordingly 2025-12-18 01:14:05 +02:00
Karim shoair ab23b71836 tests(fetchers): Update tests to use the new argument naming 2025-11-26 02:23:54 +02:00
Karim shoair 57e11cef76 tests: Update tests accordingly 2025-11-25 20:25:23 +02:00
Karim shoair 2751653190 test: add tests for the new impersonate logic 2025-11-16 16:34:24 +02:00
Karim shoair f9303ab275 test: update session tests 2025-10-06 06:53:24 +03:00