-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
72 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import log from '../logger'; | ||
import os from 'os'; | ||
|
||
|
||
let commands = {}, helpers = {}, extensions = {}; | ||
|
||
extensions.supportedLogTypes = { | ||
logcat: { | ||
description: 'Logs for Android applications on real device and emulators via ADB', | ||
getter: async (self) => await self.adb.getLogcatLogs(), | ||
}, | ||
bugreport: { | ||
description: `'adb bugreport' output for advanced issues diagnostic`, | ||
getter: async (self) => (await self.adb.bugreport()).split(os.EOL), | ||
}, | ||
server: { | ||
description: 'Appium server logs', | ||
getter: (self) => { | ||
if (!self.relaxedSecurityEnabled) { | ||
throw new Error('Appium server must have relaxed security flag set ' + | ||
'in order to be able to get server logs'); | ||
} | ||
return log.record; | ||
}, | ||
}, | ||
}; | ||
|
||
Object.assign(extensions, commands, helpers); | ||
export { commands, helpers }; | ||
export default extensions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import chai from 'chai'; | ||
import chaiAsPromised from 'chai-as-promised'; | ||
import _ from 'lodash'; | ||
import sinon from 'sinon'; | ||
import ADB from 'appium-adb'; | ||
import os from 'os'; | ||
import AndroidDriver from '../../..'; | ||
|
||
|
||
chai.should(); | ||
chai.use(chaiAsPromised); | ||
|
||
describe('commands - logging', function () { | ||
let driver; | ||
before(function () { | ||
driver = new AndroidDriver(); | ||
driver.adb = new ADB(); | ||
}); | ||
describe('getLogTypes', function () { | ||
it('should get log types', async function () { | ||
const types = await driver.getLogTypes(); | ||
// all the types should be returned | ||
_.xor(['logcat', 'bugreport', 'server'], types).should.eql([]); | ||
}); | ||
}); | ||
describe('getLog', function () { | ||
it('should get logcat logs', async function () { | ||
sinon.stub(driver.adb, 'getLogcatLogs').returns(['logs']); | ||
(await driver.getLog('logcat')).should.be.deep.equal(['logs']); | ||
driver.adb.getLogcatLogs.restore(); | ||
}); | ||
it('should get bugreport logs', async function () { | ||
sinon.stub(driver.adb, 'bugreport').returns(`line1${os.EOL}line2`); | ||
(await driver.getLog('bugreport')).should.be.deep.equal(['line1', 'line2']); | ||
driver.adb.bugreport.restore(); | ||
}); | ||
}); | ||
}); |