Voltar ao blog
Casos de uso

QA Testing Across Geographies with Cloud Browsers

How to use cloud browsers for geographic QA testing, including localization verification, geo-restricted content, and regional compliance.

Introduction

Modern web applications serve different content, pricing, and functionality based on the user's location. QA teams need to verify that localization, geo-restrictions, and regional compliance work correctly from multiple geographic perspectives. Cloud browsers make this practical without maintaining infrastructure in every target region.

Geographic QA Challenges

What Varies by Location

  • Content language - Auto-detected from IP and browser language
  • Currency and pricing - Different prices for different markets
  • Product availability - Some products restricted to specific regions
  • Legal disclaimers - GDPR banners in EU, CCPA notices in California
  • Payment methods - Region-specific options (iDEAL in Netherlands, PIX in Brazil)
  • CDN routing - Content served from different edge locations
  • Feature flags - Gradual rollouts by region

Common Bugs

  1. Wrong currency for the detected region
  2. Missing translations or fallback to English
  3. Geo-blocked content accessible where it should not be (or vice versa)
  4. GDPR consent banner not shown in EU
  5. Wrong date format for the locale
  6. Payment gateway errors for region-specific methods

Building Geographic Test Suites

Basic Geographic Verification

const testRegions = [
  {
    name: 'US',
    proxy: 'socks5h://user:pass@us-proxy:1080',
    expectedLanguage: 'en',
    expectedCurrency: 'USD',
  },
  {
    name: 'Germany',
    proxy: 'socks5h://user:pass@de-proxy:1080',
    expectedLanguage: 'de',
    expectedCurrency: 'EUR',
  },
  {
    name: 'Japan',
    proxy: 'socks5h://user:pass@jp-proxy:1080',
    expectedLanguage: 'ja',
    expectedCurrency: 'JPY',
  },
];

async function testRegionalContent(url) {
  for (const region of testRegions) {
    const browser = await puppeteer.connect({
      browserWSEndpoint:
        `wss://bots.win/ws?apiKey=YOUR_API_KEY&proxy=${encodeURIComponent(region.proxy)}`,
    });

    const page = await browser.newPage();
    await page.goto(url, { waitUntil: 'networkidle2' });

    // Check language
    const lang = await page.evaluate(() => document.documentElement.lang);
    console.assert(
      lang.startsWith(region.expectedLanguage),
      `${region.name}: Expected language ${region.expectedLanguage}, got ${lang}`
    );

    // Check currency
    const hasCurrency = await page.evaluate((currency) => {
      return document.body.textContent.includes(currency);
    }, region.expectedCurrency);
    console.assert(
      hasCurrency,
      `${region.name}: Expected currency ${region.expectedCurrency} not found`
    );

    console.log(`${region.name}: PASSED`);
    await browser.close();
  }
}

GDPR Compliance Testing

async function testGDPRBanner(url) {
  // Test from EU location
  const euBrowser = await puppeteer.connect({
    browserWSEndpoint:
      'wss://bots.win/ws?apiKey=YOUR_API_KEY&proxy=socks5h://user:pass@eu-proxy:1080',
  });

  const euPage = await euBrowser.newPage();
  await euPage.goto(url, { waitUntil: 'networkidle2' });

  const euHasBanner = await euPage.evaluate(() => {
    const bannerSelectors = [
      '[class*="cookie-banner"]',
      '[class*="consent"]',
      '[id*="gdpr"]',
      '[class*="privacy-notice"]',
    ];
    return bannerSelectors.some(sel => document.querySelector(sel) !== null);
  });

  console.assert(euHasBanner, 'GDPR banner should appear for EU visitors');
  await euBrowser.close();

  // Test from non-EU location
  const usBrowser = await puppeteer.connect({
    browserWSEndpoint:
      'wss://bots.win/ws?apiKey=YOUR_API_KEY&proxy=socks5h://user:pass@us-proxy:1080',
  });

  const usPage = await usBrowser.newPage();
  await usPage.goto(url, { waitUntil: 'networkidle2' });

  // Verify appropriate behavior for US visitors
  // (May or may not have banner depending on site policy)

  await usBrowser.close();
}

Visual Regression by Region

async function captureRegionalScreenshots(url, outputDir) {
  for (const region of testRegions) {
    const browser = await puppeteer.connect({
      browserWSEndpoint:
        `wss://bots.win/ws?apiKey=YOUR_API_KEY&proxy=${encodeURIComponent(region.proxy)}`,
    });

    const page = await browser.newPage();
    await page.setViewport({ width: 1920, height: 1080 });
    await page.goto(url, { waitUntil: 'networkidle2' });

    await page.screenshot({
      path: `${outputDir}/${region.name}.png`,
      fullPage: true,
    });

    await browser.close();
  }

  // Compare screenshots with baseline using pixel-diff tools
}

Best Practices

  1. Test from multiple regions that represent your actual user base
  2. Check both content and functionality from each region
  3. Verify compliance banners (GDPR, CCPA) appear in the correct regions
  4. Test payment flows with region-appropriate payment methods
  5. Capture screenshots for visual regression and documentation
  6. Automate regular checks as part of your CI/CD pipeline
  7. Use consistent profiles so differences are due to geography, not fingerprint variation
#qa#testing#localization#geo-testing