or run

npx @tessl/cli init
Log in

Version

Files

docs

browser-contexts.mdbrowser-management.mdelement-handling.mdindex.mdinput-simulation.mdlocators-selectors.mdnetwork-management.mdpage-interaction.md
tile.json

task.mdevals/scenario-7/

Location-Aware Browser Automation

A utility module for automated testing of location-sensitive web applications that need to verify behavior across different geographical locations and timezones.

Capabilities

Browser geolocation override

  • Given a browser page, set the geolocation to Tokyo coordinates (35.6762, 139.6503) with accuracy of 100 meters @test
  • Verify that the page's navigator.geolocation.getCurrentPosition reports the overridden coordinates @test

Timezone emulation

  • Given a browser page, set the timezone to "America/New_York" and verify that new Date().toString() reflects Eastern Time @test
  • Set timezone to "Europe/London" and confirm Date methods return times in GMT/BST @test

Combined location and timezone testing

  • Launch a browser session with Tokyo geolocation (35.6762, 139.6503) and Asia/Tokyo timezone, then navigate to a test page and verify both location and time are correctly emulated @test

Implementation

@generates

API

/**
 * Sets the geolocation for a browser page.
 *
 * @param page - The browser page to configure
 * @param latitude - Latitude coordinate (-90 to 90)
 * @param longitude - Longitude coordinate (-180 to 180)
 * @param accuracy - Optional accuracy in meters (default: 0)
 */
export async function setGeolocation(
  page: any,
  latitude: number,
  longitude: number,
  accuracy?: number
): Promise<void>;

/**
 * Sets the timezone for a browser page.
 *
 * @param page - The browser page to configure
 * @param timezoneId - IANA timezone identifier (e.g., "America/New_York", "Asia/Tokyo")
 */
export async function setTimezone(
  page: any,
  timezoneId: string
): Promise<void>;

/**
 * Launches a browser with both geolocation and timezone pre-configured.
 * Returns a browser instance with the specified settings.
 *
 * @param latitude - Latitude coordinate
 * @param longitude - Longitude coordinate
 * @param timezoneId - IANA timezone identifier
 * @param accuracy - Optional accuracy in meters (default: 0)
 * @returns Browser instance with configured settings
 */
export async function launchWithLocation(
  latitude: number,
  longitude: number,
  timezoneId: string,
  accuracy?: number
): Promise<any>;

Dependencies { .dependencies }

puppeteer-core { .dependency }

Provides browser automation and environment emulation support.

@satisfied-by