Practice tasks
A seat map is the one screen most practice sites never give you. Selecting seats, holding that selection across three pages and building a form from it is exactly the kind of flow that catches people out in interviews.
1. Search
- Submit the search with no cities and assert the error message.
- Pick the same city in From and To and assert it is rejected.
- Use the swap button and assert the two cities exchange places.
- Click Tomorrow and assert the date field holds tomorrow's date.
- Search Chennai to Bengaluru and assert the route bar shows both cities and the date.
- Search a route with no service and assert the empty state.
2. Results and filters
- Assert the bus count text matches the number of result rows.
- Tick AC and assert every row shows an AC bus.
- Tick Sleeper as well and assert both conditions hold.
- Filter by one operator and assert only that operator remains.
- Drag the fare slider to 900 and assert no row shows a higher fare.
- Tick After 6 pm and assert every departure time is later than 18:00.
- Sort by fare ascending, then by rating, and assert both orders.
- Clear the filters and assert every bus on the route is back.
3. Seat selection
- Assert Continue is disabled before any seat is picked.
- Click a booked seat and assert nothing is selected.
- Pick two seats and assert the total equals fare x 2.
- Click a selected seat again and assert it is released and the total drops.
- Try to pick a seventh seat and assert the limit message.
- Assert a sleeper bus shows an upper deck and a seater bus does not.
- Pick seats but leave the boarding point empty and assert Continue stays disabled.
- Choose a boarding and a dropping point and assert Continue becomes enabled.
4. Passengers, payment and ticket
- Assert one passenger block is generated per selected seat, each labelled with its seat number.
- Submit the empty form and assert every passenger and contact field is listed.
- Enter an age of 0 and of 121 and assert both are rejected.
- Select UPI and assert the UPI field appears; select Card and assert it is replaced.
- Select the wallet with a total above 500 and assert the balance message.
- Add insurance and assert the total rises by 20 per passenger.
- Book the ticket and assert the PNR matches
TG-XXXXXXXX. - Download the ticket and assert the file is saved.
- Open My bookings, cancel the trip and assert the status changes.
Where the data lives
The search, the seat selection and the bookings are kept in localStorage under
tg_search, tg_selection and tg_bookings. Reset between runs with:
// Selenium
((JavascriptExecutor) driver).executeScript("window.localStorage.clear()");
// Playwright
await page.evaluate(() => localStorage.clear());