Skip to content

Commit e71428e

Browse files
FanqingMxyliugo
authored andcommitted
Fix/pw tasks (#88)
Co-authored-by: xyliugo <[email protected]>
1 parent a8437a8 commit e71428e

File tree

20 files changed

+870
-994
lines changed

20 files changed

+870
-994
lines changed

tasks/playwright_webarena/reddit/task_1/description.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,18 @@ Create a daily routine tracking system on the Postmill forum platform by setting
22

33
**Task Requirements:**
44

5-
1. Navigate to http://35.247.158.69:9999 and Create a new account with the exact username "RoutineTracker2025" and password "DailyRoutine123!"
5+
1. Navigate to http://34.143.228.182:9999 and Create a new account with the exact username "RoutineTracker2025" and password "DailyRoutine123!"
66

7-
2. Navigate to the LifeProTips forum (/f/LifeProTips) and locate the following specific post:
7+
2. Locate the following specific post:
88
- Title: "LPT: Use your calendar as your to-do list. Assigning dedicated time to tasks increases the likelyhood of you acting upon it."
9-
- It should have exactly 179 comments
10-
- Record its current upvote count for later verification
9+
- Record the content of the most upvoted comment of this post
1110

1211
3. Create a new submission in the LifeProTips forum with these exact specifications:
1312
- Title: "My 5-Step Morning Routine That Increased My Productivity by 200%"
14-
- Body content must be exactly:
15-
```
16-
After years of struggling with mornings, I discovered these 5 steps:
17-
```
18-
- Note: When entering the content, use markdown list syntax with dashes (-) for the bullet points
13+
- Body content must be the content recorded in the above step
1914

2015
4. After successfully posting, verify that your post appears in the LifeProTips forum listing
2116

22-
5. Engage with the community by upvoting exactly these three posts:
17+
5. Engage with the community by upvoting exactly these two posts:
2318
- The calendar to-do list post you found in step 2
24-
- The post titled "LPT: clean your stovetop after using the oven. The heat loosens grime for easy removal"
25-
26-
6. Navigate to your user profile (/user/RoutineTracker2025) and confirm that your statistics show:
27-
- Exactly 1 submission
28-
- The account was created successfully
29-
30-
**Success Criteria:**
31-
- Account created with the exact username specified
32-
- Post created with exact title and body content
33-
- All three specified posts have been upvoted (verify button state changes)
34-
- User profile shows correct submission count
35-
- All navigation and interactions completed successfully
19+
- The post titled "LPT: clean your stovetop after using the oven. The heat loosens grime for easy removal"

tasks/playwright_webarena/reddit/task_1/label.txt

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

tasks/playwright_webarena/reddit/task_1/verify.py

Lines changed: 73 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,9 @@ async def verify() -> bool:
1818
page = await context.new_page()
1919

2020
try:
21-
# Navigate to the main page
22-
await page.goto("http://35.247.158.69:9999/", wait_until="networkidle")
23-
24-
# Take a screenshot to verify the page is accessible
25-
screenshot_dir = Path(__file__).parent
26-
screenshot_path = (
27-
screenshot_dir
28-
/ f"verify_homepage_{datetime.now().strftime('%Y%m%d_%H%M%S')}.png"
29-
)
30-
await page.screenshot(path=str(screenshot_path), full_page=True)
31-
print(f"Screenshot saved to: {screenshot_path}", file=sys.stderr)
21+
# Step 1: Check if account can be logged in
22+
print("Step 1: Verifying account login...", file=sys.stderr)
23+
await page.goto("http://34.143.228.182:9999/", wait_until="networkidle")
3224

3325
# Check if already logged in
3426
user_button = page.locator('button:has-text("RoutineTracker2025")')
@@ -51,169 +43,102 @@ async def verify() -> bool:
5143
# Check if login successful
5244
user_button = page.locator('button:has-text("RoutineTracker2025")')
5345
if not await user_button.count():
54-
print("Error: Login failed for RoutineTracker2025", file=sys.stderr)
46+
print("Error: Account login failed for RoutineTracker2025", file=sys.stderr)
5547
return False
5648

57-
print("Successfully logged in as RoutineTracker2025", file=sys.stderr)
58-
59-
# Take a screenshot after successful login
60-
screenshot_path = (
61-
screenshot_dir
62-
/ f"verify_after_login_{datetime.now().strftime('%Y%m%d_%H%M%S')}.png"
63-
)
64-
await page.screenshot(path=str(screenshot_path), full_page=True)
65-
print(
66-
f"Screenshot after login saved to: {screenshot_path}",
67-
file=sys.stderr,
68-
)
49+
print("✓ Account login successful", file=sys.stderr)
50+
else:
51+
print("✓ Already logged in as RoutineTracker2025", file=sys.stderr)
6952

70-
# Navigate to user submissions page to check for the post
53+
# Step 2: Check if the post exists in LifeProTips forum with correct content
54+
print("Step 2: Verifying post in LifeProTips forum...", file=sys.stderr)
7155
await page.goto(
72-
"http://35.247.158.69:9999/user/RoutineTracker2025/submissions",
73-
wait_until="networkidle",
74-
)
75-
76-
# Check if the post with the exact title exists
77-
expected_title = (
78-
"My 5-Step Morning Routine That Increased My Productivity by 200%"
79-
)
80-
post_title_link = page.locator(f'h1 a:has-text("{expected_title}")')
81-
if not await post_title_link.count():
82-
print(
83-
f"Error: Post with title '{expected_title}' not found in user submissions",
84-
file=sys.stderr,
85-
)
86-
return False
87-
88-
print("User submission verified successfully", file=sys.stderr)
89-
90-
# Navigate to LifeProTips forum
91-
await page.goto(
92-
"http://35.247.158.69:9999/f/LifeProTips", wait_until="networkidle"
56+
"http://34.143.228.182:9999/f/LifeProTips", wait_until="networkidle"
9357
)
9458

9559
# Check for the created post
96-
post_title = (
97-
"My 5-Step Morning Routine That Increased My Productivity by 200%"
98-
)
99-
post_link = page.locator(f'a:has-text("{post_title}")')
60+
expected_title = "My 5-Step Morning Routine That Increased My Productivity by 200%"
61+
post_link = page.locator(f'a:has-text("{expected_title}")')
62+
10063
if not await post_link.count():
101-
print(
102-
f"Error: Post with title '{post_title}' not found", file=sys.stderr
103-
)
64+
print(f"Error: Post with title '{expected_title}' not found in LifeProTips forum", file=sys.stderr)
10465
return False
10566

10667
# Click on the post to verify content
10768
await post_link.click()
10869
await page.wait_for_load_state("networkidle")
10970

110-
# Verify post content
111-
expected_content = """After years of struggling with mornings, I discovered these 5 steps:"""
71+
# Verify post content - this should be the content from the most upvoted comment of the calendar post
72+
expected_content = "As a college student, having a visible reminder of the assignments I have and when they are due is super helpful for me. It also just feels good to erase them from the board once they are completed."
11273

11374
# Check if the content exists in the page
11475
content_found = False
115-
paragraphs = await page.locator("article p").all()
116-
for p in paragraphs:
117-
text = await p.text_content()
118-
if text and expected_content in text:
119-
content_found = True
120-
break
76+
article_content = await page.locator("article").text_content()
77+
if article_content and expected_content in article_content:
78+
content_found = True
12179

12280
if not content_found:
123-
print(
124-
"Error: Post content does not match expected content",
125-
file=sys.stderr,
126-
)
81+
print(f"Error: Post content does not match expected content", file=sys.stderr)
82+
print(f"Expected: {expected_content}", file=sys.stderr)
12783
return False
12884

129-
# Navigate back to LifeProTips to check upvoted posts
130-
await page.goto(
131-
"http://35.247.158.69:9999/f/LifeProTips", wait_until="networkidle"
132-
)
85+
print("✓ Post found in LifeProTips with correct title and content", file=sys.stderr)
13386

134-
# Define expected upvote counts after upvoting
135-
# Note: In the test environment, all upvoted posts show "1"
136-
expected_upvotes = {
137-
"calendar": {
138-
"title": "Use your calendar as your to-do list",
139-
"expected_count": "1", # After upvoting, shows 1
140-
"comments": "179 comments",
141-
},
142-
"stovetop": {
143-
"title": "clean your stovetop after using the oven",
144-
"expected_count": "1", # After upvoting, shows 1
145-
},
146-
}
147-
148-
# Check all posts for upvotes
87+
# Step 3: Check upvotes via search
88+
print("Step 3: Verifying upvotes on posts...", file=sys.stderr)
89+
90+
# Check first post upvote
91+
search_url1 = "http://34.143.228.182:9999/search?q=LPT%3A+Use+your+calendar+as+your+to-do+list.+Assigning+dedicated+time+to+tasks+increases+the+likelyhood+of+you+acting+upon+it."
92+
await page.goto(search_url1, wait_until="networkidle")
93+
94+
# Find the post and check its upvote count
14995
posts = await page.locator("article").all()
150-
verification_results = {}
151-
152-
for post_key, post_info in expected_upvotes.items():
153-
found = False
154-
for post in posts:
155-
title_elem = post.locator("h1 a")
156-
if await title_elem.count():
157-
title = await title_elem.text_content()
158-
if post_info["title"] in title:
159-
# For calendar post, also verify comments
160-
if post_key == "calendar":
161-
comments = post.locator(
162-
f'text="{post_info["comments"]}"'
163-
)
164-
if not await comments.count():
165-
continue
166-
167-
# Get upvote count - look for the vote count element
168-
# Try multiple selectors for vote count
169-
vote_count = None
170-
171-
# Try 1: Look for span with class vote__net-score
172-
vote_count_elem = post.locator("span.vote__net-score")
173-
if await vote_count_elem.count():
174-
vote_count = await vote_count_elem.text_content()
175-
else:
176-
# Try 2: Look for generic element in the vote area
177-
vote_generic = post.locator(
178-
".submission__vote generic"
179-
).nth(1)
180-
if await vote_generic.count():
181-
vote_count = await vote_generic.text_content()
182-
183-
if vote_count:
184-
vote_count = vote_count.strip()
185-
186-
if vote_count == post_info["expected_count"]:
187-
verification_results[post_key] = True
188-
print(
189-
f"✓ {post_key} post upvoted successfully (count: {vote_count})"
190-
)
191-
else:
192-
print(
193-
f"Error: {post_key} post has {vote_count} upvotes, expected exactly {post_info['expected_count']}",
194-
file=sys.stderr,
195-
)
196-
return False
197-
else:
198-
print(
199-
f"Error: Could not find vote count for {post_key} post",
200-
file=sys.stderr,
201-
)
202-
return False
203-
204-
found = True
205-
break
206-
207-
if not found:
208-
print(f"Error: {post_key} post not found", file=sys.stderr)
209-
return False
96+
calendar_upvoted = False
97+
98+
for post in posts:
99+
title_elem = post.locator("h1 a")
100+
if await title_elem.count():
101+
title = await title_elem.text_content()
102+
if "Use your calendar as your to-do list" in title:
103+
# Check upvote count
104+
vote_count_elem = post.locator("span.vote__net-score")
105+
if await vote_count_elem.count():
106+
vote_count = await vote_count_elem.text_content()
107+
if vote_count and vote_count.strip() == "1":
108+
calendar_upvoted = True
109+
print("✓ Calendar post upvoted (count: 1)", file=sys.stderr)
110+
break
111+
112+
if not calendar_upvoted:
113+
print("Error: Calendar post not upvoted or upvote count is not 1", file=sys.stderr)
114+
return False
210115

211-
# Verify all posts were upvoted
212-
if len(verification_results) != 2 or not all(verification_results.values()):
213-
print("Error: Not all posts were upvoted correctly", file=sys.stderr)
116+
# Check second post upvote
117+
search_url2 = "http://34.143.228.182:9999/search?q=LPT%3A+clean+your+stovetop+after+using+the+oven.+The+heat+loosens+grime+for+easy+removal"
118+
await page.goto(search_url2, wait_until="networkidle")
119+
120+
posts = await page.locator("article").all()
121+
stovetop_upvoted = False
122+
123+
for post in posts:
124+
title_elem = post.locator("h1 a")
125+
if await title_elem.count():
126+
title = await title_elem.text_content()
127+
if "clean your stovetop after using the oven" in title:
128+
# Check upvote count
129+
vote_count_elem = post.locator("span.vote__net-score")
130+
if await vote_count_elem.count():
131+
vote_count = await vote_count_elem.text_content()
132+
if vote_count and vote_count.strip() == "1":
133+
stovetop_upvoted = True
134+
print("✓ Stovetop post upvoted (count: 1)", file=sys.stderr)
135+
break
136+
137+
if not stovetop_upvoted:
138+
print("Error: Stovetop post not upvoted or upvote count is not 1", file=sys.stderr)
214139
return False
215140

216-
print("Success: Daily routine tracking setup completed successfully.")
141+
print("Success: All verification steps passed!")
217142
return True
218143

219144
except PlaywrightTimeoutError as e:

tasks/playwright_webarena/reddit/task_2/description.md

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Research durable kitchen appliances on the BuyItForLife forum by extracting info
22

33
**Task Requirements:**
44

5-
1. Navigate to http://35.247.158.69:9999 and register a new account with username 'buyitforlife_researcher' and password 'BIFL2024Research!'
5+
1. Navigate to http://34.143.228.182:9999 and register a new account with username 'buyitforlife_researcher' and password 'BIFL2024Research!'
66

77
2. After successful registration, navigate to the BuyItForLife forum
88

9-
3. Find the top 3 posts with the highest upvote counts (sorted by upvotes, descending) and extract:
9+
3. Find the top 3 posts with the highest upvote counts and extract:
1010
- Exact post title
1111
- Exact upvote count
1212
- Exact number of comments
@@ -18,34 +18,22 @@ Research durable kitchen appliances on the BuyItForLife forum by extracting info
1818
5. From the BuyItForLife forum, identify the usernames of the authors who posted the top 3 posts with the highest number of upvotes
1919

2020
6. After collecting all the data, submit a new post in the BuyItForLife forum with:
21-
- Title: "BuyItForLife"
22-
- Body text must use EXACTLY these lines (keep the keys as-is, only replace the values after the colon):
21+
- Title: "Research Report for BuyItForLife"
22+
- Body text must be EXACTLY these lines without anything (keep the keys as-is, only replace the values after the pipe, follow the markdown format):
2323

2424
```
25-
Post1_Title: [FILL_VALUE]
26-
Post1_Upvotes: [FILL_VALUE]
27-
Post1_Comments: [FILL_VALUE]
28-
Post2_Title: [FILL_VALUE]
29-
Post2_Upvotes: [FILL_VALUE]
30-
Post2_Comments: [FILL_VALUE]
31-
Post3_Title: [FILL_VALUE]
32-
Post3_Upvotes: [FILL_VALUE]
33-
Post3_Comments: [FILL_VALUE]
34-
TopComment_Text: [FILL_VALUE]
35-
TopComment_Username: [FILL_VALUE]
36-
Post1_Author: [FILL_VALUE]
37-
Post2_Author: [FILL_VALUE]
38-
Post3_Author: [FILL_VALUE]
39-
```
40-
41-
**Success Criteria:**
42-
- Account successfully created with username 'buyitforlife_researcher'
43-
- Successfully navigated to the BuyItForLife forum
44-
- Found and extracted data from the top 3 posts by upvote count
45-
- Extracted the most upvoted comment from the highest-voted post
46-
- Recorded the commenter's username
47-
- Identified usernames of all top 3 post authors
48-
- Successfully submitted a new post in BuyItForLife forum with title "BuyItForLife"
49-
- Submission body contains exactly 14 lines in the specified Key: Value format
50-
- All data values are accurately filled based on the extracted information
51-
- All vote counts, titles, and usernames are exact matches from the website
25+
- Post1_Title|FILL_VALUE
26+
- Post1_Upvotes|FILL_VALUE
27+
- Post1_Comments|FILL_VALUE
28+
- Post2_Title|FILL_VALUE
29+
- Post2_Upvotes|FILL_VALUE
30+
- Post2_Comments|FILL_VALUE
31+
- Post3_Title|FILL_VALUE
32+
- Post3_Upvotes|FILL_VALUE
33+
- Post3_Comments|FILL_VALUE
34+
- TopComment_Text|FILL_VALUE
35+
- TopComment_Username|FILL_VALUE
36+
- Post1_Author|FILL_VALUE
37+
- Post2_Author|FILL_VALUE
38+
- Post3_Author|FILL_VALUE
39+
```

0 commit comments

Comments
 (0)