summaryrefslogtreecommitdiff
path: root/app/src/debug/res
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-08-24 08:10:17 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-08-24 08:10:17 +0000
commitead050b61fba23fd9f9d26dada997309dcb1d9ba (patch)
treea65b35c310c1140fc54b69c81d08a71336401f45 /app/src/debug/res
parentb94f79990acb090d38591b5fcfa9147e86779a2b (diff)
Add instrumented extraction fixture tests for WHT/Ars Technica
BACKLOG's "Extraction test coverage for WHT / Ars Technica" item: ReaderExtractor's site-specific preprocessing had only ever been diagnosed by hand against single live articles across several rounds of fixes. Four hand-authored fixtures now pin down the exact behavior: - West Hawaii Today's paywall-div unhide (class="paywall paywall_*") - Lazy-loaded image src resolution (data-src -> src) - Ars Technica's duplicate PhotoSwipe caption removal (.pswp-caption-content vs. the real <figcaption>) - Ars's split .post-content.post-content-double block merge Needs a real WebView to run Readability.js, so these are instrumented tests (app/src/androidTest/), not plain JVM unit tests -- that source set didn't exist yet (testInstrumentationRunner + androidx.test deps added to app/build.gradle.kts). Fixtures are minimal hand-authored markup targeting the exact selectors ReaderExtractor's own code uses, not scraped live pages, which rot and would fail for reasons unrelated to the extraction logic. Fixtures are served over real http:// via MockWebServer, since ReaderExtractor's WebView has allowFileAccess = false and won't load file:// URLs. Added a debug-only network security config override (app/src/debug/res/xml/network_security_config.xml) permitting cleartext to 127.0.0.1/localhost for this -- release is untouched. Verified the tests actually catch regressions, not just pass trivially: temporarily broke the paywall-unhide selector, confirmed the corresponding test failed on both connected emulators, then reverted and confirmed green again. Ran on 2 connected devices (feedreader_test, doot_test_api36): 4/4 passing, 0 failures. Instrumented tests aren't counted by the JVM-only jacoco coverage metric (expected, not a gate miss -- see CLAUDE.md). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GMEkHeqKz6FLkmizowBTK
Diffstat (limited to 'app/src/debug/res')
-rw-r--r--app/src/debug/res/xml/network_security_config.xml17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/src/debug/res/xml/network_security_config.xml b/app/src/debug/res/xml/network_security_config.xml
new file mode 100644
index 0000000..f953272
--- /dev/null
+++ b/app/src/debug/res/xml/network_security_config.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Debug-build-only override of app/src/main/res/xml/network_security_config.xml (AGP resource
+ merging picks the most specific source set for a same-named resource, so this fully replaces
+ the main one in debug builds; release is untouched). Adds cleartext-permitted 127.0.0.1 so
+ ReaderExtractor's WebView can load fixture HTML from MockWebServer in instrumented tests
+ (app/src/androidTest/.../ReaderExtractorFixtureTest.kt); the instrumented test and the WebView
+ it drives both run on-device, so the server is reached via loopback, not 10.0.2.2.
+-->
+<network-security-config>
+ <domain-config cleartextTrafficPermitted="true">
+ <domain includeSubdomains="false">webpolicy.org</domain>
+ <domain includeSubdomains="false">bit-player.org</domain>
+ <domain includeSubdomains="false">127.0.0.1</domain>
+ <domain includeSubdomains="false">localhost</domain>
+ </domain-config>
+</network-security-config>