Skip to content

Commit

Permalink
avd opionaly foe android real device (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcheung-hbo authored May 18, 2022
1 parent b81c5b2 commit 3832aea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ class YouiEngineDriver extends BaseDriver {

//Android emulator with proxy
if (caps.deviceName.toLowerCase() === 'android') {
if (!caps.avd) {

// avd is only required with emulator, which runs on localhost
if (!caps.avd && caps.youiEngineAppAddress === 'localhost') {
let msg = 'The desired capabilities must include avd';
logger.errorAndThrow(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": [
"appium"
],
"version": "1.2.9",
"version": "1.2.10",
"author": "youi.tv",
"license": "Apache-2.0",
"repository": {
Expand Down
17 changes: 15 additions & 2 deletions test/unit/driver-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,18 @@ describe('driver', function () {
driver.validateDesiredCaps({automationName: 'YouiEngine', platformName: 'NoProxy', deviceName: 'Android' });
}).to.not.throw(/must include/);
});
/*it('should not throw an error for minimum caps of Android emulator', () => {

it('should not throw an error for minimum caps of Android emulator', function () {
expect(() => {
driver.validateDesiredCaps({automationName: 'YouiEngine', platformName: 'Android', deviceName: 'Android', youiEngineAppAddress: 'localhost', app: '/path/to/some.app', avd: 'Nexus' });
}).to.not.throw(Error);
});*/
});

it('should throw an error if caps dos not contain avd for Android emulator', function () {
expect(() => {
driver.validateDesiredCaps({automationName: 'YouiEngine', platformName: 'Android', deviceName: 'Android', youiEngineAppAddress: 'localhost', app: '/path/to/some.app' });
}).to.throw(Error);
});

// 4) Android real device
it('should not throw an error for minimum caps of Android real device', function () {
Expand All @@ -169,6 +176,12 @@ describe('driver', function () {
}).to.not.throw(Error);
});

it('should not throw an error if caps dos not contain avd for Android real device', function () {
expect(() => {
driver.validateDesiredCaps({automationName: 'YouiEngine', platformName: 'Android', deviceName: 'Android', youiEngineAppAddress: '192.168.1.72', app: '/path/to/some.app' });
}).to.not.throw(Error);
});

// 5) iOS simulator without proxy
it('should not throw an error for minimum caps of iOS simulator without proxy', function () {
expect(() => {
Expand Down

0 comments on commit 3832aea

Please sign in to comment.