test: update listing pagination assertions for 20/page (was 100)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -285,8 +285,8 @@ def test_trade_pro_listing_layout_structure(factory):
|
|||||||
import re
|
import re
|
||||||
sid = site(factory)
|
sid = site(factory)
|
||||||
assert factory.post(f'/api/factory/sites/{sid}/bootstrap').status_code == 200
|
assert factory.post(f'/api/factory/sites/{sid}/bootstrap').status_code == 200
|
||||||
# 105 个产品:/categories/pumps/ 走 render_paginated(LIST_PAGE_SIZE=100,
|
# 105 个产品:/categories/pumps/ 走 render_paginated(LIST_PAGE_SIZE=20,
|
||||||
# 两页真实静态分页路由),比 101 次 /entries POST 便宜得多
|
# 六页真实静态分页路由),比 101 次 /entries POST 便宜得多
|
||||||
products = [{'type': 'product', 'title': f'Bulk Pump {i:03d}',
|
products = [{'type': 'product', 'title': f'Bulk Pump {i:03d}',
|
||||||
'summary': f'Bulk pump model {i:03d} for export.',
|
'summary': f'Bulk pump model {i:03d} for export.',
|
||||||
'meta': {'fields': {'brand': 'Quanta', 'category': 'Pumps'}}}
|
'meta': {'fields': {'brand': 'Quanta', 'category': 'Pumps'}}}
|
||||||
@@ -326,7 +326,7 @@ def test_trade_pro_listing_layout_structure(factory):
|
|||||||
assert len(s1.find_all('h1')) == 1
|
assert len(s1.find_all('h1')) == 1
|
||||||
nav1 = s1.select_one('nav.sf-tp-pagination')
|
nav1 = s1.select_one('nav.sf-tp-pagination')
|
||||||
assert nav1 is not None
|
assert nav1 is not None
|
||||||
assert len(s1.select('.sf-tp-card-grid--listing .sf-tp-card')) == 100
|
assert len(s1.select('.sf-tp-card-grid--listing .sf-tp-card')) == 20
|
||||||
active = nav1.select_one('.sf-tp-page-num.is-active[aria-current="page"]')
|
active = nav1.select_one('.sf-tp-page-num.is-active[aria-current="page"]')
|
||||||
assert active is not None and active.get_text(strip=True) == '1'
|
assert active is not None and active.get_text(strip=True) == '1'
|
||||||
nxt = nav1.select_one('a[rel="next"]')
|
nxt = nav1.select_one('a[rel="next"]')
|
||||||
@@ -339,7 +339,7 @@ def test_trade_pro_listing_layout_structure(factory):
|
|||||||
s2 = BeautifulSoup(cat2.text, 'html.parser')
|
s2 = BeautifulSoup(cat2.text, 'html.parser')
|
||||||
assert len(s2.find_all('h1')) == 1
|
assert len(s2.find_all('h1')) == 1
|
||||||
nav2 = s2.select_one('nav.sf-tp-pagination')
|
nav2 = s2.select_one('nav.sf-tp-pagination')
|
||||||
assert len(s2.select('.sf-tp-card-grid--listing .sf-tp-card')) == 5
|
assert len(s2.select('.sf-tp-card-grid--listing .sf-tp-card')) == 20
|
||||||
prev = nav2.select_one('a[rel="prev"]')
|
prev = nav2.select_one('a[rel="prev"]')
|
||||||
assert prev is not None and prev.get('href', '').endswith('/categories/pumps/')
|
assert prev is not None and prev.get('href', '').endswith('/categories/pumps/')
|
||||||
assert prev.select_one('svg') is not None
|
assert prev.select_one('svg') is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user