fix: 兼容非滚动面板颜色节点 (#155)
This commit is contained in:
@@ -430,6 +430,37 @@ class PddCollectParserTest(unittest.TestCase):
|
||||
self.assertEqual(result.raw_price, "¥8.17")
|
||||
self.assertNotIn("确认款式", [item.name for item in result.dimensions])
|
||||
|
||||
def test_non_scrollable_spec_panel_exposes_three_color_rows(self):
|
||||
service = PddCollectService(
|
||||
PddDeviceService(lambda _serial: object()),
|
||||
"USB-001",
|
||||
"client-001",
|
||||
)
|
||||
|
||||
rows = service._visible_color_rows(self.non_scrollable_spec_xml)
|
||||
|
||||
self.assertEqual(
|
||||
[[item.text for item in row] for row in rows],
|
||||
[
|
||||
["测试黑色", "测试黑色+网袜"],
|
||||
["测试黑色+丝袜", "测试黑色+短袜"],
|
||||
["测试黑色+长袜"],
|
||||
],
|
||||
)
|
||||
self.assertTrue(all(item.available for row in rows for item in row))
|
||||
self.assertTrue(all(item.bounds for row in rows for item in row))
|
||||
|
||||
def test_clickable_text_outside_spec_panel_is_not_an_option(self):
|
||||
xml_data = """<hierarchy>
|
||||
<node class="android.widget.FrameLayout" bounds="[0,0][1080,2400]">
|
||||
<node text="测试黑色" clickable="true"
|
||||
bounds="[36,1295][276,1382]" />
|
||||
</node>
|
||||
</hierarchy>"""
|
||||
root = ET.fromstring(xml_data)
|
||||
|
||||
self.assertIsNone(PddCollectService._find_option_node(root, "测试黑色"))
|
||||
|
||||
def test_wait_accepts_non_scrollable_spec_panel_without_sleep(self):
|
||||
device = FakeCollectDevice(self.home_xml, self.non_scrollable_spec_xml)
|
||||
device.opened_url = "https://mobile.yangkeduo.com/goods.html?goods_id=123"
|
||||
|
||||
Reference in New Issue
Block a user