Insurance Portal Automation Practice (PolicyDekho)
A hands-on guide to testing a insurance policy management application with Selenium and Playwright · TesterRank team
The insurance portal covers what a policyholder does online: calculate a premium, view and renew policies, add nominees, upload documents, file a claim, pay premiums and raise support tickets. These flows are form-heavy and rule-heavy, which makes them excellent practice for validation testing.
Insurance and other BFSI projects hire many testers. Practising here gives you concrete examples to talk about: premium formulas, nominee share totals that must equal 100%, and document upload limits.
Demo login
| URL | /insurance/login |
|---|---|
rajesh@insurance.com | |
| Password | Insure@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
Premium calculator rules
Premium depends on age, cover amount and tenure. Write a data-driven test with a table of inputs and expected outputs (boundary ages are where bugs hide).
Nominee share validation
Shares across nominees must total 100%. Test 99%, 100% and 101% — classic boundary value analysis.
File uploads
The documents page accepts uploads. Practice sendKeys/setInputFiles and test file type and size limits.
Claim status lifecycle
A claim moves through statuses. Verify the status badge and timeline after each step.
Pages and what to practise on each
| Page | Practise |
|---|---|
| Premium calculator | Sliders, number inputs and computed premium assertions. |
| Policies | Policy list table, details view, status filters. |
| Nominees | Add/edit nominees, share percentage validation. |
| Documents | File upload, file type validation, delete uploaded file. |
| Claims | Multi-field claim form, claim status tracking. |
| Renew | Renewal flow with premium summary and payment. |
| Support | Ticket creation form and ticket list verification. |
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 PolicyDekhoLoginTest {
WebDriver driver;
WebDriverWait wait;
@BeforeMethod
public void setUp() {
driver = new ChromeDriver();
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
driver.get("https://www.testerrank.com/insurance/login");
}
@Test
public void validLoginOpensApp() {
driver.findElement(By.cssSelector("[data-testid='email-input']"))
.sendKeys("rajesh@insurance.com");
driver.findElement(By.cssSelector("[data-testid='password-input']"))
.sendKeys("Insure@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('PolicyDekho login', () => {
test.beforeEach(async ({ page }) => {
await page.goto('https://www.testerrank.com/insurance/login');
});
test('valid credentials open the app', async ({ page }) => {
await page.getByTestId('email-input').fill('rajesh@insurance.com');
await page.getByTestId('password-input').fill('Insure@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('rajesh@insurance.com');
await page.getByTestId('password-input').fill('Wrong@999');
await page.getByTestId('login-btn').click();
await expect(page.getByTestId('login-error')).toBeVisible();
});
});Guided exercises
- Get a health insurance quote (beginner)Automate the process of getting a health insurance quote by filling out the required details.
- Check policy details page (beginner)Verify the policy details page displays all relevant information for an existing policy.
- Compare two insurance plans (intermediate)Use the plan comparison feature to compare two different insurance plans side by side.
- Submit an insurance claim with documents (intermediate)Automate filing an insurance claim including document upload.
- Verify premium calculator output (intermediate)Test the premium calculator with various inputs and validate the calculated premiums.
- Upload claim documents (intermediate)Test the document upload functionality for an existing insurance claim.
- Verify beneficiary details form (intermediate)Test the beneficiary details form validation and submission.
- Track claim status changes (advanced)Verify that claim status transitions are displayed correctly in the claim timeline.
- Test policy renewal flow (advanced)Automate the end-to-end policy renewal process for an expiring policy.
- Calculate premium for different age groups (advanced)Validate that the premium calculation correctly adjusts for different age brackets.
Edge cases worth testing
- Enter ages at the exact minimum and maximum allowed limits.
- Upload a file with an unsupported extension or above the size limit.
- Add nominees whose shares total 101%.
- File a claim on an expired policy.
Test case writing practice
Before automating, write manual test cases. This portal has 24 reference scenarios across Premium Calculator, Claim Filing, Policy Renewal & Grace Period, KYC Document Verification. Try the test case challenge.
Interview questions from this app
How do you test a premium calculator?
Use equivalence partitioning and boundary values on each input, keep the test data in a CSV/Excel or TestNG DataProvider, and compare the UI result with an expected value computed from the business formula.
How do you automate file upload in Selenium?
Locate the input[type=file] element and call sendKeys with the absolute file path. No need to interact with the OS dialog.