diff --git a/lib/helpers.js b/lib/helpers.js index 8aa1080c..a531e504 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1005,7 +1005,7 @@ function parseLaunchableActivityNames (dumpsys) { */ function matchComponentName (classString) { // some.package/some.package.Activity - return /^[a-z0-9./_]+$/i.exec(classString); + return /^[\p{L}0-9./_]+$/u.exec(classString); } /** diff --git a/test/unit/helper-specs.js b/test/unit/helper-specs.js index 15be37ee..10483dbb 100644 --- a/test/unit/helper-specs.js +++ b/test/unit/helper-specs.js @@ -2,7 +2,7 @@ import { getAndroidPlatformAndPath, buildStartCmd, isShowingLockscreen, getBuildToolsDirs, parseAaptStrings, parseAapt2Strings, - extractMatchingPermissions, parseLaunchableActivityNames, + extractMatchingPermissions, parseLaunchableActivityNames, matchComponentName, } from '../../lib/helpers'; import { withMocks } from '@appium/test-support'; import { fs } from '@appium/support'; @@ -472,4 +472,15 @@ describe('helpers', withMocks({fs}, function (mocks) { names.should.be.eql([]); }); }); + describe('matchComponentName', function () { + it('test valid activity name', function () { + const activity = 'ןذأצЮυπиС.נפשוקשΤπΟ.ЦοКسئοهΦΦ'; + const names = matchComponentName(activity); + names.should.eql([activity]); + }); + it('test invalid activity name', function () { + const activity = 'User@123'; + _.isNull(matchComponentName(activity)).should.be.true; + }); + }); }));