Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
JiglioNero committed Aug 26, 2020
1 parent 2c7fbcb commit 7259c40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/smoke/package/src/debugAndroid.test.ts
Expand Up @@ -234,16 +234,21 @@ export function setup(testParameters?: TestRunArguments) {

it("RN Android emulator save test", async function () {
this.timeout(debugAndroidTestTime);
console.log("Android emulator save test: Terminating Android emulator");
AndroidEmulatorHelper.terminateAndroidEmulator();
app = await runVSCode(pureRNWorkspacePath);
console.log("Android emulator save test: Starting debugging in first time");
await app.workbench.quickaccess.runDebugScenario(RNDebugConfigName);
console.log("Android emulator save test: Debugging started in first time");
console.log(AndroidEmulatorHelper.getAndroidEmulatorsNamesList());
console.log("Android emulator save test: Wait until emulator starting");
await AndroidEmulatorHelper.waitUntilEmulatorStarting();
const isScenarioUpdated = await waitUntilLaunchScenarioTargetUpdate(pureRNWorkspacePath);
console.log(`Android emulator save test: launch.json is ${isScenarioUpdated ? "" : "not "}contains '"target": "${AndroidEmulatorHelper.getDevice()}"'`);
assert.notStrictEqual(isScenarioUpdated, false, "The launch.json has not been updated");
console.log("Android emulator save test: Dispose all");
await disposeAll();
console.log("Android emulator save test: Terminating Android emulator");
AndroidEmulatorHelper.terminateAndroidEmulator();
app = await runVSCode(pureRNWorkspacePath);
console.log("Android emulator save test: Starting debugging in second time");
Expand Down
13 changes: 13 additions & 0 deletions test/smoke/package/src/helpers/androidEmulatorHelper.ts
Expand Up @@ -32,6 +32,19 @@ export class AndroidEmulatorHelper {
return AndroidEmulatorHelper.parseConnectedDevices(devices);
}

public static getAndroidEmulatorsNamesList(): string[] {
const res = cp.execSync("emulator -list-avds").toString();
let emulatorsList: string[] = [];
if (res) {
emulatorsList = res.split(/\r?\n|\r/g);
const indexOfBlank = emulatorsList.indexOf("");
if (emulatorsList.indexOf("") >= 0) {
emulatorsList.splice(indexOfBlank, 1);
}
}
return emulatorsList;
}

private static parseConnectedDevices(input: string): IDevice[] {
let result: IDevice[] = [];
let regex = new RegExp("^(\\S+)\\t(\\S+)$", "mg");
Expand Down

0 comments on commit 7259c40

Please sign in to comment.