refactor: restructure navigation into 5 grouped hubs, off the 22-item flat strip
Implements the researched IA fix: mobile nav UX consensus caps primary destinations at 4-5 (uxpin.com, fintech/banking 2026 UX research), and this app had grown to 22 tabs in one horizontally-scrolling row — exactly the anti-pattern that research flags for choice paralysis and slower task completion. New structure — 5 bottom-nav hubs, grouped by what the user is actually trying to do, not build order: - Home: Coverage (unchanged, still the landing screen) - Estate: Assets, Faraid, Insurance, Wassiyah, Hibah, Family Waqf, Nominate, Claims (H2) - Giving: Zakat, Sadaqah, Khairat - Family: Tree, Trigger, Mutawalli, Manage (was 'Family', renamed to avoid colliding with the hub's own label), Neighbourhood - Daily: Prayer Times, Qibla, Quran, Locate Each hub reveals its own sub-nav one tap in, instead of every tab competing for space in a single row. Settings moved out of the tab strip entirely into a header gear icon, matching the banking-app pattern of keeping settings out of primary thumb-reach real estate. The bottom nav is now fixed (thumb-zone), sub-nav keeps the old sticky-top position. Cross-component navigation (nav.js requestedTab, used by the Family Tree's 'give sadaqah in memory' link) now resolves a tab label to its owning (hub, sub-tab) pair instead of a flat index — verified live. This touches every E2E suite: a single click on a tab's old selector no longer reaches it (hub, then sub-tab). Added a shared gotoTab(page, label) helper to e2e-auth-helper.cjs encapsulating the two-step navigation, and migrated all ~22 affected test files off direct nav-button selectors — mechanical substitution followed by manual fixes for local clickTab wrappers, template-literal selectors, and active-state assertions that needed to target the new .hub-tab/.subnav structure specifically. Full regression after migration: every suite passes (one isolated Family Tree flake confirmed clean on rerun, unrelated to navigation).
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// backend. Geolocation-dependent tabs use Playwright's mocked geolocation
|
||||
// (Kuala Lumpur coordinates) rather than the real device.
|
||||
const { chromium } = require('playwright');
|
||||
const { signInFreshFamily } = require('./e2e-auth-helper.cjs');
|
||||
const { signInFreshFamily, gotoTab } = require('./e2e-auth-helper.cjs');
|
||||
const BASE = 'https://moslem04.falahos.my/';
|
||||
const results = [];
|
||||
const consoleErrors = [];
|
||||
@@ -23,7 +23,7 @@ async function main() {
|
||||
await signInFreshFamily(page, BASE, 'e2e-khairat');
|
||||
|
||||
// ── Khairat ──
|
||||
await page.locator('nav button[aria-label="Khairat"]').click();
|
||||
await gotoTab(page, 'Khairat');
|
||||
await page.waitForTimeout(600);
|
||||
await page.locator('.field:has-text("Scheme name") input').fill('Kariah Khairat Kematian Masjid Al-Falah');
|
||||
await page.locator('.field:has-text("Organization") input').fill('Masjid Al-Falah');
|
||||
@@ -39,7 +39,7 @@ async function main() {
|
||||
record('Khairat: emergency fund progress bar computes correctly (1250/5000 = 25%)', fundProgressVisible);
|
||||
|
||||
// ── Trusted contacts with category + email ──
|
||||
await page.locator('nav button[aria-label="Assets"]').click();
|
||||
await gotoTab(page, 'Assets');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('.contacts-section .field:has-text("Name") input').fill('Masjid Al-Falah Office');
|
||||
await page.locator('.contacts-section .field:has-text("Category") select').selectOption('mosque');
|
||||
@@ -50,7 +50,7 @@ async function main() {
|
||||
record('Trusted Contacts: category badge shows on the new contact', contactCategoryVisible);
|
||||
|
||||
// ── Qibla ──
|
||||
await page.locator('nav button[aria-label="Qibla"]').click();
|
||||
await gotoTab(page, 'Qibla');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('button.btn-primary', { hasText: 'Find Qibla direction' }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
@@ -61,7 +61,7 @@ async function main() {
|
||||
record('Qibla: shows distance to Makkah', distanceVisible);
|
||||
|
||||
// ── Prayer Times ──
|
||||
await page.locator('nav button[aria-label="Prayer Times"]').click();
|
||||
await gotoTab(page, 'Prayer Times');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('button.btn-primary', { hasText: "Calculate today's prayer times" }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
@@ -70,7 +70,7 @@ async function main() {
|
||||
record('Prayer Times: computes all 6 times for Kuala Lumpur', fajrVisible && /Fajr[\s\S]*Sunrise[\s\S]*Dhuhr[\s\S]*Asr[\s\S]*Maghrib[\s\S]*Isha/.test(timesInOrder), timesInOrder.replace(/\n/g, ' '));
|
||||
|
||||
// ── Locate (mosque search via live OpenStreetMap Overpass) ──
|
||||
await page.locator('nav button[aria-label="Locate"]').click();
|
||||
await gotoTab(page, 'Locate');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('button.btn-primary', { hasText: 'Search nearby' }).click();
|
||||
await page.waitForTimeout(8000); // live Overpass API call
|
||||
@@ -78,7 +78,7 @@ async function main() {
|
||||
record('Locate: mosque search completes (real results or honest empty state)', locateResultOrEmpty);
|
||||
|
||||
// ── Quran ──
|
||||
await page.locator('nav button[aria-label="Quran"]').click();
|
||||
await gotoTab(page, 'Quran');
|
||||
await page.waitForTimeout(2000);
|
||||
const surahListVisible = await page.locator('.surah-row', { hasText: 'Al-Faatiha' }).isVisible().catch(() => false);
|
||||
record('Quran: Surah list loads from the public API (Al-Faatiha present)', surahListVisible);
|
||||
@@ -95,7 +95,7 @@ async function main() {
|
||||
// Neighbourhoods are scoped to the user account, not the family — the
|
||||
// shared e2e owner account may already belong to one from a prior run,
|
||||
// in which case the create/join form is behind the "add another" toggle.
|
||||
await page.locator('nav button[aria-label="Neighbourhood"]').click();
|
||||
await gotoTab(page, 'Neighbourhood');
|
||||
await page.waitForTimeout(600);
|
||||
const addToggleVisible = await page.locator('.add-toggle').isVisible().catch(() => false);
|
||||
if (addToggleVisible) await page.locator('.add-toggle').click();
|
||||
@@ -124,7 +124,7 @@ async function main() {
|
||||
const secondContext = await browser.newContext({ viewport: { width: 390, height: 844 } });
|
||||
const secondPage = await secondContext.newPage();
|
||||
await signInFreshFamily(secondPage, BASE, 'e2e-khairat-neighbour2');
|
||||
await secondPage.locator('nav button[aria-label="Neighbourhood"]').click();
|
||||
await gotoTab(secondPage, 'Neighbourhood');
|
||||
await secondPage.waitForTimeout(600);
|
||||
const secondAddToggleVisible = await secondPage.locator('.add-toggle').isVisible().catch(() => false);
|
||||
if (secondAddToggleVisible) await secondPage.locator('.add-toggle').click();
|
||||
|
||||
Reference in New Issue
Block a user