Skip to content

Commit

Permalink
feat: add support for activities with unicode chars (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Nov 10, 2024
1 parent 321cc93 commit 8494f72
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
14 changes: 13 additions & 1 deletion test/unit/helper-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -480,4 +480,16 @@ 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;
});

});
}));

0 comments on commit 8494f72

Please sign in to comment.