Skip to main content

Overview

The Reload step refreshes the current page, simulating the user clicking the browser’s refresh button or pressing F5/Cmd+R. Use it to test page refresh behavior, verify data persistence, or ensure the latest content is loaded.

When to Use Reload

Use Reload when you need to:
  • Test data persistence: Verify that saved data survives a page refresh
  • Clear form state: Reset unsaved form data to test “are you sure?” warnings
  • Test real-time updates: Refresh to verify data updates correctly
  • Verify session handling: Check that user sessions persist across page reloads
  • Simulate user refresh: Test how your app handles unexpected refreshes

How It Works

Reload performs a full page refresh, just like clicking the browser’s refresh button. It reloads all resources (HTML, CSS, JavaScript), re-executes page scripts, and resets client-side state while preserving server-side session data. This is different from navigation - it refreshes the current URL rather than loading a new one.

Real-World Examples

Testing Form Data Persistence

Step 1: Navigate
  URL: https://example.com/create-post

Step 2: Fill
  Locator: input[name='title']
  Text: My Draft Post

Step 3: Fill
  Locator: textarea[name='content']
  Text: This is a draft that should be saved

Step 4: Click
  Locator: button[data-action='save-draft']

Step 5: Reload

Step 6: Check Text
  Locator: input[name='title']
  Expected Text: My Draft Post
Why this works: Save a draft and verify it persists after page reload.

Testing Session Persistence

Step 1: Navigate
  URL: https://example.com/login

Step 2: Fill
  Locator: input[name='email']
  Text: {{USER_EMAIL}}

Step 3: Fill
  Locator: input[name='password']
  Text: {{USER_PASSWORD}}

Step 4: Click
  Locator: button[type='submit']

Step 5: Check URL
  Pattern: /dashboard

Step 6: Reload

Step 7: Check URL
  Pattern: /dashboard

Step 8: Check Text
  Locator: .user-display-name
  Expected Text: {{USER_NAME}}
Why this works: Log in and verify the session persists after page reload.

Testing Unsaved Data Warning

Step 1: Navigate
  URL: https://example.com/edit-profile

Step 2: Fill
  Locator: input[name='bio']
  Text: Updated biography

Step 3: Reload

Step 4: Check Visibility
  Locator: .unsaved-changes-warning
  Assertion: Is visible

Step 5: Click
  Locator: button[data-action='discard-changes']
Why this works: Make changes without saving and verify a warning appears on reload.

Testing Dynamic Content Refresh

Step 1: Navigate
  URL: https://example.com/dashboard

Step 2: Extract Value
  Locator: .timestamp
  Variable Name: firstTimestamp

Step 3: Reload

Step 4: Wait for Element
  Locator: .content-loaded

Step 5: Extract Value
  Locator: .timestamp
  Variable Name: secondTimestamp
Why this works: Verify that dynamic content updates with each page refresh.

Best Practices

Wait After Reload

  • Add Wait for Element to ensure the page fully loads
  • Wait for loading indicators to disappear
  • Account for slower network connections
  • Verify key elements are present before continuing

Consider State Loss

  • Unsaved form data will be lost on reload
  • Client-side state (like scroll position) resets
  • Some apps show confirmation dialogs before reload
  • Test both “stay on page” and “leave page” scenarios

Test Both States

Verify behavior both before and after reload:
  • Check data before reload to establish baseline
  • Reload the page
  • Verify what should persist (saved data, sessions)
  • Verify what should reset (unsaved changes, temporary state)

Troubleshooting

Page Doesn’t Reload

Symptom: Reload step completes but page seems unchanged Solution:
  • Add Wait for Element to ensure reload completes
  • Check network tab to verify page actually reloaded
  • Look for browser caching issues
  • Test manually to confirm reload behavior

Data Lost Unexpectedly

Symptom: Data that should persist is lost after reload Solution:
  • Verify data was actually saved before reload
  • Check that server-side storage is working correctly
  • Confirm session cookies are being set
  • Test manually to isolate the issue

Auth Redirects

Symptom: Reload causes unexpected redirect to login Solution:
  • Verify session is properly established before reload
  • Check session timeout settings
  • Ensure cookies are being saved correctly
  • Add Check URL after reload to verify location