New issue
Advanced search Search tips

Issue 782823 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 904360



Sign in to add a comment

Add tests that ensure translations are working

Project Member Reported by agrieve@chromium.org, Nov 8 2017

Issue description

We've had a few bugs in the past that have led to Chrome losing translations for locales.

One that affected Brazilian Portuguese (bug #691594)
And more recently, Filipino (bug #780331).

We really need to have tests that just launch Chrome in each supported locale, and checks that translations exist.

Since instrumentation tests have a different start-up flow from normal Chrome, it would be ideal if these tests did not use instrumentation (or, at least not our default instrumentation).

Here's an idea for testing .pak strings:
1. Use adb to change locale
2. Wipe app data
3. Launch Chrome with a URL about:version
4. Use devtools protocol to fetch the HTML and ensure it's translated (this validates strings from .pak files)
Note: telemetry already uses devtools protocol, so there's a client library for this already:
https://cs.chromium.org/chromium/src/third_party/android_tools/sdk/platform-tools/systrace/catapult/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py?rcl=4a9623af577555a8dab891c8789cc3dfe80addae&l=142


Here's an idea for testing .arsc strings:
1. Launch with URL: about:newtab
2. Dump view hierarchy:
adb -s 00b424b27f9028b4ml'ell 'uiautomator dump /data/local/tmp/dump.xml >/dev/null && cat /data/local/tmp/dump.xml'
3. Grep it for text="$EXPECTED_STRING"

Not sure if this would be best to write as a "python" test in test_runner.py, or a "perf" test. Many pieces of what I described is already done for perf tests, but I'm not very familiar with that code yet.
 
Issue 778729 has been merged into this issue.
Another possible option might be uiautomator? I'm not sure if it would work for native resources though. 
Also learned about chromedriver:
https://cs.chromium.org/chromium/src/chrome/test/data/chromedriver/

It wraps devtools APIs in a python interface. So we could do:

#!/usr/bin/env python
from selenium import webdriver

cap = {
  'chromeOptions': {
      'args': ['--testing', '--no-first-run', '--disable-fre'],
    'androidPackage': 'org.chromium.chrome'
  }
}

driver = webdriver.Chrome(desired_capabilities={
    'chromeOptions': {'args': ['--disable-fre'],
    'androidPackage': 'org.chromium.chrome'})
try
driver.get('chrome://version')
assert 'SOME_STRING' in driver.page_source
driver.quit()

Looks like telemetry already has code that runs uiautomator dump:

https://cs.chromium.org/chromium/src/third_party/catapult/devil/devil/android/app_ui.py
Owner: estevenson@chromium.org
Status: Assigned (was: Available)
Summarized some thoughts it a doc https://docs.google.com/document/d/14TnUNfVR5eHzwje4pfFUbQvIV9geoaDNB_ugG_ACGPA/edit?hl=en#. I'll get started on this once we decide on which approach is best.
Owner: jbudorick@chromium.org
Assigning to John to get feedback before I start on this.
Blockedon: 904360

Sign in to add a comment