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

fix: Improve visibility of message to enable "Remote Debugging via USB" with web-ext run -t firefox-android #2038

Merged
merged 33 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7d20b04
Remote debugging message shown repeatedly
sonalprabhu Oct 2, 2020
42a2098
Looped the error message with different color
sonalprabhu Oct 2, 2020
3b3dd58
Removed trailing spaces
sonalprabhu Oct 2, 2020
702abc2
Corrected the errors
sonalprabhu Oct 2, 2020
2ad9a9e
Removed yellow color from warning
sonalprabhu Oct 2, 2020
5b785b0
Added tests for enable Remote Debugging warning
sonalprabhu Oct 8, 2020
39fabad
Merge branch 'master' into loop-warning
sonalprabhu Oct 8, 2020
0c95147
Remote debugging message shown repeatedly
sonalprabhu Oct 2, 2020
a3f8086
Looped the error message with different color
sonalprabhu Oct 2, 2020
bafc597
Removed trailing spaces
sonalprabhu Oct 2, 2020
e149055
Corrected the errors
sonalprabhu Oct 2, 2020
7673b0d
Removed yellow color from warning
sonalprabhu Oct 2, 2020
a7fc6ba
Added tests for enable Remote Debugging warning
sonalprabhu Oct 8, 2020
2cfcebe
chore(deps): update dependency eslint to v7.10.0 (#2033)
renovate[bot] Oct 1, 2020
15493db
chore(deps): update dependency eslint-plugin-import to v2.22.1 (#2034)
renovate[bot] Oct 1, 2020
aae0728
chore(deps): update dependency sinon to v9.1.0 (#2037)
renovate[bot] Oct 1, 2020
79f9a4b
fix(deps): update dependency firefox-profile to v4 (#2030)
renovate[bot] Oct 1, 2020
42ac6c8
fix(deps): update dependency addons-linter to v2.7.0 (#2032)
renovate[bot] Oct 1, 2020
dd3bfa9
fix(deps): update dependency open to v7.3.0 (#2004)
renovate[bot] Oct 1, 2020
abbbb15
chore(deps): update dependency git-rev-sync to v3 (#2013)
renovate[bot] Oct 1, 2020
e87f6d7
fix(deps): update dependency update-notifier to v5 (#2036)
renovate[bot] Oct 1, 2020
cf0f9ea
fix(deps): Switch from adbkit to @devicefarmer/adbkit npm package (#2…
rpl Oct 5, 2020
cc18128
chore: Bump package version for release 5.2.0
rpl Oct 5, 2020
c8dc6dd
New test case
sonalprabhu Oct 8, 2020
dedb126
Update flow.js
sonalprabhu Oct 8, 2020
2e5c510
Update test.adb.js
sonalprabhu Oct 9, 2020
ae36534
Update firefox-android.js
sonalprabhu Oct 9, 2020
2d5cc48
Update test.firefox-android.js
sonalprabhu Oct 9, 2020
de16ffb
Merge branch 'master' into loop-warning
sonalprabhu Oct 9, 2020
a0a8814
Made all the requested changes
sonalprabhu Oct 9, 2020
6821b86
Merge branch 'loop-warning' of https://github.com/sonalprabhu/web-ext…
sonalprabhu Oct 9, 2020
aaa26f5
Made the requested changes
sonalprabhu Oct 9, 2020
3b5e1ca
Update test.adb.js
sonalprabhu Oct 9, 2020
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: 0 additions & 8 deletions src/extension-runners/firefox-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,6 @@ export class FirefoxAndroidExtensionRunner {
}

try {
const msg = (
`Waiting for ${selectedFirefoxApk} Remote Debugging Server...` +
'\nMake sure to enable "Remote Debugging via USB" ' +
'from Settings -> Developer Tools if it is not yet enabled.'
);

log.info(`\n${msg}\n`);

// Got a debugger socket file to connect.
this.selectedRDPSocketFile = (
await adbUtils.discoverRDPUnixSocket(
Expand Down
6 changes: 6 additions & 0 deletions src/util/adb.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,14 @@ export default class ADBUtils {
let rdpUnixSockets = [];

const discoveryStartedAt = Date.now();
const msg = (
`Waiting for ${apk} Remote Debugging Server...` +
'\nMake sure to enable "Remote Debugging via USB" ' +
'from Settings -> Developer Tools if it is not yet enabled.'
);
rpl marked this conversation as resolved.
Show resolved Hide resolved

while (rdpUnixSockets.length === 0) {
log.info(msg);
if (this.userAbortDiscovery) {
throw new UsageError(
'Exiting Firefox Remote Debugging socket discovery on user request'
Expand Down
21 changes: 0 additions & 21 deletions tests/unit/test-extension-runners/test.firefox-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,27 +1029,6 @@ describe('util/extension-runners/firefox-android', () => {
consoleStream.stopCapturing();
});

it(
'does tell user to enable Remote Debugging when running Fenix',
async () => {
const {params, fakeADBUtils} = prepareSelectedDeviceAndAPKParams();
params.firefoxApk = 'org.mozilla.fenix.nightly';
fakeADBUtils.getAndroidVersionNumber = async () => 23;

consoleStream.startCapturing();
const runner = new FirefoxAndroidExtensionRunner(params);
await runner.run();

assert.match(
consoleStream.capturedMessages.join('\n'),
/Make sure to enable "Remote Debugging via USB"/
);

consoleStream.flushCapturedLogs();
consoleStream.stopCapturing();
}
);

});

});
37 changes: 37 additions & 0 deletions tests/unit/test-util/test.adb.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import ADBUtils, {
ARTIFACTS_DIR_PREFIX,
DEVICE_DIR_BASE,
} from '../../../src/util/adb';
import {
consoleStream, // instance is imported to inspect logged messages
} from '../../../src/util/logger';

const fakeADBPackageList = `
package:org.mozilla.fennec
Expand Down Expand Up @@ -1129,6 +1132,40 @@ describe('utils/adb', () => {
);
});

it('reminds the user to enable remote_debugging', async () => {
const adb = getFakeADBKit({
adbClient: {
shell: sinon.spy(() => Promise.resolve('')),
},
adbkitUtil: {
readAll: sinon.spy(() => {
return Promise.resolve(Buffer.from(''));
}),
},
});
const adbUtils = new ADBUtils({adb});

consoleStream.flushCapturedLogs();
consoleStream.makeVerbose();
consoleStream.startCapturing();

const promise = adbUtils.discoverRDPUnixSocket(
'device1', 'org.mozilla.firefox_mybuild', {
maxDiscoveryTime: 50, retryInterval: 10,
}
);
await assert.isRejected(promise, WebExtError);

const {capturedMessages} = consoleStream;
const foundMessage = capturedMessages.find((message) =>
message.includes('Make sure to enable "Remote Debugging via USB'));

consoleStream.stopCapturing();

assert.ok(foundMessage);
assert.ok(foundMessage && foundMessage.includes('[info]'));
});

it('rejects a WebExtError if more than one RDP socket have been found',
async () => {
const adb = getFakeADBKit({
Expand Down