Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no window option for running android emulator with no window #690

Merged
merged 6 commits into from
Apr 29, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions detox/local-cli/detox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ program
+ 'e.g test with substring \':ios:\' in its name will not run when passing \'--platform android\'')
.option('-f, --file [path]',
'Specify test file to run')
.option('-W, --nowindow',
'Run Android without window')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.Be as expressive as you can, this is documentation. Text suggestion: "[Android Only] Launch Emulator in headless mode. Useful when running on CI."
2. Update docs (cli section)
3. Why capital W?
4. Let's use same flag as emulator --no-window.
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Ok, fixed.
  2. Done.
  3. Right, changed this to -n
  4. --no-window is problematic for how we are doing the flags parsing (as you said). I changed it to --noWindow

.parse(process.argv);

if (program.configuration) {
Expand Down Expand Up @@ -94,9 +96,10 @@ function runMocha() {
const artifactsLocation = program.artifactsLocation ? `--artifacts-location ${program.artifactsLocation}` : '';
const configFile = runnerConfig ? `--opts ${runnerConfig}` : '';
const platformString = platform ? `--grep ${getPlatformSpecificString(platform)} --invert` : '';
const nowindow = program.nowindow ? `--nowindow` : '';

const debugSynchronization = program.debugSynchronization ? `--debug-synchronization ${program.debugSynchronization}` : '';
const command = `node_modules/.bin/mocha ${testFolder} ${configFile} ${configuration} ${loglevel} ${cleanup} ${reuse} ${debugSynchronization} ${platformString} ${artifactsLocation}`;
const command = `node_modules/.bin/mocha ${testFolder} ${configFile} ${configuration} ${loglevel} ${cleanup} ${reuse} ${debugSynchronization} ${platformString} ${artifactsLocation} ${nowindow}`;

console.log(command);
cp.execSync(command, {stdio: 'inherit'});
Expand All @@ -115,7 +118,8 @@ function runJest() {
cleanup: program.cleanup,
reuse: program.reuse,
debugSynchronization: program.debugSynchronization,
artifactsLocation: program.artifactsLocation
artifactsLocation: program.artifactsLocation,
nowindow: program.nowindow
})
});
}
Expand Down
4 changes: 3 additions & 1 deletion detox/src/devices/android/Emulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const log = require('npmlog');
const fs = require('fs');
const Environment = require('../../utils/environment');
const Tail = require('tail').Tail;
const argparse = require('../../utils/argparse');

class Emulator {
constructor() {
Expand All @@ -23,7 +24,8 @@ class Emulator {
}

async boot(emulatorName) {
const cmd = `-verbose -gpu host -no-audio @${emulatorName}`;
const nowindow = argparse.getArgValue('nowindow') ? '-no-window' : '';
const cmd = `-verbose -gpu host -no-audio ${nowindow} @${emulatorName}`;
log.verbose(this.emulatorBin, cmd);
const tempLog = `./${emulatorName}.log`;
const stdout = fs.openSync(tempLog, 'a');
Expand Down