Offline Mode

Mobile Testingadvanced

// Definition

How an app behaves with no or intermittent network — queuing actions, serving cached data, and syncing when connectivity returns. Mobile networks drop constantly (tunnels, lifts, flaky wifi), so "works offline" isn't a feature so much as a requirement. The hard part QA targets is the transition: what happens to in-flight actions when the connection drops and returns.

// Why it matters

Offline bugs are data-loss bugs — an action that silently fails on a dropped connection, or a sync that overwrites newer data on reconnect, destroys user trust. QA matters because these only surface in the transition (online→offline→online), which is exactly the state manual testing on stable office wifi never hits.

// How to test

// Toggle connectivity mid-flow and assert queue + sync behaviour
await driver.$('~add-note').click()
await driver.$('~note-body').setValue('written offline')
await driver.setNetworkConnection(0) // airplane mode ON
await driver.$('~save').click()
expect(await driver.$('~pending-sync-badge').isDisplayed()).to.be.true // queued, not lost

await driver.setNetworkConnection(6) // wifi + data back
await driver.$('~pending-sync-badge').waitForExist({ reverse: true }) // synced
// assert no data loss and no duplicate on the server

// Common mistakes

  • Testing fully-offline but never the online→offline→online transition (where bugs live)
  • Losing queued actions silently instead of persisting them
  • Sync conflicts that overwrite newer data (last-write-wins data loss)

// Related terms