Playwright

Like posts with the mouse and the keyboard

Easy30 pts~2 min
  • Scoped locators
  • Toggle buttons
  • Keyboard input
  • ARIA state
Practice app · ConnectIn

A professional network: a 3-step sign-up wizard, a feed with likes, comments and lazy-loaded posts, a notifications dropdown, a messaging drawer with auto-replies, job search with filters and a multi-step Easy Apply modal, member profiles with connect/withdraw, a skills tag input and company pages that open a careers site in a new tab.

Test URL
/lab/playwright-connectin-like-post

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Like Maya Chen's post with a mouse click and Daniel Okafor's post with the keyboard, and verify each Like button is pressed and each like count went up by one.

Your task

  1. 1Open TEST_URL (you are already signed in as Alex Morgan).
  2. 2In the post with data-post-id="p1" (Maya Chen), assert .like-count shows 128, then click its Like button (.like-button).
  3. 3Assert the button now has aria-pressed="true" and .like-count shows 129.
  4. 4In the post with data-post-id="p2" (Daniel Okafor), focus the Like button and press Enter — do not click it.
  5. 5Assert that post's .like-count shows 57 and exactly two Like buttons on the page are pressed.

Acceptance criteria

  • Post p1 is liked and shows 129 likes.
  • Post p2 is liked and shows 57 likes.
  • Exactly two posts are liked.
  • The test makes at least two assertions.

Fixtures

Email
alex@connectin.test
Password
Connect@2026
Account name
Alex Morgan
Password rules
8+ characters with an uppercase letter, a number and a special character
Locations
Bengaluru, India · Berlin, Germany · London, UK · New York, US · Toronto, Canada
Featured company
Northwind Labs (#/company/northwind-labs)

Playwright · Playwright Challenges · ConnectIn