Skip to content

Commit 8dd9a16

Browse files
vdusekclaude
andcommitted
test: merge Scrapy server.py into the shared base server
Add direct product links to the base server homepage so Scrapy spiders (which look for /products/ links on the start page) work without their own server.py. Now all e2e tests share a single server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2144a1f commit 8dd9a16

3 files changed

Lines changed: 10 additions & 92 deletions

File tree

tests/e2e/actor_source_base/server.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
33
Serves an e-commerce test website with a category-based structure for testing crawl depth:
44
5-
/ (depth 0) - Homepage with links to categories, about page, and deep chain
5+
/ (depth 0) - Homepage with links to products, categories, about page, and deep chain
66
/categories/electronics (depth 1) - Links to products 1 and 2
77
/categories/home (depth 1) - Links to product 3
88
/about (depth 1) - About page
99
/deep/1 (depth 1) -> /deep/2 (depth 2) -> /deep/3 (depth 3) -> ... (infinite chain)
10-
/products/1 (depth 2) - Widget A
11-
/products/2 (depth 2) - Widget B
12-
/products/3 (depth 2) - Widget C
10+
/products/1 (depth 1 or 2) - Widget A
11+
/products/2 (depth 1 or 2) - Widget B
12+
/products/3 (depth 1 or 2) - Widget C
1313
14-
With max_crawl_depth=2, the crawler reaches all products but does not go beyond /deep/2.
14+
The homepage includes both direct product links (for Scrapy spiders that look for /products/ links
15+
on the start page) and category links (for testing crawl depth with Crawlee crawlers).
16+
With max_crawl_depth=2, the crawler reaches all products and categories but does not go beyond /deep/2.
1517
"""
1618

1719
from __future__ import annotations
@@ -54,6 +56,9 @@ async def app(scope: dict[str, Any], _receive: Receive, send: Send) -> None:
5456
send,
5557
'<html><head><title>E-commerce Test Store</title></head><body>'
5658
'<h1>Welcome to Test Store</h1>'
59+
'<a href="/products/1">Widget A</a>'
60+
'<a href="/products/2">Widget B</a>'
61+
'<a href="/products/3">Widget C</a>'
5762
'<a href="/categories/electronics">Electronics</a>'
5863
'<a href="/categories/home">Home &amp; Garden</a>'
5964
'<a href="/about">About Us</a>'

tests/e2e/test_scrapy/actor_source/server.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

tests/e2e/test_scrapy/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def get_scrapy_source_files(
2222
extra_source_files: dict[str, str] | None = None,
2323
) -> dict[str, str]:
2424
source_files: dict[str, str] = {
25-
'server.py': read_actor_source('server.py'),
2625
'src/__main__.py': read_actor_source('__main__.py'),
2726
'src/main.py': read_actor_source('main.py'),
2827
'src/settings.py': read_actor_source('settings.py'),

0 commit comments

Comments
 (0)