Social Portal Automation Practice (ConnectIn)
A hands-on guide to testing a social networking application with Selenium and Playwright · TesterRank team
ConnectIn is a professional social network with a feed, posts, likes and comments, explore/search, connections, messaging, notifications and profile settings. It behaves like a modern single-page app where content updates without page reloads.
Social apps are great for practising dynamic content: infinite lists, counters that change on click, real-time-style notifications and messaging between two users.
Demo login
| URL | /social/login |
|---|---|
rohan@connectin.com | |
| Password | Social@123 |
| Key locators | [data-testid='email-input'], [data-testid='password-input'], [data-testid='login-btn'], [data-testid='login-error'] |
All data is fictional and stored only in your browser. Clear site storage to reset the app.
What makes this app challenging to automate
Dynamic feed
Posts are added to the top of the feed. Locate a post by its text, not by index.
Like and comment counters
Clicking Like should increment by exactly one, and clicking again should decrement.
Messaging between users
Send a message as Rohan, log in as Meera and verify it arrived.
Settings persistence
Change a profile setting, reload, and verify it persisted.
Pages and what to practise on each
| Page | Practise |
|---|---|
| Feed | Create a post, like, comment, verify counters. |
| Explore | Search people/posts, connect buttons. |
| Messages | Conversation list and sending messages. |
| Notifications | Unread badges and mark-as-read. |
| Profile | Edit bio and verify the profile page. |
| Settings | Toggles and persistence after reload. |
Starter code: login test
Both examples use the app's stable data-testid attributes, which is the locator strategy most teams prefer over long XPaths. Copy one into your project, run it, then extend it to the pages above.
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.*;
import org.testng.Assert;
import org.testng.annotations.*;
import java.time.Duration;
public class ConnectInLoginTest {
WebDriver driver;
WebDriverWait wait;
@BeforeMethod
public void setUp() {
driver = new ChromeDriver();
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
driver.get("https://www.testerrank.com/social/login");
}
@Test
public void validLoginOpensApp() {
driver.findElement(By.cssSelector("[data-testid='email-input']"))
.sendKeys("rohan@connectin.com");
driver.findElement(By.cssSelector("[data-testid='password-input']"))
.sendKeys("Social@123");
driver.findElement(By.cssSelector("[data-testid='login-btn']")).click();
// Explicit wait: the URL leaves the login page after success
wait.until(ExpectedConditions.not(
ExpectedConditions.urlContains("/login")));
Assert.assertFalse(driver.getCurrentUrl().contains("/login"));
}
@AfterMethod
public void tearDown() { driver.quit(); }
}import { test, expect } from '@playwright/test';
test.describe('ConnectIn login', () => {
test.beforeEach(async ({ page }) => {
await page.goto('https://www.testerrank.com/social/login');
});
test('valid credentials open the app', async ({ page }) => {
await page.getByTestId('email-input').fill('rohan@connectin.com');
await page.getByTestId('password-input').fill('Social@123');
await page.getByTestId('login-btn').click();
await expect(page).not.toHaveURL(/login/);
});
test('wrong password shows an error', async ({ page }) => {
await page.getByTestId('email-input').fill('rohan@connectin.com');
await page.getByTestId('password-input').fill('Wrong@999');
await page.getByTestId('login-btn').click();
await expect(page.getByTestId('login-error')).toBeVisible();
});
});Guided exercises
- Publish a Post and Verify Feed Update (beginner)Automate social media feed posting and instant UI rendering.
- Like, Comment, and Real-Time Interaction Counter (beginner)Automate social engagement actions and assert counter increments.
- User Profile Update with Bio & Social Links (intermediate)Automate editing user profile information and verify persistent updates.
- Send Direct Message in Real-Time Chat (intermediate)Automate messaging conversations and message delivery confirmation.
- Search Users and Send Connection Request (advanced)Test user discovery and connection request lifecycle.
Edge cases worth testing
- Post with empty text or only spaces.
- Very long post text and emoji/Unicode content.
- Double-clicking Like quickly.
- Sending a message to yourself.
Test case writing practice
Before automating, write manual test cases. This portal has 19 reference scenarios across Feed Posts & Comments, User Profile & Privacy Settings, Connection Requests & Network Growth, Direct Messaging & Real-Time Chat. Try the test case challenge.
Interview questions from this app
How do you locate an element in a dynamic list?
Use a locator anchored on unique content (e.g. XPath with contains(text()) or Playwright getByText / filter({ hasText })) rather than positional indexes.
How do you handle StaleElementReferenceException?
Re-locate the element after the DOM updates, wait for the update to finish, and avoid storing WebElements across actions that re-render the list.